From 92437b6e68ca84cb18e2e7ccdc88ef03b146690a Mon Sep 17 00:00:00 2001 From: "ye.lu" Date: Tue, 25 Jun 2024 16:16:57 +0200 Subject: [PATCH] adding build scripts for cpu and gpu --- config/build_cpu.sh | 38 ++++++++++++++++++++++++++++++++++++++ config/build_gpu.sh | 33 +++++++++++++++++++++++++++++++++ config/prebuild_gpu.sh | 33 +++++++++++++++++++++++++++++++++ config/test_gpu.sh | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100755 config/build_cpu.sh create mode 100755 config/build_gpu.sh create mode 100755 config/prebuild_gpu.sh create mode 100755 config/test_gpu.sh diff --git a/config/build_cpu.sh b/config/build_cpu.sh new file mode 100755 index 000000000..63422f6c6 --- /dev/null +++ b/config/build_cpu.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +strFolderIn=$1 +str_in=`uname -a` +if_found=.false. +for i in $str_in ; do + if [[ $i == *"juwels"* ]] ; then + printf "we are on juwels\n" + printf "`uname -a`\n" + printf "PWD: `pwd`\n" + printf "Loading Modules\n" + module load Intel ParaStationMPI netCDF GSL + printf "Compiling MPTRAC using modules on JUWELS ... \n " + cd ./src + make STATIC=0 + make check + if_found=.true. + + elif [[ $i == *"jureca"* ]] ; then + printf "we are on jureca\n" + printf "`uname -a`\n" + printf "PWD: `pwd`\n" + printf "Loading Modules\n" + module load Intel ParaStationMPI netCDF GSL + printf "Compiling MPTRAC using modules on JURECA ... \n " + cd ./src + make STATIC=0 + make check + if_found=.true. + else + printf "None of the machine matches\n" + fi +done + +if [[ ! $if_found ]]; then + printf "None of the system matches the configuration \n" + printf "please check that if your machine is registered on the buildbot master\n" +fi diff --git a/config/build_gpu.sh b/config/build_gpu.sh new file mode 100755 index 000000000..b9c2afb67 --- /dev/null +++ b/config/build_gpu.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# ============================================================== +# Here is the exmample of a build script for WRF. +# It should be noted that the configuration files are tested +# which are based on the the WRF configuration executor. +# ============================================================== + +strHPC=`uname -a` +if_found=false +for strIn in $strHPC ; do + ## Check which machine + if [[ $strIn == *"juwels"* ]] ; then + # Compiling + echo "Working on compiling the MPTRAC with GPU" + export LD_LIBRARY_PATH=$PWD/libs/build/lib:$LD_LIBRARY_PATH + ml NVHPC ParaStationMPI netCDF + cd src + make clean + make COMPILER=nvc GPU=1 STATIC=0 INFO=1 ZSTD=1 ZFP=1 DEFINES="-DNP=20000" || exit + echo "Done compiling the MPTRAC with GPU" + if_found=true + elif [[ $strIn == *"jureca"* ]] ; then + printf "JURECA is not supported.\n" + printf "Currently supporting JUWELS-BOOST only\n" + if_found=true + fi +done + +if [[ ! $if_found ]]; then + printf "None of the system matches the configuration \n" + printf "please check that if your machine is registered on the buildbot master\n" +fi diff --git a/config/prebuild_gpu.sh b/config/prebuild_gpu.sh new file mode 100755 index 000000000..2dd7d8cbb --- /dev/null +++ b/config/prebuild_gpu.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# ============================================================== +# Here is the exmample of a build script for WRF. +# It should be noted that the configuration files are tested +# which are based on the the WRF configuration executor. +# ============================================================== + +strHPC=`uname -a` +if_found=false +for strIn in $strHPC ; do + ## Check which machine + if [[ $strIn == *"juwels"* ]] ; then + printf "We are on JUWELS ... \n" + printf "compiling something.. \n " + ### build script starts here .... + module load Intel ParaStationMPI netCDF GSL + cd ./libs + sh build.sh -ctsgf + make check + ### build script ends here .... + + if_found=.true. + + elif [[ $strIn == *"jureca"* ]] ; then + printf "JURECA is not supported.\n" + fi +done + +if [[ ! $if_found ]]; then + printf "None of the system matches the configuration \n" + printf "please check that if your machine is registered on the buildbot master\n" +fi diff --git a/config/test_gpu.sh b/config/test_gpu.sh new file mode 100755 index 000000000..10f938dd1 --- /dev/null +++ b/config/test_gpu.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# ============================================================== +# Here is the exmample of a build script for WRF. +# It should be noted that the configuration files are tested +# which are based on the the WRF configuration executor. +# ============================================================== + +strHPC=`uname -a` +if_found=false +for strIn in $strHPC ; do + ## Check which machine + if [[ $strIn == *"juwels"* ]] ; then + echo "Working on JUWELS-BOOSTER" + ml purge + ml NVHPC ParaStationMPI netCDF + export LD_LIBRARY_PATH=$PWD/../libs/build/lib:$LD_LIBRARY_PATH + # Testing + cd src + echo "#! /bin/bash" > check.sh + echo "make gpu_test" >> check.sh + sbatch --wait --deadline=now+1hour --nodes=1 --ntasks=1 --ntasks-per-node=1 --cpus-per-task=48 --time=00:05:00 --account=slmet --partition=booster --gres=gpu:4 ./check.sh + [ $? -ne 0 ] && result="FAILED" || result="OK" + cat slurm* + + # Another Inform + echo "job result: $result" + echo "job finished: $(date)" + if_found=true + elif [[ $strIn == *"jureca"* ]] ; then + printf "JURECA is not supported.\n" + fi +done + +if [[ ! $if_found ]]; then + printf "None of the system matches the configuration \n" + printf "please check that if your machine is registered on the buildbot master\n" +fi