Skip to content

Commit

Permalink
refactor: bash scripts for Levante use openmpi compiler wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Nov 17, 2024
1 parent d79ef38 commit c28f743
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
10 changes: 6 additions & 4 deletions roughpaper/scratch/build_compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
### ---------------------------------------------------- ###
dobuild=$1 # == "build" or otherwise

module load gcc/11.2.0-gcc-11.2.0
module load nvhpc/23.9-gcc-11.2.0
module load gcc/11.2.0-gcc-11.2.0 openmpi/4.1.2-gcc-11.2.0
# module load gcc/11.2.0-gcc-11.2.0 nvhpc/23.9-gcc-11.2.0 openmpi/4.1.6-nvhpc-23.9 # (CUDA)
spack load [email protected]%gcc
source activate /work/bm1183/m300950/mambaenvs/cleoenv
path2CLEO=${HOME}/CLEO/
path2build=${HOME}/CLEO/roughpaper/scratch/build/
gxx="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/g++"
gcc="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/gcc"
gxx="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpic++"
gcc="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpicc"
# gxx="/sw/spack-levante/openmpi-4.1.6-mjsagq/bin/mpic++" # (CUDA)
# gcc="/sw/spack-levante/openmpi-4.1.6-mjsagq/bin/mpicc" # (CUDA)
### ---------------------------------------------------- ###

### ---------------------------------------------------- ###
Expand Down
12 changes: 5 additions & 7 deletions scripts/bash/build_cleo_cuda_openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@
### --------- and optionally your environment, path to CLEO and the -------- ###
### ----------------------- desired build directory ----------------------- ###
### ------------------------------------------------------------------------ ###
module load gcc/11.2.0-gcc-11.2.0
module load nvhpc/23.9-gcc-11.2.0
module load gcc/11.2.0-gcc-11.2.0 nvhpc/23.9-gcc-11.2.0 openmpi/4.1.6-nvhpc-23.9
spack load [email protected]%gcc
gxx="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/g++"
gcc="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/gcc"
gxx="/sw/spack-levante/openmpi-4.1.6-mjsagq/bin/mpic++"
gcc="/sw/spack-levante/openmpi-4.1.6-mjsagq/bin/mpicc"

path2CLEO=$1 # required
path2build=$2 # required
enableyac=$3 # required
yacyaxtroot=$4 # required if enableyac=true

yac_openmpi=openmpi/4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmp)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmpi)
[email protected]%gcc@=11.2.0 # required if enableyac=true (must match gcc)
### ------------------------------------------------------------------------ ###

Expand Down Expand Up @@ -80,7 +78,7 @@ then
yacflags="-DENABLE_YAC_COUPLING=OFF"

else
module load ${yac_openmpi} ${yac_netcdf}
module load ${yac_netcdf}
spack load ${yac_openblas}
yacflags="-DENABLE_YAC_COUPLING=ON -DYAXT_ROOT=${yacyaxtroot}/yaxt -DYAC_ROOT=${yacyaxtroot}/yac"
yacmodule="${path2CLEO}/libs/coupldyn_yac/cmake"
Expand Down
11 changes: 5 additions & 6 deletions scripts/bash/build_cleo_openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
### --------- and optionally your environment, path to CLEO and the -------- ###
### ----------------------- desired build directory ----------------------- ###
### ------------------------------------------------------------------------ ###
module load gcc/11.2.0-gcc-11.2.0
module load gcc/11.2.0-gcc-11.2.0 openmpi/4.1.2-gcc-11.2.0
spack load [email protected]%gcc
gxx="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/g++"
gcc="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/gcc"
gxx="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpic++"
gcc="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpicc"

path2CLEO=$1 # required
path2build=$2 # required
enableyac=$3 # required
yacyaxtroot=$4 # required if enableyac=true

yac_openmpi=openmpi/4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmp)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmpi)
[email protected]%gcc@=11.2.0 # required if enableyac=true (must match gcc)
### ------------------------------------------------------------------------ ###

Expand Down Expand Up @@ -63,7 +62,7 @@ if ! [ "${enableyac}" == "true" ]
then
yacflags="-DENABLE_YAC_COUPLING=OFF"
else
module load ${yac_openmpi} ${yac_netcdf}
module load ${yac_netcdf}
spack load ${yac_openblas}
yacflags="-DENABLE_YAC_COUPLING=ON -DYAXT_ROOT=${yacyaxtroot}/yaxt -DYAC_ROOT=${yacyaxtroot}/yac"
yacmodule="${path2CLEO}/libs/coupldyn_yac/cmake"
Expand Down
11 changes: 5 additions & 6 deletions scripts/bash/build_cleo_serial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
### --------- and optionally your environment, path to CLEO and the -------- ###
### ----------------------- desired build directory ----------------------- ###
### ------------------------------------------------------------------------ ###
module load gcc/11.2.0-gcc-11.2.0
module load gcc/11.2.0-gcc-11.2.0 openmpi/4.1.2-gcc-11.2.0
spack load [email protected]%gcc
gxx="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/g++"
gcc="/sw/spack-levante/gcc-11.2.0-bcn7mb/bin/gcc"
gxx="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpic++"
gcc="/sw/spack-levante/openmpi-4.1.2-mnmady/bin/mpicc"

path2CLEO=$1 # required
path2build=$2 # required
enableyac=$3 # required
yacyaxtroot=$4 # required if enableyac=true

yac_openmpi=openmpi/4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmp)
yac_netcdf=netcdf-c/4.8.1-openmpi-4.1.2-gcc-11.2.0 # required if enableyac=true (must match gcc & openmpi)
[email protected]%gcc@=11.2.0 # required if enableyac=true (must match gcc)
### ------------------------------------------------------------------------ ###

Expand Down Expand Up @@ -64,7 +63,7 @@ then
yacflags="-DENABLE_YAC_COUPLING=OFF"

else
module load ${yac_openmpi} ${yac_netcdf}
module load ${yac_netcdf}
spack load ${yac_openblas}
yacflags="-DENABLE_YAC_COUPLING=ON -DYAXT_ROOT=${yacyaxtroot}/yaxt -DYAC_ROOT=${yacyaxtroot}/yac"
yacmodule="${path2CLEO}/libs/coupldyn_yac/cmake"
Expand Down
13 changes: 8 additions & 5 deletions scripts/bash/compile_cleo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ cleoenv=$1 # get from command line argument
buildtype=$2 # get from command line argument
path2build=$3 # get from command line argument
executables="$4" # get from command line argument

spack load [email protected]%gcc
module load gcc/11.2.0-gcc-11.2.0
# source activate ${cleoenv} # TODO(CB): fix best practise

if [ "${buildtype}" != "serial" ] && [ "${buildtype}" != "openmp" ] && [ "${buildtype}" != "cuda" ];
then
echo "please specify the build type as 'serial', 'openmp' or 'cuda'"
else
# load nvhpc compilers if compiling cuda build
spack load [email protected]%gcc
module load gcc/11.2.0-gcc-11.2.0

# load nvhpc compilers and mpi wrappers if compiling cuda build
if [[ "${buildtype}" == "cuda" ]]
then
module load nvhpc/23.9-gcc-11.2.0
module load nvhpc/23.9-gcc-11.2.0 openmpi/4.1.6-nvhpc-23.9
# otherwise use gcc mpi wrappers
else
module load openmpi/4.1.2-gcc-11.2.0
fi
### ---------------------------------------------------- ###

Expand Down

0 comments on commit c28f743

Please sign in to comment.