diff --git a/01-MSA-hello-world/Makefile b/01-MSA-hello-world/Makefile index bd8251c599d6258dba550eb68d1b84987d4a7f5a..9921395f86a0367d329449a03837d7ca78fd6866 100644 --- a/01-MSA-hello-world/Makefile +++ b/01-MSA-hello-world/Makefile @@ -1,10 +1,14 @@ -EXECS=mpi_hello_world.out +SYS:=none +_SYS=$(addprefix .,$(SYS)) MPICC=mpicc +EXECS=mpi_hello_world$(_SYS).out + +.PHONY: all clean all: ${EXECS} -mpi_hello_world.out: mpi_hello_world.c - ${MPICC} -o mpi_hello_world.out mpi_hello_world.c +mpi_hello_world$(_SYS).out: mpi_hello_world.c + ${MPICC} -o $@ $< clean: rm ${EXECS} *.out || true diff --git a/01-MSA-hello-world/README.md b/01-MSA-hello-world/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5c92a0bef97de8d6e00f227e73fe134960438874 --- /dev/null +++ b/01-MSA-hello-world/README.md @@ -0,0 +1,18 @@ +# MSA Hello World + +In this simple example, the Slurm heterogeneous job functionality is used to launch a job between JUWELS Cluster and Booster. + +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/01-MSA-hello-world/compile.sh b/01-MSA-hello-world/compile.sh new file mode 100755 index 0000000000000000000000000000000000000000..78e3228a4e51dc29b7ff9c24c4d1a7f2247e4f97 --- /dev/null +++ b/01-MSA-hello-world/compile.sh @@ -0,0 +1,13 @@ +if [[ "$SYSTEMNAME" == "juwelsbooster" ]]; then + echo "Building for $SYSTEMNAME" + ml GCC ParaStationMPI + make SYS=$SYSTEMNAME +elif [[ "$SYSTEMNAME" == "juwels" ]]; then + echo "Building for $SYSTEMNAME" + ml GCC ParaStationMPI + make SYS=$SYSTEMNAME +else + echo "The system $SYSTEMNAME is not supported!" + echo "Please load a capable MPI and compile the executables on each system with" + echo "make SYS=PARTIONNAME" +fi \ No newline at end of file diff --git a/01-MSA-hello-world/compile_all.sh b/01-MSA-hello-world/compile_all.sh deleted file mode 100755 index 5fb05fb35ade1afe317797234426a4e226c20714..0000000000000000000000000000000000000000 --- a/01-MSA-hello-world/compile_all.sh +++ /dev/null @@ -1,7 +0,0 @@ -ml GCC ParaStationMPI -make -mv mpi_hello_world.out mpi_hello_world_cluster.out - -ml GCC ParaStationMPI -make -mv mpi_hello_world.out mpi_hello_world_booster.out diff --git a/01-MSA-hello-world/job_msa_jureca.sh b/01-MSA-hello-world/job_msa_jureca.sh index 641e74b4ffc308bd040d6463e1e328c6add78134..7e1323e2851b5ada58c0dc974129a59afd64051a 100644 --- a/01-MSA-hello-world/job_msa_jureca.sh +++ b/01-MSA-hello-world/job_msa_jureca.sh @@ -11,4 +11,4 @@ #SBATCH --ntasks-per-node=1 #SBATCH --partition=dc-gpu-devel -srun xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world_cluster.out : xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world_booster.out +srun xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world.jureca.out : xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world.jureca.out diff --git a/01-MSA-hello-world/job_msa_juwels.sh b/01-MSA-hello-world/job_msa_juwels.sh index d362ad173e8209fd91c09dcdaad823582f41f080..5840bd719f8f45d43befbeeae5b6b2925e4e30a6 100644 --- a/01-MSA-hello-world/job_msa_juwels.sh +++ b/01-MSA-hello-world/job_msa_juwels.sh @@ -11,4 +11,4 @@ #SBATCH --ntasks-per-node=1 #SBATCH --partition=develbooster -srun xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world_cluster.out : xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world_booster.out +srun xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world.juwels.out : xenv -P -L GCC -L ParaStationMPI ./mpi_hello_world.juwelsbooster.out diff --git a/01-MSA-hello-world/mpi_hello_world.c b/01-MSA-hello-world/mpi_hello_world.c index 35db8ad1d99a3b5ddfbcfa08bd7e3b5f9c83529d..2c2a1bdc59fc6287d7b6baee125553ec977b4be7 100644 --- a/01-MSA-hello-world/mpi_hello_world.c +++ b/01-MSA-hello-world/mpi_hello_world.c @@ -13,7 +13,7 @@ int main(int argc, char** argv) { int world_rank; MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - // Get the name of the processor + // Get the name of the processor, which is the hostname char processor_name[MPI_MAX_PROCESSOR_NAME]; int name_len; MPI_Get_processor_name(processor_name, &name_len);