zoomy_jax.gpurank#
One GPU per MPI rank, bound before anything loads CUDA.
mpiexec -n 4 python -m zoomy_jax.gpurank run.py [args ...]
Sets CUDA_VISIBLE_DEVICES from the node-local rank (round robin over the
node’s GPUs, or over the devices an existing CUDA_VISIBLE_DEVICES lists),
then runs the script. Every CUDA user in the process – JAX, AmgX, mpi4jax’s
copies – sees only that GPU. A launcher that binds one GPU per rank itself
(srun --gpus-per-task=1: one device listed) is left alone. Binding later,
inside the run, is too late for libraries that use the CUDA runtime directly:
import jax already loads CUDA.
Module Contents#
Functions#
API#
- zoomy_jax.gpurank.bind()#
Set
CUDA_VISIBLE_DEVICESfor this rank; True if it did.
- zoomy_jax.gpurank.main()#