* --cpus-per-task is supposed to imply --exact, but I just tested this and it is broken. Example:
$ salloc -n8
salloc: Granted job allocation 279
salloc: Waiting for resource configuration
salloc: Nodes n1-1 are ready for job
$ srun -c1 -n1 whereami
0000 n1-1 - Cpus_allowed: 00000f0f Cpus_allowed_list: 0-3,8-11
$ srun --exact -c1 -n1 whereami
0000 n1-1 - Cpus_allowed: 00000101 Cpus_allowed_list: 0,8
It was broken during the refactor in commit 5154ed21e2c.
That commit makes everything set in step_req, but did not make the change for srun -c.
This fixes it, but duplicates setting the flags in step_req.
We could move blocks of code instead:
* Set the flags *after* looking at overcommit and cpus_per_task.
* Look at the overcommit and cpus_per_task options before setting the flags.
$ git diff
diff --git a/src/srun/libsrun/launch.c b/src/srun/libsrun/launch.c
index c4051a669e..66ea4fca1e 100644
--- a/src/srun/libsrun/launch.c
+++ b/src/srun/libsrun/launch.c
@@ -225,6 +225,7 @@ static job_step_create_request_msg_t *_create_job_step_create_request(
if (!srun_opt->exact)
verbose("Implicitly setting --exact, because -c/--cpus-per-task given.");
srun_opt->exact = true;
+ step_req->flags &= ~SSF_WHOLE;
} else if (opt_local->gpus_per_task && opt_local->cpus_per_gpu) {
char *save_ptr = NULL, *tmp_str, *tok, *sep;
int gpus_per_task = 0;
Fixed ahead of 21.08.5.
6e13352fc2 (HEAD -> slurm-21.08, origin/slurm-21.08, bug12909) Fix srun -c and --threads-per-core imply --exact
I also opened bug 13041 to track adding regression tests for --exact, and that --threads-per-core and --cpus-per-task imply --exact.
Closing
* --cpus-per-task is supposed to imply --exact, but I just tested this and it is broken. Example: $ salloc -n8 salloc: Granted job allocation 279 salloc: Waiting for resource configuration salloc: Nodes n1-1 are ready for job $ srun -c1 -n1 whereami 0000 n1-1 - Cpus_allowed: 00000f0f Cpus_allowed_list: 0-3,8-11 $ srun --exact -c1 -n1 whereami 0000 n1-1 - Cpus_allowed: 00000101 Cpus_allowed_list: 0,8 It was broken during the refactor in commit 5154ed21e2c. That commit makes everything set in step_req, but did not make the change for srun -c. This fixes it, but duplicates setting the flags in step_req. We could move blocks of code instead: * Set the flags *after* looking at overcommit and cpus_per_task. * Look at the overcommit and cpus_per_task options before setting the flags. $ git diff diff --git a/src/srun/libsrun/launch.c b/src/srun/libsrun/launch.c index c4051a669e..66ea4fca1e 100644 --- a/src/srun/libsrun/launch.c +++ b/src/srun/libsrun/launch.c @@ -225,6 +225,7 @@ static job_step_create_request_msg_t *_create_job_step_create_request( if (!srun_opt->exact) verbose("Implicitly setting --exact, because -c/--cpus-per-task given."); srun_opt->exact = true; + step_req->flags &= ~SSF_WHOLE; } else if (opt_local->gpus_per_task && opt_local->cpus_per_gpu) { char *save_ptr = NULL, *tmp_str, *tok, *sep; int gpus_per_task = 0;