From 03712a37f96ff3372bfb37f7d1d614595ed5e6bd Mon Sep 17 00:00:00 2001 From: Andreas Herten <a.herten@fz-juelich.de> Date: Sat, 17 Jun 2023 14:39:59 +0200 Subject: [PATCH] Move files to master, add new standard files (README, compile, copy) --- 02-MSA-hello-world-gpu/{ => .master}/Makefile | 0 02-MSA-hello-world-gpu/.master/README.md | 23 +++++++++++++ 02-MSA-hello-world-gpu/.master/compile.sh | 12 +++++++ 02-MSA-hello-world-gpu/.master/copy.mk | 34 +++++++++++++++++++ .../{ => .master}/hello-world.c | 0 .../{ => .master}/hello-world.cu | 0 .../{ => .master}/job_msa_juwels.sh | 0 7 files changed, 69 insertions(+) rename 02-MSA-hello-world-gpu/{ => .master}/Makefile (100%) create mode 100644 02-MSA-hello-world-gpu/.master/README.md create mode 100755 02-MSA-hello-world-gpu/.master/compile.sh create mode 100755 02-MSA-hello-world-gpu/.master/copy.mk rename 02-MSA-hello-world-gpu/{ => .master}/hello-world.c (100%) rename 02-MSA-hello-world-gpu/{ => .master}/hello-world.cu (100%) rename 02-MSA-hello-world-gpu/{ => .master}/job_msa_juwels.sh (100%) diff --git a/02-MSA-hello-world-gpu/Makefile b/02-MSA-hello-world-gpu/.master/Makefile similarity index 100% rename from 02-MSA-hello-world-gpu/Makefile rename to 02-MSA-hello-world-gpu/.master/Makefile diff --git a/02-MSA-hello-world-gpu/.master/README.md b/02-MSA-hello-world-gpu/.master/README.md new file mode 100644 index 0000000..dd4ba44 --- /dev/null +++ b/02-MSA-hello-world-gpu/.master/README.md @@ -0,0 +1,23 @@ +# MSA GPU Hello World + +Building up on the previous exercise, in this exercise the GPU-side `printf()` function is used to print from a kernel a "hello world!", where the second word is received directly from the CPU process. + +TODOs are included in `hello-world.c` and `hello-world.cu`, indicating how to implement the `MPI_Send()` / `MPI_Recv()` structure. + +Once the function calls are implemented,e xecute the following on JUWELS Booster + +```bash +bash compile.sh +``` +(Which is equivalent to calling the `make` for the GPU part of the application, including the right modules.) + +Also, execute the following on JUWELS Cluster + +```bash +bash compile.sh +sbatch job_msa_juwels.sh +``` + +(Which compiles the CPU part of the application and then submits a heterogeneous job to the batch queue.) + +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-hello-world-gpu/.master/compile.sh b/02-MSA-hello-world-gpu/.master/compile.sh new file mode 100755 index 0000000..4c9bb3e --- /dev/null +++ b/02-MSA-hello-world-gpu/.master/compile.sh @@ -0,0 +1,12 @@ +if [[ "$SYSTEMNAME" == "juwelsbooster" ]]; then + echo "Building for $SYSTEMNAME" + ml GCC CUDA ParaStationMPI + make hello.gpu.out +elif [[ "$SYSTEMNAME" == "juwels" ]]; then + echo "Building for $SYSTEMNAME" + ml GCC ParaStationMPI + make hello.cpu.out +else + echo "The system $SYSTEMNAME is not supported!" + echo "Please load manually load environment modules for compiler and MPI and compile with the Makefile" +fi \ No newline at end of file diff --git a/02-MSA-hello-world-gpu/.master/copy.mk b/02-MSA-hello-world-gpu/.master/copy.mk new file mode 100755 index 0000000..a90add5 --- /dev/null +++ b/02-MSA-hello-world-gpu/.master/copy.mk @@ -0,0 +1,34 @@ +#!/usr/bin/make -f +TASKDIR = ../tasks +SOLUTIONDIR = ../solutions + +PROCESSFILES = hello-world.c hello-world.cu +COPYFILES = Makefile README.md job_msa_juwels.sh compile.sh + + +TASKPROCCESFILES = $(addprefix $(TASKDIR)/,$(PROCESSFILES)) +TASKCOPYFILES = $(addprefix $(TASKDIR)/,$(COPYFILES)) +SOLUTIONPROCCESFILES = $(addprefix $(SOLUTIONDIR)/,$(PROCESSFILES)) +SOLUTIONCOPYFILES = $(addprefix $(SOLUTIONDIR)/,$(COPYFILES)) + +.PHONY: all task +all: task +task: ${TASKPROCCESFILES} ${TASKCOPYFILES} ${SOLUTIONPROCCESFILES} ${SOLUTIONCOPYFILES} + + +${TASKPROCCESFILES}: $(PROCESSFILES) + mkdir -p $(TASKDIR)/ + cppp -USOLUTION $(notdir $@) $@ + +${SOLUTIONPROCCESFILES}: $(PROCESSFILES) + mkdir -p $(SOLUTIONDIR)/ + cppp -DSOLUTION $(notdir $@) $@ + + +${TASKCOPYFILES}: $(COPYFILES) + mkdir -p $(TASKDIR)/ + cp $(notdir $@) $@ + +${SOLUTIONCOPYFILES}: $(COPYFILES) + mkdir -p $(SOLUTIONDIR)/ + cp $(notdir $@) $@ \ No newline at end of file diff --git a/02-MSA-hello-world-gpu/hello-world.c b/02-MSA-hello-world-gpu/.master/hello-world.c similarity index 100% rename from 02-MSA-hello-world-gpu/hello-world.c rename to 02-MSA-hello-world-gpu/.master/hello-world.c diff --git a/02-MSA-hello-world-gpu/hello-world.cu b/02-MSA-hello-world-gpu/.master/hello-world.cu similarity index 100% rename from 02-MSA-hello-world-gpu/hello-world.cu rename to 02-MSA-hello-world-gpu/.master/hello-world.cu diff --git a/02-MSA-hello-world-gpu/job_msa_juwels.sh b/02-MSA-hello-world-gpu/.master/job_msa_juwels.sh similarity index 100% rename from 02-MSA-hello-world-gpu/job_msa_juwels.sh rename to 02-MSA-hello-world-gpu/.master/job_msa_juwels.sh -- GitLab