Reply To: Problem with multi GPU
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Problem with multi GPU › Reply To: Problem with multi GPU
June 13, 2024 at 3:41 pm
#8810
Adrian
Keymaster
The problem is that each process by default uses the first visible GPU. You can restrict this to assign each process their own GPU via:
mpirun -np 2 bash -c 'export CUDA_VISIBLE_DEVICES=${OMPI_COMM_WORLD_LOCAL_RANK}; ./cylinder3d'
This is also documented in the config/gpu_openmpi.mk
: (excerpt)
# - Start the simulation using <code>mpirun -np 2 ./cavity3d</code> (All processes share default GPU, not optimal)
#
# Usage on a multi GPU system: (recommended when using MPI, use non-MPI version on single GPU systems)
# - Run "mpirun -np 4 bash -c 'export CUDA_VISIBLE_DEVICES=${OMPI_COMM_WORLD_LOCAL_RANK}; ./cavity3d'"
# (for a 4 GPU system, further process mapping advisable, consult cluster documentation)