Skip to content
Snippets Groups Projects
Commit 1e7a3711 authored by Hongjia Cao's avatar Hongjia Cao Committed by Morris Jette
Browse files

Correct srun --no-alloc task layout if task count not a multiple of node count

srun: do not allocate resources
cn9
cn9
cn8
cn8
parent 4be25635
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,8 @@ documents those changes that are of interest to users and admins. ...@@ -32,6 +32,8 @@ documents those changes that are of interest to users and admins.
partition name by default. partition name by default.
-- Make it so the parse_time will return a valid 0 if given epoch time and -- Make it so the parse_time will return a valid 0 if given epoch time and
set errno == ESLURM_INVALID_TIME_VALUE on error instead. set errno == ESLURM_INVALID_TIME_VALUE on error instead.
-- Correct srun --no-alloc logic when node count exceeds node list or task
task count is not a multiple of the node count. Work by Hongjia Cao, NUDT.
* Changes in SLURM 2.5.0.pre1 * Changes in SLURM 2.5.0.pre1
============================= =============================
......
...@@ -163,7 +163,6 @@ slurm_step_layout_t *fake_slurm_step_layout_create( ...@@ -163,7 +163,6 @@ slurm_step_layout_t *fake_slurm_step_layout_create(
{ {
uint32_t cpn = 1; uint32_t cpn = 1;
int cpu_cnt = 0, cpu_inx = 0, i, j; int cpu_cnt = 0, cpu_inx = 0, i, j;
hostlist_t hl = NULL;
slurm_step_layout_t *step_layout = NULL; slurm_step_layout_t *step_layout = NULL;
if ((node_cnt <= 0) || (task_cnt <= 0 && !cpus_per_node) || !tlist) { if ((node_cnt <= 0) || (task_cnt <= 0 && !cpus_per_node) || !tlist) {
...@@ -173,11 +172,6 @@ slurm_step_layout_t *fake_slurm_step_layout_create( ...@@ -173,11 +172,6 @@ slurm_step_layout_t *fake_slurm_step_layout_create(
return NULL; return NULL;
} }
hl = hostlist_create(tlist);
/* make out how many cpus there are on each node */
if (task_cnt > 0)
cpn = (task_cnt + node_cnt - 1) / node_cnt;
step_layout = xmalloc(sizeof(slurm_step_layout_t)); step_layout = xmalloc(sizeof(slurm_step_layout_t));
step_layout->node_list = xstrdup(tlist); step_layout->node_list = xstrdup(tlist);
step_layout->node_cnt = node_cnt; step_layout->node_cnt = node_cnt;
...@@ -201,6 +195,8 @@ slurm_step_layout_t *fake_slurm_step_layout_create( ...@@ -201,6 +195,8 @@ slurm_step_layout_t *fake_slurm_step_layout_create(
cpu_cnt = 0; cpu_cnt = 0;
} }
} else { } else {
cpn = ((task_cnt - step_layout->task_cnt) +
(node_cnt - i) - 1) / (node_cnt - i);
if (step_layout->task_cnt >= task_cnt) { if (step_layout->task_cnt >= task_cnt) {
step_layout->tasks[i] = 0; step_layout->tasks[i] = 0;
step_layout->tids[i] = NULL; step_layout->tids[i] = NULL;
...@@ -212,7 +208,7 @@ slurm_step_layout_t *fake_slurm_step_layout_create( ...@@ -212,7 +208,7 @@ slurm_step_layout_t *fake_slurm_step_layout_create(
for (j = 0; j < cpn; j++) { for (j = 0; j < cpn; j++) {
step_layout->tids[i][j] = step_layout->tids[i][j] =
step_layout->task_cnt++; step_layout->task_cnt++;
if(step_layout->task_cnt >= task_cnt) { if (step_layout->task_cnt >= task_cnt) {
step_layout->tasks[i] = j + 1; step_layout->tasks[i] = j + 1;
break; break;
} }
...@@ -220,7 +216,7 @@ slurm_step_layout_t *fake_slurm_step_layout_create( ...@@ -220,7 +216,7 @@ slurm_step_layout_t *fake_slurm_step_layout_create(
} }
} }
} }
hostlist_destroy(hl);
return step_layout; return step_layout;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment