dara.hardware module#
Runtime CPU-core detection, used to size worker/thread counts portably.
- detect_cpu_count()[source]#
Detect the number of CPU cores usable by this process.
- Checked in priority order:
SLURM_CPUS_PER_TASK, then SLURM_CPUS_ON_NODE (SLURM-managed jobs).
os.sched_getaffinity(0)(Linux only; reflects taskset/affinity restrictions thatos.cpu_count()ignores).os.cpu_count().
- Return type:
int- Returns:
A positive integer. Falls back to 1 if nothing above yields a usable count.