MVAPICH2
After saving the example program, load the mvapich2
module and compile the program with the mpicc
compiler wrapper:
module load mvapich2
mpicc mpi_hello_world.c -o mpi_hello_world
Create a Slurm script mpi_hello_world.sbatch
requesting multiple tasks (cores) across multiple nodes:
#!/bin/bash
#SBATCH --job-name=mpi-hello-world
#SBATCH --output=mpi-hello-world.out
#SBATCH --time=00:30:00
#SBATCH --partition=cpu
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=10
#SBATCH --mem-per-cpu=4G
#SBATCH --mail-user username@gvsu.edu
#SBATCH --mail-type BEGIN
#SBATCH --mail-type END
#SBATCH --mail-type FAIL
module purge
module load mvapich
export MV2_USE_CUDA=0
export MV2_SUPPRESS_CUDA_USAGE_WARNING=1
srun ~/mpi-hello-world-mvapich2/mpi_hello_world
Submit the job to the cluster:
sbatch mpi_hello_world.sbatch
The output shows multiple processes running across multiple cores and systems. For MVAPICH2, it is also normal to receive some informational message that can be ignored.
CUDA: Failed to get number of devices with cudaGetDeviceCount(): no CUDA-capable device is detected
CUDA: Failed to get number of devices with cudaGetDeviceCount(): no CUDA-capable device is detected
CUDA: Failed to get number of devices with cudaGetDeviceCount(): no CUDA-capable device is detected
CUDA: Failed to get number of devices with cudaGetDeviceCount(): no CUDA-capable device is detected
[c001.clipper.gvsu.edu:mpi_rank_0][rdma_param_handle_heterogeneity] All nodes involved in the job were detected to be homogeneous in terms of processors and interconnects. Setting MV2_HOMOGENEOUS_CLUSTER=1 can improve job startup performance on such systems. The following link has more details on enhancing job startup performance. http://mvapich.cse.ohio-state.edu/performance/job-startup/.
[c001.clipper.gvsu.edu:mpi_rank_0][rdma_param_handle_heterogeneity] To suppress this warning, please set MV2_SUPPRESS_JOB_STARTUP_PERFORMANCE_WARNING to 1
Hello world from processor c001.clipper.gvsu.edu, rank 0 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 10 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 11 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 4 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 12 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 6 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 13 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 1 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 14 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 3 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 15 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 5 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 16 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 7 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 17 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 8 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 18 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 9 out of 20 processors
Hello world from processor c002.clipper.gvsu.edu, rank 19 out of 20 processors
Hello world from processor c001.clipper.gvsu.edu, rank 2 out of 20 processors