Skip to content

n_jobs=-1 in job_tools.py oversubscribes cores under CPU affinity restrictions #4723

Description

@lochhh

In job_tools.py, ensure_n_jobs / fix_job_kwargs resolve n_jobs=-1 using os.cpu_count().

On SLURM (and other schedulers/containers that restrict CPU affinity via cgroups or cpusets), os.cpu_count() reports the physical core count of the whole node, not the number of cores actually allocated to the job/task. When --cpus-per-task is smaller than the node's total core count, n_jobs=-1 spawns far more worker processes than are actually schedulable, causing heavy oversubscription. In our case this manifests as jobs intermittently hanging on the HPC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions