diff --git a/NEWS b/NEWS index 59db4be0a1166760d198c7c595fff86ba08d7941..56a37d476e12f0848db75365add8d0949146e07f 100644 --- a/NEWS +++ b/NEWS @@ -117,6 +117,9 @@ documents those changes that are of interest to users and admins. -- For a job step, add support for srun's --nodelist and --exclusive options to be used together. -- On slurmstepd failure, set node state to DRAIN rather than DOWN. + -- Fix bug in select/cons_res that would incorrectly satify a tasks's + --cpus-per-task specification by allocating the task CPUs on more than + one node. * Changes in SLURM 1.3.11 ========================= diff --git a/src/plugins/select/cons_res/job_test.c b/src/plugins/select/cons_res/job_test.c index 1355a92da7d40aac7ec784a793e978d23df14564..bc2929872b64f08c156f250e6e8fe7b22090a8d6 100644 --- a/src/plugins/select/cons_res/job_test.c +++ b/src/plugins/select/cons_res/job_test.c @@ -1135,9 +1135,25 @@ static int _choose_nodes(struct job_record *job_ptr, bitstr_t *node_map, uint32_t req_nodes, uint32_t cr_node_cnt, uint16_t *cpu_cnt, uint32_t *freq, uint32_t size) { - int i, node_boundary, count, ec, most_cpus = 0; + int i, b, node_boundary, count, ec, most_cpus = 0; bitstr_t *origmap, *reqmap = NULL; + if (job_ptr->details->req_node_bitmap) + reqmap = job_ptr->details->req_node_bitmap; + + /* clear nodes from the bitmap that don't have available resources */ + for (i = 0, b = 0; i < size; i++) { + for (count = 0; count < freq[i]; count++, b++) { + if (bit_test(node_map, b) && cpu_cnt[i] < 1) { + if (reqmap && bit_test(reqmap, b)) { + /* can't clear a required node! */ + return SLURM_ERROR; + } + bit_clear(node_map, b); + } + } + } + /* allocated node count should never exceed num_procs, right? * if so, then this should be done earlier and max_nodes * could be used to make this process more efficient (truncate @@ -1166,9 +1182,6 @@ static int _choose_nodes(struct job_record *job_ptr, bitstr_t *node_map, most_cpus = cpu_cnt[i]; } - if (job_ptr->details->req_node_bitmap) - reqmap = job_ptr->details->req_node_bitmap; - for (count = 1; count < most_cpus; count++) { int nochange = 1; bit_or(node_map, origmap);