diff --git a/02-MSA-ping-pong/Makefile b/02-MSA-ping-pong/Makefile index 0fbc367d43e0f3a8eb498470531c26d76d00d4ae..f7233d293b3d3bca9d4bced8af5ada4752477b75 100644 --- a/02-MSA-ping-pong/Makefile +++ b/02-MSA-ping-pong/Makefile @@ -1,22 +1,29 @@ CUCOMP = nvcc CUFLAGS = -arch=sm_80 -INCLUDES = -I$(EBROOTOPENMPI)/include -LIBRARIES = -L$(EBROOTOPENMPI)/lib -lmpi +ifdef EBROOTOPENMPI +MPI_HOME+=$(EBROOTOPENMPI) +endif +ifdef EBROOTPSMPI +MPI_HOME+=$(EBROOTPSMPI) +endif -all: pp_cpu.out pp_cuda_aware.out +INCLUDES = -I$(MPI_HOME)/include +LIBRARIES = -L$(MPI_HOME)/lib -lmpi -pp_cpu.out: ping-pong.c - mpicc ping-pong.c -o pp_cpu.out +all: ping-pong.cpu.out ping-pong.gpu.out -pp_cuda_aware.out: ping-pong.o - $(CUCOMP) $(CUFLAGS) $(LIBRARIES) ping-pong.o -o pp_cuda_aware.out +ping-pong.cpu.out: ping-pong.c + mpicc $< -o $@ -ping-pong.o: ping-pong.cu - $(CUCOMP) $(CUFLAGS) $(INCLUDES) -c ping-pong.cu +ping-pong.gpu.out: ping-pong.gpu.o + $(CUCOMP) $(CUFLAGS) $(LIBRARIES) $< -o $@ + +ping-pong.gpu.o: ping-pong.cu + $(CUCOMP) $(CUFLAGS) $(INCLUDES) -c $< -o $@ .PHONY: clean clean: - rm -f pp_cpu.out pp_cuda_aware.out *.o + rm -f ping-pong.cpu.out ping-pong.gpu.out *.o diff --git a/02-MSA-ping-pong/README.md b/02-MSA-ping-pong/README.md new file mode 100644 index 0000000000000000000000000000000000000000..25030276c593b54bcf6e3e0a978ea956ceb63f69 --- /dev/null +++ b/02-MSA-ping-pong/README.md @@ -0,0 +1,18 @@ +# MSA CPU-GPU Ping Pong + +We extend the simple previous example to now use a heterogeneous job on a CPU and GPU with dedicated partitions. The two job components of the heterogeneous job send _ping pong_ messages to each other of increasing size. + +Execute the following on JUWELS Booster + +```bash +bash compile.sh +``` + +Execute the following on JUWELS Cluster + +```bash +bash compile.sh +sbatch job_msa_juwels.sh +``` + +Monitor your job with `squeue --me`. When it ran through successfully, have a look at the output in `slurm-out.N`, with `N` being your job number. \ No newline at end of file diff --git a/02-MSA-ping-pong/compile.sh b/02-MSA-ping-pong/compile.sh new file mode 100755 index 0000000000000000000000000000000000000000..302fa09c0ea2489033882647ba3c7278dc198f96 --- /dev/null +++ b/02-MSA-ping-pong/compile.sh @@ -0,0 +1,11 @@ +if [[ "$SYSTEMNAME" == "juwelsbooster" ]]; then + echo "Building GPU-aware version for $SYSTEMNAME" + ml GCC ParaStationMPI MPI-settings/CUDA + make ping-pong.gpu.out +elif [[ "$SYSTEMNAME" == "juwels" ]]; then + echo "Building CPU version for $SYSTEMNAME" + ml GCC ParaStationMPI + make ping-pong.cpu.out +else + echo "The system $SYSTEMNAME is not supported!" +fi \ No newline at end of file diff --git a/02-MSA-ping-pong/compile_all.sh b/02-MSA-ping-pong/compile_all.sh deleted file mode 100755 index 1f677bb3c85c6eb6c6fdd1d617da4be8932e9a16..0000000000000000000000000000000000000000 --- a/02-MSA-ping-pong/compile_all.sh +++ /dev/null @@ -1,2 +0,0 @@ -ml GCC OpenMPI MPI-settings/CUDA -make all diff --git a/02-MSA-ping-pong/job_msa_juwels.sh b/02-MSA-ping-pong/job_msa_juwels.sh index 5e6f8bb6f528b528eb43edd611e3b5871af0b7c1..e6f2ba4bdb4fd07222f526aecf43a57f0040a878 100644 --- a/02-MSA-ping-pong/job_msa_juwels.sh +++ b/02-MSA-ping-pong/job_msa_juwels.sh @@ -1,5 +1,5 @@ #!/bin/bash -x -#SBATCH --account=exalab +#SBATCH --account=training2317 #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 #SBATCH --output=slurm-out.%j @@ -11,4 +11,4 @@ #SBATCH --ntasks-per-node=1 #SBATCH --partition=develbooster -srun xenv -P -L GCC -L OpenMPI -L MPI-settings/CUDA ./pp_cpu.out : xenv -P -L GCC -L OpenMPI -L MPI-settings/CUDA ./pp_cuda_aware.out +srun xenv -P -L GCC -L ParaStationMPI ./ping-pong.cpu.out : xenv -P -L GCC -L ParaStationMPI -L MPI-settings/CUDA ./ping-pong.gpu.out