pecos / tps

Torch Plasma Simulator
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Assign GPU to MPI rank #261

Open uvilla opened 6 months ago

uvilla commented 6 months ago

The current way that in TPS we assign a GPU to each MPI rank is (see here ):

device_id = mpi_rank % numGpusPerRank

where numGpusPerRank is set from the .ini file. The default value of this variable is 1; see here. None of the *.ini input files in our testsuite changes the default value, so I am assuming all local jobs are running on a single GPU.

This makes TPS hard to port across different clusters and local machines. Some schedulers (e.g. those on TACC) make all GPUs on a node available to all tasks on that node, while other schedulers (e.g. flux) restrict which GPUs are visible to each task (e.g. through the variable ROCR_VISIBLE_DEVICES, HIP_VISIBLE_DEVICES, NVIDIA_VISIBLE_DEVICES, or `CUDA_VISIBLE_DEVICES).

I propose a more flexible way to handle this by introducing the command line argument --gpu-affinity (short-hand -ga).

Three affinity policies will be available: