From a8986684a815a9f2602a11e962f8443b78169012 Mon Sep 17 00:00:00 2001 From: "Henry R. Winterbottom" <49202169+HenryWinterbottom-NOAA@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:00:33 -0700 Subject: [PATCH] Updated detect_machine.sh to be consistent with UFSWM. (#691) Co-authored-by: henrywinterbottom-wxdev --- .../{gsi_discover => gsi_discover.intel} | 0 .../{gsi_gaea.lua => gsi_gaea.intel.lua} | 0 ...si_hercules.lua => gsi_hercules.intel.lua} | 0 .../{gsi_jet.lua => gsi_jet.intel.lua} | 0 .../{gsi_orion.lua => gsi_orion.intel.lua} | 0 modulefiles/{gsi_s4.lua => gsi_s4.intel.lua} | 0 .../{gsi_wcoss2.lua => gsi_wcoss2.intel.lua} | 0 ush/build.sh | 2 +- ush/detect_machine.sh | 76 +++++++++++++++---- ush/sub_discover | 2 +- ush/sub_gaea | 2 +- ush/sub_hercules | 2 +- ush/sub_jet | 2 +- ush/sub_orion | 2 +- ush/sub_wcoss2 | 2 +- 15 files changed, 67 insertions(+), 23 deletions(-) rename modulefiles/{gsi_discover => gsi_discover.intel} (100%) rename modulefiles/{gsi_gaea.lua => gsi_gaea.intel.lua} (100%) rename modulefiles/{gsi_hercules.lua => gsi_hercules.intel.lua} (100%) rename modulefiles/{gsi_jet.lua => gsi_jet.intel.lua} (100%) rename modulefiles/{gsi_orion.lua => gsi_orion.intel.lua} (100%) rename modulefiles/{gsi_s4.lua => gsi_s4.intel.lua} (100%) rename modulefiles/{gsi_wcoss2.lua => gsi_wcoss2.intel.lua} (100%) diff --git a/modulefiles/gsi_discover b/modulefiles/gsi_discover.intel similarity index 100% rename from modulefiles/gsi_discover rename to modulefiles/gsi_discover.intel diff --git a/modulefiles/gsi_gaea.lua b/modulefiles/gsi_gaea.intel.lua similarity index 100% rename from modulefiles/gsi_gaea.lua rename to modulefiles/gsi_gaea.intel.lua diff --git a/modulefiles/gsi_hercules.lua b/modulefiles/gsi_hercules.intel.lua similarity index 100% rename from modulefiles/gsi_hercules.lua rename to modulefiles/gsi_hercules.intel.lua diff --git a/modulefiles/gsi_jet.lua b/modulefiles/gsi_jet.intel.lua similarity index 100% rename from modulefiles/gsi_jet.lua rename to modulefiles/gsi_jet.intel.lua diff --git a/modulefiles/gsi_orion.lua b/modulefiles/gsi_orion.intel.lua similarity index 100% rename from modulefiles/gsi_orion.lua rename to modulefiles/gsi_orion.intel.lua diff --git a/modulefiles/gsi_s4.lua b/modulefiles/gsi_s4.intel.lua similarity index 100% rename from modulefiles/gsi_s4.lua rename to modulefiles/gsi_s4.intel.lua diff --git a/modulefiles/gsi_wcoss2.lua b/modulefiles/gsi_wcoss2.intel.lua similarity index 100% rename from modulefiles/gsi_wcoss2.lua rename to modulefiles/gsi_wcoss2.intel.lua diff --git a/ush/build.sh b/ush/build.sh index 9a280c4e55..a133889eac 100755 --- a/ush/build.sh +++ b/ush/build.sh @@ -24,7 +24,7 @@ source $DIR_ROOT/ush/detect_machine.sh set +x source $DIR_ROOT/ush/module-setup.sh module use $DIR_ROOT/modulefiles -module load gsi_$MACHINE_ID +module load "gsi_${MACHINE_ID}.${COMPILER}" module list set -x diff --git a/ush/detect_machine.sh b/ush/detect_machine.sh index ac6c7f58d1..683ee0db7f 100755 --- a/ush/detect_machine.sh +++ b/ush/detect_machine.sh @@ -1,20 +1,30 @@ #!/bin/bash +# The authoritative copy of this script lives in the ufs-weather-model at: +# https://github.com/ufs-community/ufs-weather-model/blob/develop/tests/detect_machine.sh +# If any local modifications are made or new platform support added, +# please consider opening an issue and a PR to the ufs-weather-model +# so that this copy remains in sync with its authoritative source +# +# Thank you for your contribution + +# If the MACHINE_ID variable is set, skip this script. +[[ -n ${MACHINE_ID:-} ]] && return + +# First detect w/ hostname case $(hostname -f) in - adecflow0[12].acorn.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### acorn - alogin0[1-3].acorn.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### acorn + adecflow0[12].acorn.wcoss2.ncep.noaa.gov) MACHINE_ID=acorn ;; ### acorn + alogin0[12].acorn.wcoss2.ncep.noaa.gov) MACHINE_ID=acorn ;; ### acorn clogin0[1-9].cactus.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### cactus01-9 clogin10.cactus.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### cactus10 dlogin0[1-9].dogwood.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### dogwood01-9 dlogin10.dogwood.wcoss2.ncep.noaa.gov) MACHINE_ID=wcoss2 ;; ### dogwood10 - gaea9) MACHINE_ID=gaea ;; ### gaea9 - gaea1[0-6]) MACHINE_ID=gaea ;; ### gaea10-16 - gaea9.ncrc.gov) MACHINE_ID=gaea ;; ### gaea9 - gaea1[0-6].ncrc.gov) MACHINE_ID=gaea ;; ### gaea10-16 + gaea5[1-8]) MACHINE_ID=gaea ;; ### gaea51-58 + gaea5[1-8].ncrc.gov) MACHINE_ID=gaea ;; ### gaea51-58 - hfe0[1-9]) MACHINE_ID=hera ;; ### hera01-9 + hfe0[1-9]) MACHINE_ID=hera ;; ### hera01-09 hfe1[0-2]) MACHINE_ID=hera ;; ### hera10-12 hecflow01) MACHINE_ID=hera ;; ### heraecflow01 @@ -25,24 +35,58 @@ case $(hostname -f) in Orion-login-[1-4].HPC.MsState.Edu) MACHINE_ID=orion ;; ### orion1-4 - Hercules-login-[1-4].HPC.MsState.Edu) MACHINE_ID=hercules ;; ### hercules1-4 - - cheyenne[1-6].cheyenne.ucar.edu) MACHINE_ID=cheyenne ;; ### cheyenne1-6 - cheyenne[1-6].ib0.cheyenne.ucar.edu) MACHINE_ID=cheyenne ;; ### cheyenne1-6 - chadmin[1-6].ib0.cheyenne.ucar.edu) MACHINE_ID=cheyenne ;; ### cheyenne1-6 - chadmin[1-6].ucar.edu) MACHINE_ID=cheyenne ;; ### cheyenne1-6 + [Hh]ercules-login-[1-4].[Hh][Pp][Cc].[Mm]s[Ss]tate.[Ee]du) MACHINE_ID=hercules ;; ### hercules1-4 login[1-4].stampede2.tacc.utexas.edu) MACHINE_ID=stampede ;; ### stampede1-4 login0[1-2].expanse.sdsc.edu) MACHINE_ID=expanse ;; ### expanse1-2 discover3[1-5].prv.cube) MACHINE_ID=discover ;; ### discover31-35 + *) MACHINE_ID=UNKNOWN ;; # Unknown platform esac +if [[ ${MACHINE_ID} == "UNKNOWN" ]]; then + case ${PW_CSP:-} in + "aws" | "google" | "azure") MACHINE_ID=noaacloud ;; + *) PW_CSP="UNKNOWN" + esac +fi + # Overwrite auto-detect with MACHINE if set MACHINE_ID=${MACHINE:-${MACHINE_ID}} -# Append compiler (only on machines that have multiple compilers) -if [ $MACHINE_ID = hera ] || [ $MACHINE_ID = cheyenne ]; then - MACHINE_ID=${MACHINE_ID}.${COMPILER} +# If MACHINE_ID is no longer UNKNNOWN, return it +if [[ "${MACHINE_ID}" != "UNKNOWN" ]]; then + return +fi + +# Try searching based on paths since hostname may not match on compute nodes +if [[ -d /lfs/h3 ]]; then + # We are on NOAA Cactus or Dogwood + MACHINE_ID=wcoss2 +elif [[ -d /lfs/h1 && ! -d /lfs/h3 ]]; then + # We are on NOAA TDS Acorn + MACHINE_ID=acorn +elif [[ -d /mnt/lfs1 ]]; then + # We are on NOAA Jet + MACHINE_ID=jet +elif [[ -d /scratch1 ]]; then + # We are on NOAA Hera + MACHINE_ID=hera +elif [[ -d /work ]]; then + # We are on MSU Orion or Hercules + if [[ -d /apps/other ]]; then + # We are on Hercules + MACHINE_ID=hercules + else + MACHINE_ID=orion + fi +elif [[ -d /gpfs && -d /ncrc ]]; then + # We are on GAEA. + MACHINE_ID=gaea +elif [[ -d /data/prod ]]; then + # We are on SSEC's S4 + MACHINE_ID=s4 +else + echo WARNING: UNKNOWN PLATFORM 1>&2 fi diff --git a/ush/sub_discover b/ush/sub_discover index 583ffbef86..5d6364be97 100755 --- a/ush/sub_discover +++ b/ush/sub_discover @@ -130,7 +130,7 @@ echo "" >>$cfile echo ". "$(awk '{ print $1, $2, $3, $4, $5, $6, $7, $8, $9 }' $regdir/regression_var.out) >>$cfile echo "" >>$cfile echo "module use -a $modulefiles" >> $cfile -echo "module load gsi_discover" >> $cfile +echo "module load gsi_discover.intel" >> $cfile echo "" >>$cfile echo "jobname=$jobname" >>$cfile echo "" >>$cfile diff --git a/ush/sub_gaea b/ush/sub_gaea index 6fed1b3c10..afad6aa7ab 100755 --- a/ush/sub_gaea +++ b/ush/sub_gaea @@ -129,7 +129,7 @@ echo "" >>$cfile echo "source /lustre/f2/dev/role.epic/contrib/Lmod_init.sh" >> $cfile echo "module use $modulefiles" >> $cfile -echo "module load gsi_gaea" >> $cfile +echo "module load gsi_gaea.intel" >> $cfile echo "module list" >> $cfile echo "" >>$cfile diff --git a/ush/sub_hercules b/ush/sub_hercules index 573378fdb6..e854d5727b 100755 --- a/ush/sub_hercules +++ b/ush/sub_hercules @@ -129,7 +129,7 @@ echo "" >>$cfile echo ". /apps/other/lmod/lmod/init/sh" >> $cfile echo "module purge" >> $cfile echo "module use $modulefiles" >> $cfile -echo "module load gsi_hercules" >> $cfile +echo "module load gsi_hercules.intel" >> $cfile echo "module list" >> $cfile echo "" >> $cfile cat $exec >> $cfile diff --git a/ush/sub_jet b/ush/sub_jet index d30c566ce3..9bd60486f6 100755 --- a/ush/sub_jet +++ b/ush/sub_jet @@ -127,7 +127,7 @@ echo "" >>$cfile echo ". /apps/lmod/lmod/init/sh" >> $cfile echo "module purge" >> $cfile echo "module use $modulefiles" >> $cfile -echo "module load gsi_jet" >> $cfile +echo "module load gsi_jet.intel" >> $cfile echo "module list" >> $cfile echo "" >>$cfile diff --git a/ush/sub_orion b/ush/sub_orion index e5844474db..5a13f54845 100755 --- a/ush/sub_orion +++ b/ush/sub_orion @@ -129,7 +129,7 @@ echo "" >>$cfile echo ". /apps/lmod/lmod/init/sh" >> $cfile echo "module purge" >> $cfile echo "module use $modulefiles" >> $cfile -echo "module load gsi_orion" >> $cfile +echo "module load gsi_orion.intel" >> $cfile echo "module list" >> $cfile echo "" >> $cfile cat $exec >> $cfile diff --git a/ush/sub_wcoss2 b/ush/sub_wcoss2 index f2df099f23..cd21e932f8 100755 --- a/ush/sub_wcoss2 +++ b/ush/sub_wcoss2 @@ -125,7 +125,7 @@ echo "" >> $cfile echo "module reset" >> $cfile echo "module use $modulefiles" >> $cfile -echo "module load gsi_wcoss2" >> $cfile +echo "module load gsi_wcoss2.intel" >> $cfile echo "module load envvar/1.0" >> $cfile echo "module load cray-pals/1.2.2" >> $cfile echo "module -t list 2>&1 | while read line;do module show $line 2>&1 | sed -n -e '2p';done | sort" >> $cfile