diff --git a/src/srun/libsrun/srun_job.c b/src/srun/libsrun/srun_job.c index ca33725d6b409e452410aef18650bfe6362b70a1..5ef5ad8330f3174b98253659d12fc72c1627199e 100644 --- a/src/srun/libsrun/srun_job.c +++ b/src/srun/libsrun/srun_job.c @@ -578,13 +578,20 @@ extern void create_srun_job(srun_job_t **p_job, bool *got_alloc, } job = job_create_allocation(resp); - opt.exclusive = false; /* not applicable for this step */ opt.time_limit = NO_VAL;/* not applicable for step, only job */ xfree(opt.constraints); /* not applicable for this step */ if (!opt.job_name_set_cmd && opt.job_name_set_env) { /* use SLURM_JOB_NAME env var */ opt.job_name_set_cmd = true; } + if ((opt.core_spec_set || opt.exclusive) && opt.cpus_set) { + /* Step gets specified CPU count, which may only part + * of the job allocation. */ + opt.exclusive = true; + } else { + /* Step gets all CPUs in the job allocation. */ + opt.exclusive = false; + } /* * Become --uid user