Skip to content

Commit

Permalink
Prevent divide by zero error
Browse files Browse the repository at this point in the history
This can happen if the requested tasks count is lower than the nodes
count. This commit restores behavior before ca510f2

Bug 15857
  • Loading branch information
fafik23 authored and MarshallGarey committed Feb 7, 2023
1 parent 3b8302e commit aee252a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -8,6 +8,7 @@ documents those changes that are of interest to users and administrators.
-- Fix handling of --prefer for job arrays.
-- Fix regression in 22.05.5 that causes some jobs that request
--ntasks-per-node to be incorrectly rejected.
-- Fix slurmctld crash when a step requests fewer tasks than nodes.

* Changes in Slurm 22.05.8
==========================
Expand Down
5 changes: 4 additions & 1 deletion src/slurmctld/step_mgr.c
Expand Up @@ -2135,7 +2135,10 @@ static int _pick_step_cores(step_record_t *step_ptr,
job_resrcs_ptr->core_bitmap);
}
}
cpus_per_task = cpu_cnt / task_cnt;
if (task_cnt)
cpus_per_task = cpu_cnt / task_cnt;
else
cpus_per_task = cpu_cnt;
/* select idle cores that fit all gres binding first */
if (_handle_core_select(step_ptr, job_resrcs_ptr,
all_gres_core_bitmap, job_node_inx,
Expand Down

0 comments on commit aee252a

Please sign in to comment.