diff --git a/NEWS b/NEWS index 54aa88fd4a5cf84a550db43c2b64492b890f0c3c..40c238ada4e0e14c5532bc92da6a475e0d10690f 100644 --- a/NEWS +++ b/NEWS @@ -79,6 +79,7 @@ documents those changes that are of interest to users and administrators. -- jobcomp/elasticsearch - fix printf format for a value on 32-bit builds. -- task/cgroup - Change error message if CPU binding can not take place to better identify the root cause of the problem. + -- Fix issue where task/cgroup would not always hone --cpu_bind=threads. * Changes in Slurm 16.05.6 ========================== diff --git a/src/plugins/task/cgroup/task_cgroup_cpuset.c b/src/plugins/task/cgroup/task_cgroup_cpuset.c index 96b98694b478783a7136f4ae2d731fee31e6d484..b363d1a6e100aae126a0aae1fa1350038e2a0f4e 100644 --- a/src/plugins/task/cgroup/task_cgroup_cpuset.c +++ b/src/plugins/task/cgroup/task_cgroup_cpuset.c @@ -1531,14 +1531,24 @@ extern int task_cgroup_cpuset_set_task_affinity(stepd_step_rec_t *job) (job->job_core_spec != CORE_SPEC_THREAD)) { spec_threads = job->job_core_spec & (~CORE_SPEC_THREAD); } - if (npus >= (jnpus + spec_threads) || bind_type & CPU_BIND_TO_THREADS) { + + /* Set this to PU but realise it could be overridden later if we can + * fill up a core. + */ + if (npus >= (jnpus + spec_threads)) { hwtype = HWLOC_OBJ_PU; nobj = npus; } - if (ncores >= jnpus || bind_type & CPU_BIND_TO_CORES) { + + /* Force to bind to Threads */ + if (bind_type & CPU_BIND_TO_THREADS) { + hwtype = HWLOC_OBJ_PU; + nobj = npus; + } else if (ncores >= jnpus || bind_type & CPU_BIND_TO_CORES) { hwtype = HWLOC_OBJ_CORE; nobj = ncores; } + if (nsockets >= jntasks && bind_type & CPU_BIND_TO_SOCKETS) { hwtype = socket_or_node;