From 4df60dec1ca4803ff34e1d23ad68c1bc1d41a6ee Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Thu, 1 Feb 2024 09:35:39 -0700 Subject: [PATCH 1/4] Removed files no longer used by the GW. --- modulefiles/module-setup.csh.inc | 87 ------------------------ modulefiles/module-setup.sh.inc | 110 ------------------------------- 2 files changed, 197 deletions(-) delete mode 100644 modulefiles/module-setup.csh.inc delete mode 100644 modulefiles/module-setup.sh.inc diff --git a/modulefiles/module-setup.csh.inc b/modulefiles/module-setup.csh.inc deleted file mode 100644 index 7086326627..0000000000 --- a/modulefiles/module-setup.csh.inc +++ /dev/null @@ -1,87 +0,0 @@ -set __ms_shell=csh - -eval "if ( -d / ) set __ms_shell=tcsh" - -if ( { test -d /lfs/f1 } ) then - # We are on NOAA Cactus or Dogwood - if ( ! { module help >& /dev/null } ) then - source /usr/share/lmod/lmod/init/$__ms_shell - fi - module reset -else if ( { test -d /lfs3 } ) then - if ( ! { module help >& /dev/null } ) then - source /apps/lmod/lmod/init/$__ms_shell - endif - module purge -else if ( { test -d /scratch1 } ) then - # We are on NOAA Hera - if ( ! { module help >& /dev/null } ) then - source /apps/lmod/lmod/init/$__ms_shell - endif - module purge -elif [[ -d /work ]] ; then - # We are on MSU Orion or Hercules - if [[ -d /apps/other ]] ; then - # Hercules - init_path="/apps/other/lmod/lmod/init/$__ms_shell" - else - # Orion - init_path="/apps/lmod/lmod/init/$__ms_shell" - fi - if ( ! eval module help > /dev/null 2>&1 ) ; then - source "${init_path}" - fi - module purge -else if ( { test -d /data/prod } ) then - # We are on SSEC S4 - if ( ! { module help >& /dev/null } ) then - source /usr/share/lmod/lmod/init/$__ms_shell - endif - source /etc/profile - module purge -else if ( { test -d /glade } ) then - # We are on NCAR Yellowstone - if ( ! { module help >& /dev/null } ) then - source /usr/share/Modules/init/$__ms_shell - endif - module purge -else if ( { test -d /lustre -a -d /ncrc } ) then - # We are on GAEA. - if ( ! { module help >& /dev/null } ) then - # We cannot simply load the module command. The GAEA - # /etc/csh.login modifies a number of module-related variables - # before loading the module command. Without those variables, - # the module command fails. Hence we actually have to source - # /etc/csh.login here. - source /etc/csh.login - set __ms_source_etc_csh_login=yes - else - set __ms_source_etc_csh_login=no - endif - module purge - unsetenv _LMFILES_ - unsetenv _LMFILES_000 - unsetenv _LMFILES_001 - unsetenv LOADEDMODULES - module load modules - if ( { test -d /opt/cray/ari/modulefiles } ) then - module use -a /opt/cray/ari/modulefiles - endif - if ( { test -d /opt/cray/pe/ari/modulefiles } ) then - module use -a /opt/cray/pe/ari/modulefiles - endif - if ( { test -d /opt/cray/pe/craype/default/modulefiles } ) then - module use -a /opt/cray/pe/craype/default/modulefiles - endif - setenv NCEPLIBS /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib - if ( { test -d /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib } ) then - module use $NCEPLIBS/modulefiles - endif - if ( "$__ms_source_etc_csh_login" == yes ) then - source /etc/csh.login - unset __ms_source_etc_csh_login - endif -else - # Workaround for csh limitation. Use sh to print to stderr. - sh -c 'echo WARNING: UNKNOWN PLATFORM 1>&2' -endif diff --git a/modulefiles/module-setup.sh.inc b/modulefiles/module-setup.sh.inc deleted file mode 100644 index db9dabffe1..0000000000 --- a/modulefiles/module-setup.sh.inc +++ /dev/null @@ -1,110 +0,0 @@ -# Create a test function for sh vs. bash detection. The name is -# randomly generated to reduce the chances of name collision. -__ms_function_name="setup__test_function__$$" -eval "$__ms_function_name() { /bin/true ; }" - -# Determine which shell we are using -__ms_ksh_test=$( eval '__text="text" ; if [[ $__text =~ ^(t).* ]] ; then printf "%s" ${.sh.match[1]} ; fi' 2> /dev/null | cat ) -__ms_bash_test=$( eval 'if ( set | grep '$__ms_function_name' | grep -v name > /dev/null 2>&1 ) ; then echo t ; fi ' 2> /dev/null | cat ) - -if [[ ! -z "$__ms_ksh_test" ]] ; then - __ms_shell=ksh -elif [[ ! -z "$__ms_bash_test" ]] ; then - __ms_shell=bash -else - # Not bash or ksh, so assume sh. - __ms_shell=sh -fi - -if [[ -d /lfs/f1 ]] ; then - # We are on NOAA Cactus or Dogwood - if ( ! eval module help > /dev/null 2>&1 ) ; then - source /usr/share/lmod/lmod/init/$__ms_shell - fi - module reset -elif [[ -d /mnt/lfs1 ]] ; then - # We are on NOAA Jet - if ( ! eval module help > /dev/null 2>&1 ) ; then - source /apps/lmod/lmod/init/$__ms_shell - fi - module purge -elif [[ -d /scratch1 ]] ; then - # We are on NOAA Hera - if ( ! eval module help > /dev/null 2>&1 ) ; then - source /apps/lmod/lmod/init/$__ms_shell - fi - module purge -elif [[ -d /work ]] ; then - # We are on MSU Orion or Hercules - if [[ -d /apps/other ]] ; then - # Hercules - init_path="/apps/other/lmod/lmod/init/$__ms_shell" - else - # Orion - init_path="/apps/lmod/lmod/init/$__ms_shell" - fi - if ( ! eval module help > /dev/null 2>&1 ) ; then - source "${init_path}" - fi - module purge -elif [[ -d /glade ]] ; then - # We are on NCAR Yellowstone - if ( ! eval module help > /dev/null 2>&1 ) ; then - . /usr/share/Modules/init/$__ms_shell - fi - module purge -elif [[ -d /lustre && -d /ncrc ]] ; then - # We are on GAEA. - if ( ! eval module help > /dev/null 2>&1 ) ; then - # We cannot simply load the module command. The GAEA - # /etc/profile modifies a number of module-related variables - # before loading the module command. Without those variables, - # the module command fails. Hence we actually have to source - # /etc/profile here. - source /etc/profile - __ms_source_etc_profile=yes - else - __ms_source_etc_profile=no - fi - module purge - # clean up after purge - unset _LMFILES_ - unset _LMFILES_000 - unset _LMFILES_001 - unset LOADEDMODULES - module load modules - if [[ -d /opt/cray/ari/modulefiles ]] ; then - module use -a /opt/cray/ari/modulefiles - fi - if [[ -d /opt/cray/pe/ari/modulefiles ]] ; then - module use -a /opt/cray/pe/ari/modulefiles - fi - if [[ -d /opt/cray/pe/craype/default/modulefiles ]] ; then - module use -a /opt/cray/pe/craype/default/modulefiles - fi - if [[ -s /etc/opt/cray/pe/admin-pe/site-config ]] ; then - source /etc/opt/cray/pe/admin-pe/site-config - fi - export NCEPLIBS=/lustre/f1/pdata/ncep_shared/NCEPLIBS/lib - if [[ -d "$NCEPLIBS" ]] ; then - module use $NCEPLIBS/modulefiles - fi - if [[ "$__ms_source_etc_profile" == yes ]] ; then - source /etc/profile - unset __ms_source_etc_profile - fi -elif [[ -d /data/prod ]] ; then - # We are on SSEC's S4 - if ( ! eval module help > /dev/null 2>&1 ) ; then - source /usr/share/lmod/lmod/init/$__ms_shell - fi - module purge -else - echo WARNING: UNKNOWN PLATFORM 1>&2 -fi - -unset __ms_shell -unset __ms_ksh_test -unset __ms_bash_test -unset $__ms_function_name -unset __ms_function_name From ac326f48e1e21ad2dcef2ada1247067b879294df Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Thu, 1 Feb 2024 10:42:26 -0700 Subject: [PATCH 2/4] Correction based on reviewer comments. --- ush/load_fv3gfs_modules.sh | 2 +- ush/load_ufsda_modules.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index b4f23fa331..48885c62e4 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -10,7 +10,7 @@ fi ulimit_s=$( ulimit -S -s ) # Find module command and purge: -source "${HOMEgfs}/modulefiles/module-setup.sh.inc" +source "${HOMEgfs}/ush/module-setup.sh" # Source versions file for runtime source "${HOMEgfs}/versions/run.ver" diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index 1ab730c30e..f15ae5666c 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -27,7 +27,7 @@ fi ulimit_s=$( ulimit -S -s ) # Find module command and purge: -source "${HOMEgfs}/modulefiles/module-setup.sh.inc" +source "${HOMEgfs}/ush/module-setup.sh" # Load our modules: module use "${HOMEgfs}/sorc/gdas.cd/modulefiles" From eb2fb205b34d165c596e1247867c42860124238c Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Sun, 4 Feb 2024 17:52:03 +0000 Subject: [PATCH 3/4] Updated detect_machine.sh. --- ush/detect_machine.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/ush/detect_machine.sh b/ush/detect_machine.sh index 01ae66a02d..8a719c10d9 100755 --- a/ush/detect_machine.sh +++ b/ush/detect_machine.sh @@ -1,10 +1,21 @@ #!/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[12].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 @@ -15,7 +26,7 @@ case $(hostname -f) in gaea9.ncrc.gov) MACHINE_ID=gaea ;; ### gaea9 gaea1[0-6].ncrc.gov) MACHINE_ID=gaea ;; ### gaea10-16 - 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 @@ -28,10 +39,6 @@ case $(hostname -f) in [Hh]ercules-login-[1-4].[Hh][Pp][Cc].[Mm]s[Ss]tate.[Ee]du) 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 - login[1-4].stampede2.tacc.utexas.edu) MACHINE_ID=stampede ;; ### stampede1-4 login0[1-2].expanse.sdsc.edu) MACHINE_ID=expanse ;; ### expanse1-2 @@ -56,30 +63,30 @@ if [[ "${MACHINE_ID}" != "UNKNOWN" ]]; then fi # Try searching based on paths since hostname may not match on compute nodes -if [[ -d /lfs/f1 ]] ; then +if [[ -d /lfs/h3 ]]; then # We are on NOAA Cactus or Dogwood MACHINE_ID=wcoss2 -elif [[ -d /mnt/lfs1 ]] ; then +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 +elif [[ -d /scratch1 ]]; then # We are on NOAA Hera MACHINE_ID=hera -elif [[ -d /work ]] ; then +elif [[ -d /work ]]; then # We are on MSU Orion or Hercules - if [[ -d /apps/other ]] ; then + if [[ -d /apps/other ]]; then # We are on Hercules MACHINE_ID=hercules else MACHINE_ID=orion fi -elif [[ -d /glade ]] ; then - # We are on NCAR Yellowstone - MACHINE_ID=cheyenne -elif [[ -d /lustre && -d /ncrc ]] ; then +elif [[ -d /gpfs && -d /ncrc ]]; then # We are on GAEA. MACHINE_ID=gaea -elif [[ -d /data/prod ]] ; then +elif [[ -d /data/prod ]]; then # We are on SSEC's S4 MACHINE_ID=s4 else From 63d039da2c21daddf2ff17700afbe0ceab5fc0b2 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Sun, 4 Feb 2024 17:52:43 +0000 Subject: [PATCH 4/4] Source detect_machine.sh in order to load proper modules. --- ush/module-setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ush/module-setup.sh b/ush/module-setup.sh index fd656966bf..e204bae8a2 100755 --- a/ush/module-setup.sh +++ b/ush/module-setup.sh @@ -1,6 +1,8 @@ #!/bin/bash set -u +source "${HOMEgfs}/ush/detect_machine.sh" + if [[ ${MACHINE_ID} = jet* ]] ; then # We are on NOAA Jet if ( ! eval module help > /dev/null 2>&1 ) ; then