Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Dec 2, 2024
1 parent 4175420 commit 5fe3ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl Cluster {
self.partition
.iter()
.find(|p| p.matches(resources, n_directories, &mut reason))
.ok_or_else(|| Error::PartitionNotFound(reason))?
.ok_or(Error::PartitionNotFound(reason))?
};

Ok(partition)
Expand Down
12 changes: 8 additions & 4 deletions src/scheduler/slurm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ impl Scheduler for Slurm {
let _ = writeln!(preamble, "#SBATCH --gpus-per-task={gpus_per_process}");

if let Some(ref gpus_per_node) = partition.gpus_per_node {
let n_nodes = (action.resources.total_gpus(directories.len()) + gpus_per_node - 1)
/ gpus_per_node;
let n_nodes = action
.resources
.total_gpus(directories.len())
.div_ceil(*gpus_per_node);
let _ = writeln!(preamble, "#SBATCH --nodes={n_nodes}");
}

Expand All @@ -104,8 +106,10 @@ impl Scheduler for Slurm {
}
} else {
if let Some(ref cpus_per_node) = partition.cpus_per_node {
let n_nodes = (action.resources.total_cpus(directories.len()) + cpus_per_node - 1)
/ cpus_per_node;
let n_nodes = action
.resources
.total_cpus(directories.len())
.div_ceil(*cpus_per_node);
let _ = writeln!(preamble, "#SBATCH --nodes={n_nodes}");
}

Expand Down

0 comments on commit 5fe3ba0

Please sign in to comment.