From 314655fa65f5d82c2c80dc91b2f92d9966d697bf Mon Sep 17 00:00:00 2001 From: David Minton Date: Thu, 15 Feb 2024 10:54:57 -0500 Subject: [PATCH] Updated build scripts with the new environment module --- buildscripts/build_rcac_gnu.sh | 26 +++++++++++++++++++++----- buildscripts/build_rcac_intel.sh | 23 ++++++++++++++++++----- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/buildscripts/build_rcac_gnu.sh b/buildscripts/build_rcac_gnu.sh index f0722967a..28855e7fe 100755 --- a/buildscripts/build_rcac_gnu.sh +++ b/buildscripts/build_rcac_gnu.sh @@ -1,8 +1,8 @@ #!/bin/zsh -l -# installs an editable (local) package in release mode on Negishi +# Builds Swiftest on the Purdue RCAC cluster system using the GNU compiler # This is a convenience script for Kaustub - - +# The default build type is Release, in which case the Python package is installed in editable mode. Otherwise, only the Fortran +# library and executables are built, but not installed, so that the user can run them from the build directory. set -a SCRIPT_DIR=$(realpath $(dirname $0)) @@ -10,6 +10,13 @@ ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) cd ${ROOT_DIR} BUILD_TYPE=${1:-"Release"} +# Set the OMP_NUM_THREADS variable to be the number of CPUS if this is a compute node, or 1 if this is a frontend or login node +if { hostname | grep -E 'fe|login'; } >/dev/null 2>&1; then + OMP_NUM_THREADS=1 +else + OMP_NUM_THREADS=$(squeue -u $(whoami) | grep $SLURM_JOB_ID | awk -F' ' '{print $6}') +fi + MACHINE_NAME=$(uname -n | awk -F. '{ if ($2 == "negishi" || $2 == "bell") print $2; @@ -22,6 +29,15 @@ MACHINE_NAME=$(uname -n | awk -F. '{ } }') +if { conda env list | grep 'mintongroup'; } >/dev/null 2>&1; then + print -n "The mintongroup conda environment was detected" +else + print -n "The mintongroup conda environment was not detected. Creating it now..." + /depot/daminton/apps/build_mintongroup_conda.sh +fi + + + if [[ $MACHINE_NAME == "bell" ]]; then module purge module use /depot/daminton/etc/modules/bell @@ -34,7 +50,7 @@ if [[ $MACHINE_NAME == "bell" ]]; then module load ninja/1.11.1 if [[ $BUILD_TYPE == "Release" ]]; then module load use.own - module load conda-env/swiftest-env-py3.8.5 + module load conda-env/mintongroup-py3.8.5 fi elif [[ $MACHINE_NAME == "negishi" ]]; then module purge @@ -48,7 +64,7 @@ elif [[ $MACHINE_NAME == "negishi" ]]; then module load ninja/1.11.1 if [[ $BUILD_TYPE == "Release" ]]; then module load use.own - module load conda-env/swiftest-env-py3.9.13 + module load conda-env/mintongroup-py3.9.13 fi fi diff --git a/buildscripts/build_rcac_intel.sh b/buildscripts/build_rcac_intel.sh index b12631fce..58919182f 100755 --- a/buildscripts/build_rcac_intel.sh +++ b/buildscripts/build_rcac_intel.sh @@ -1,10 +1,9 @@ #!/bin/zsh -l # installs an editable (local) package on Bell # This is a convenience script for Kaustub -# To use in Release mode, be sure to create the swiftest-env module first. Using the RCAC tools it's the following commands: +# To use in Release mode, be sure to create the mintongroup module first. Using the RCAC tools it's the following commands: # $ conda env create -f environment.yml -# $ conda-env-mod module -n swiftest-env --jupyter - +# $ conda-env-mod module -n mintongroup --jupyter set -a SCRIPT_DIR=$(realpath $(dirname $0)) @@ -12,6 +11,13 @@ ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) cd ${ROOT_DIR} BUILD_TYPE=${1:-"Release"} +# Set the OMP_NUM_THREADS variable to be the number of CPUS if this is a compute node, or 1 if this is a frontend or login node +if { hostname | grep -E 'fe|login'; } >/dev/null 2>&1; then + OMP_NUM_THREADS=1 +else + OMP_NUM_THREADS=$(squeue -u $(whoami) | grep $SLURM_JOB_ID | awk -F' ' '{print $6}') +fi + MACHINE_NAME=$(uname -n | awk -F. '{ if ($2 == "negishi" || $2 == "bell") print $2; @@ -24,6 +30,13 @@ MACHINE_NAME=$(uname -n | awk -F. '{ } }') +if { conda env list | grep 'mintongroup'; } >/dev/null 2>&1; then + print -n "The mintongroup conda environment was detected" +else + print -n "The mintongroup conda environment was not detected. Creating it now..." + /depot/daminton/apps/build_mintongroup_conda.sh +fi + if [[ $MACHINE_NAME == "bell" ]]; then module purge @@ -38,7 +51,7 @@ if [[ $MACHINE_NAME == "bell" ]]; then module load netcdf/4.7.4 module load netcdf-fortran/4.5.3 module load use.own - module load conda-env/swiftest-env-py3.8.5 + module load conda-env/mintongroup-py3.8.5 MACHINE_CODE_VALUE="Host" elif [[ $MACHINE_NAME == "negishi" ]]; then module purge @@ -53,7 +66,7 @@ elif [[ $MACHINE_NAME == "negishi" ]]; then module load netcdf-c/4.9.0 module load netcdf-fortran/4.6.0 module load use.own - module load conda-env/swiftest-env-py3.9.13 + module load conda-env/mintongroup-py3.9.13 MACHINE_CODE_VALUE="SSE2" fi