I have an 8-GPU machine and I usually run 8 independent training jobs, one per GPU.
For GPUs this is easy:
CUDA_VISIBLE_DEVICES=0 python train.py
CUDA_VISIBLE_DEVICES=1 python train.py
...
Each job only sees one GPU.
The problem is CPU usage. Since I do not isolate CPU resources, every job can see all CPU cores. Then dataloaders / PyTorch workers may spawn lots of threads, and the 8 jobs start fighting for CPU.
I know I can manually tune things in code, e.g. num_workers, OMP_NUM_THREADS, MKL_NUM_THREADS, etc. But I am looking for something more like CUDA_VISIBLE_DEVICES for CPUs: a simple and clean way to assign each job a fixed subset of CPU cores.
What is the