From 40f2cf6cd70ac94e01babc96982f37ae1b0c7e79 Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Tue, 13 Feb 2024 10:18:53 -0700 Subject: [PATCH 1/5] Implemented ush/detect_machine.sh for host determination and removed redundant checks for expected file paths. --- ush/load_fv3gfs_modules.sh | 31 +++++++++++++------------------ ush/load_ufsda_modules.sh | 33 ++++++++++++++++----------------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index 48885c62e43..8e400f38cf8 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -10,6 +10,7 @@ fi ulimit_s=$( ulimit -S -s ) # Find module command and purge: +source "${HOMEgfs}/ush/detect_machine.sh" source "${HOMEgfs}/ush/module-setup.sh" # Source versions file for runtime @@ -18,35 +19,29 @@ source "${HOMEgfs}/versions/run.ver" # Load our modules: module use "${HOMEgfs}/modulefiles" -if [[ -d /lfs/f1 ]]; then +if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then # We are on WCOSS2 (Cactus or Dogwood) module load module_base.wcoss2 -elif [[ -d /mnt/lfs1 ]] ; then +elif [[ "${MACHINE_ID}" == "jet" ]] ; then # We are on NOAA Jet module load module_base.jet -elif [[ -d /scratch1 ]] ; then +elif [[ "${MACHINE_ID}" == "hera" ]] ; then # We are on NOAA Hera module load module_base.hera -elif [[ -d /work ]] ; then - # We are on MSU Orion or Hercules - if [[ -d /apps/other ]] ; then - # Hercules - module load module_base.hercules - else - # Orion - module load module_base.orion - fi -elif [[ -d /glade ]] ; then - # We are on NCAR Yellowstone - module load module_base.cheyenne -elif [[ -d /lustre && -d /ncrc ]] ; then +elif [[ "${MACHINE_ID}" == "orion" ]] ; then + # We are on MSU Orion + module load module_base.orion +elif [[ "${MACHINE_ID}" == "hercules" ]] ; then + # We are on MSU Hercules + module load module_base.hercules +elif [[ "${MACHINE_ID}" == "gaea" ]] ; then # We are on GAEA. module load module_base.gaea -elif [[ -d /data/prod ]] ; then +elif [[ "${MACHINE_ID}" == "s4" ]] ; then # We are on SSEC S4 module load module_base.s4 else - echo WARNING: UNKNOWN PLATFORM + echo WARNING: UNKNOWN PLATFORM # TODO: Should an exception be raised here? fi module list diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index f15ae5666c6..c7526ce307b 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -27,43 +27,42 @@ fi ulimit_s=$( ulimit -S -s ) # Find module command and purge: +source "${HOMEgfs}/ush/detect_machine.sh" source "${HOMEgfs}/ush/module-setup.sh" # Load our modules: module use "${HOMEgfs}/sorc/gdas.cd/modulefiles" -if [[ -d /lfs/f1 ]]; then +if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then # We are on WCOSS2 (Cactus or Dogwood) echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ -d /lfs3 ]] ; then +elif [[ "${MACHINE_ID}" == "jet" ]] ; then # We are on NOAA Jet echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ -d /scratch1 ]] ; then +elif [[ "${MACHINE_ID}" == "hera" ]] ; then # We are on NOAA Hera module load "${MODS}/hera" # set NETCDF variable based on ncdump location NETCDF=$( which ncdump ) export NETCDF -elif [[ -d /work ]] ; then - # We are on MSU Orion or Hercules - if [[ -d /apps/other ]] ; then - # Hercules - module load "${MODS}/hercules" - else - # Orion - module load "${MODS}/orion" - fi +elif [[ "${MACHINE_ID}" == "orion" ]] ; then + # We are on MSU Orion + module load "${MODS}/orion" # set NETCDF variable based on ncdump location ncdump=$( which ncdump ) NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) export NETCDF -elif [[ -d /glade ]] ; then - # We are on NCAR Yellowstone - echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ -d /lustre && -d /ncrc ]] ; then +elif [[ "${MACHINE_ID}" == "hercules" ]] ; then + # We are on MSU Hercules + module load "${MODS}/hercules" + # set NETCDF variable based on ncdump location + ncdump=$( which ncdump ) + NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) + export NETCDF +elif [[ "${MACHINE_ID}" == "gaea" ]] ; then # We are on GAEA. echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ -d /data/prod ]] ; then +elif [[ "${MACHINE_ID}" == "s4" ]] ; then # We are on SSEC S4 echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM else From ed25bbd0b26a893d32ce4a10b368dec2bb722424 Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Fri, 16 Feb 2024 09:33:59 -0700 Subject: [PATCH 2/5] Linter corrections. --- ush/load_ufsda_modules.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index c7526ce307b..5c30f8ed4bf 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -43,20 +43,20 @@ elif [[ "${MACHINE_ID}" == "hera" ]] ; then # We are on NOAA Hera module load "${MODS}/hera" # set NETCDF variable based on ncdump location - NETCDF=$( which ncdump ) + NETCDF=$( command -v ncdump) export NETCDF elif [[ "${MACHINE_ID}" == "orion" ]] ; then # We are on MSU Orion module load "${MODS}/orion" # set NETCDF variable based on ncdump location - ncdump=$( which ncdump ) + ncdump=$( command -v ncdump) NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) export NETCDF elif [[ "${MACHINE_ID}" == "hercules" ]] ; then # We are on MSU Hercules module load "${MODS}/hercules" # set NETCDF variable based on ncdump location - ncdump=$( which ncdump ) + ncdump=$( command -v ncdump ) NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) export NETCDF elif [[ "${MACHINE_ID}" == "gaea" ]] ; then From 4624ce21c99ab303afa10c1dd8ddcce7b6f715ca Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Fri, 16 Feb 2024 10:52:11 -0700 Subject: [PATCH 3/5] Updates requested by reviewer; testing -- DO NOT REVIEW. --- ush/load_fv3gfs_modules.sh | 59 ++++++++++++++++----------- ush/load_ufsda_modules.sh | 82 ++++++++++++++++++++++---------------- 2 files changed, 83 insertions(+), 58 deletions(-) diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index 8e400f38cf8..b09f1bf1665 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -19,30 +19,41 @@ source "${HOMEgfs}/versions/run.ver" # Load our modules: module use "${HOMEgfs}/modulefiles" -if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then - # We are on WCOSS2 (Cactus or Dogwood) - module load module_base.wcoss2 -elif [[ "${MACHINE_ID}" == "jet" ]] ; then - # We are on NOAA Jet - module load module_base.jet -elif [[ "${MACHINE_ID}" == "hera" ]] ; then - # We are on NOAA Hera - module load module_base.hera -elif [[ "${MACHINE_ID}" == "orion" ]] ; then - # We are on MSU Orion - module load module_base.orion -elif [[ "${MACHINE_ID}" == "hercules" ]] ; then - # We are on MSU Hercules - module load module_base.hercules -elif [[ "${MACHINE_ID}" == "gaea" ]] ; then - # We are on GAEA. - module load module_base.gaea -elif [[ "${MACHINE_ID}" == "s4" ]] ; then - # We are on SSEC S4 - module load module_base.s4 -else - echo WARNING: UNKNOWN PLATFORM # TODO: Should an exception be raised here? -fi +# TODO: Testing. + +#if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then +# # We are on WCOSS2 (Cactus or Dogwood) +# module load module_base.wcoss2 +#elif [[ "${MACHINE_ID}" == "jet" ]] ; then +# # We are on NOAA Jet +# module load module_base.jet +#elif [[ "${MACHINE_ID}" == "hera" ]] ; then +# # We are on NOAA Hera +# module load module_base.hera +#elif [[ "${MACHINE_ID}" == "orion" ]] ; then +# # We are on MSU Orion +# module load module_base.orion +#elif [[ "${MACHINE_ID}" == "hercules" ]] ; then +# # We are on MSU Hercules +# module load module_base.hercules +#elif [[ "${MACHINE_ID}" == "gaea" ]] ; then +# # We are on GAEA. +# module load module_base.gaea +#elif [[ "${MACHINE_ID}" == "s4" ]] ; then +# # We are on SSEC S4 +# module load module_base.s4 +#else +# echo WARNING: UNKNOWN PLATFORM # TODO: Should an exception be raised here? +#fi + +case "${MACHINE_ID}" in + "wcoss2" | "hera" | "orion" | "hercules" | "gaea" | "jet" | "s4") + module load "module_base.${MACHINE_ID}" + ;; + *) + echo "WARNING: UNKNOWN PLATFORM" + ;; +esac module list diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index 5c30f8ed4bf..d8333083f49 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -33,41 +33,55 @@ source "${HOMEgfs}/ush/module-setup.sh" # Load our modules: module use "${HOMEgfs}/sorc/gdas.cd/modulefiles" -if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then - # We are on WCOSS2 (Cactus or Dogwood) - echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ "${MACHINE_ID}" == "jet" ]] ; then - # We are on NOAA Jet - echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ "${MACHINE_ID}" == "hera" ]] ; then - # We are on NOAA Hera - module load "${MODS}/hera" - # set NETCDF variable based on ncdump location - NETCDF=$( command -v ncdump) - export NETCDF -elif [[ "${MACHINE_ID}" == "orion" ]] ; then - # We are on MSU Orion - module load "${MODS}/orion" - # set NETCDF variable based on ncdump location - ncdump=$( command -v ncdump) - NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) - export NETCDF -elif [[ "${MACHINE_ID}" == "hercules" ]] ; then - # We are on MSU Hercules - module load "${MODS}/hercules" - # set NETCDF variable based on ncdump location - ncdump=$( command -v ncdump ) - NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) - export NETCDF -elif [[ "${MACHINE_ID}" == "gaea" ]] ; then +#if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then +# # We are on WCOSS2 (Cactus or Dogwood) +# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM +#elif [[ "${MACHINE_ID}" == "jet" ]] ; then +# # We are on NOAA Jet +# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM +#elif [[ "${MACHINE_ID}" == "hera" ]] ; then +# # We are on NOAA Hera +# module load "${MODS}/hera" +# # set NETCDF variable based on ncdump location +# NETCDF=$( command -v ncdump) +# export NETCDF +#elif [[ "${MACHINE_ID}" == "orion" ]] ; then +# # We are on MSU Orion +# module load "${MODS}/orion" +# # set NETCDF variable based on ncdump location +# ncdump=$( command -v ncdump) +# NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) +# export NETCDF +#elif [[ "${MACHINE_ID}" == "hercules" ]] ; then +# # We are on MSU Hercules +# module load "${MODS}/hercules" +# # set NETCDF variable based on ncdump location +# ncdump=$( command -v ncdump ) +# NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) +# export NETCDF +#elif [[ "${MACHINE_ID}" == "gaea" ]] ; then # We are on GAEA. - echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -elif [[ "${MACHINE_ID}" == "s4" ]] ; then - # We are on SSEC S4 - echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -else - echo WARNING: UNKNOWN PLATFORM -fi +# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM +#elif [[ "${MACHINE_ID}" == "s4" ]] ; then +# # We are on SSEC S4 +# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM +#else +# echo WARNING: UNKNOWN PLATFORM +#fi + +case "${MACHINE_ID}" in + ("hera" | "orion" | "hercules") + module load "${MODS}/${MACHINE_ID}" + NETCDF=$( command -v ncdump ) + export NETCDF + ;; + ("wcoss2" | "acorn" | "jet" | "gaea" | "s4") + echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM + ;; + *) + echo "WARNING: UNKNOWN PLATFORM" + ;; +esac module list pip list From 8e4f94d13d32849b2862a9d59aa070f4103c61ae Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Fri, 16 Feb 2024 11:04:41 -0700 Subject: [PATCH 4/5] Updates requested by reviewer Rahul Mahajan. --- ush/load_fv3gfs_modules.sh | 27 --------------------------- ush/load_ufsda_modules.sh | 36 ------------------------------------ 2 files changed, 63 deletions(-) diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index b09f1bf1665..ae0e381db43 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -19,33 +19,6 @@ source "${HOMEgfs}/versions/run.ver" # Load our modules: module use "${HOMEgfs}/modulefiles" -# TODO: Testing. - -#if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then -# # We are on WCOSS2 (Cactus or Dogwood) -# module load module_base.wcoss2 -#elif [[ "${MACHINE_ID}" == "jet" ]] ; then -# # We are on NOAA Jet -# module load module_base.jet -#elif [[ "${MACHINE_ID}" == "hera" ]] ; then -# # We are on NOAA Hera -# module load module_base.hera -#elif [[ "${MACHINE_ID}" == "orion" ]] ; then -# # We are on MSU Orion -# module load module_base.orion -#elif [[ "${MACHINE_ID}" == "hercules" ]] ; then -# # We are on MSU Hercules -# module load module_base.hercules -#elif [[ "${MACHINE_ID}" == "gaea" ]] ; then -# # We are on GAEA. -# module load module_base.gaea -#elif [[ "${MACHINE_ID}" == "s4" ]] ; then -# # We are on SSEC S4 -# module load module_base.s4 -#else -# echo WARNING: UNKNOWN PLATFORM # TODO: Should an exception be raised here? -#fi - case "${MACHINE_ID}" in "wcoss2" | "hera" | "orion" | "hercules" | "gaea" | "jet" | "s4") module load "module_base.${MACHINE_ID}" diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index d8333083f49..68547cc05b5 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -33,42 +33,6 @@ source "${HOMEgfs}/ush/module-setup.sh" # Load our modules: module use "${HOMEgfs}/sorc/gdas.cd/modulefiles" -#if [[ "${MACHINE_ID}" == "wcoss2" || "${MACHINE_ID}" == "acorn" ]]; then -# # We are on WCOSS2 (Cactus or Dogwood) -# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -#elif [[ "${MACHINE_ID}" == "jet" ]] ; then -# # We are on NOAA Jet -# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -#elif [[ "${MACHINE_ID}" == "hera" ]] ; then -# # We are on NOAA Hera -# module load "${MODS}/hera" -# # set NETCDF variable based on ncdump location -# NETCDF=$( command -v ncdump) -# export NETCDF -#elif [[ "${MACHINE_ID}" == "orion" ]] ; then -# # We are on MSU Orion -# module load "${MODS}/orion" -# # set NETCDF variable based on ncdump location -# ncdump=$( command -v ncdump) -# NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) -# export NETCDF -#elif [[ "${MACHINE_ID}" == "hercules" ]] ; then -# # We are on MSU Hercules -# module load "${MODS}/hercules" -# # set NETCDF variable based on ncdump location -# ncdump=$( command -v ncdump ) -# NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) -# export NETCDF -#elif [[ "${MACHINE_ID}" == "gaea" ]] ; then - # We are on GAEA. -# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -#elif [[ "${MACHINE_ID}" == "s4" ]] ; then -# # We are on SSEC S4 -# echo WARNING: UFSDA NOT SUPPORTED ON THIS PLATFORM -#else -# echo WARNING: UNKNOWN PLATFORM -#fi - case "${MACHINE_ID}" in ("hera" | "orion" | "hercules") module load "${MODS}/${MACHINE_ID}" From 4529e8cf3736ffbacf615a27e99f4d1beec391aa Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Fri, 16 Feb 2024 11:12:01 -0700 Subject: [PATCH 5/5] Bug fix. --- ush/load_ufsda_modules.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ush/load_ufsda_modules.sh b/ush/load_ufsda_modules.sh index 68547cc05b5..e8e72b8fbe1 100755 --- a/ush/load_ufsda_modules.sh +++ b/ush/load_ufsda_modules.sh @@ -36,7 +36,8 @@ module use "${HOMEgfs}/sorc/gdas.cd/modulefiles" case "${MACHINE_ID}" in ("hera" | "orion" | "hercules") module load "${MODS}/${MACHINE_ID}" - NETCDF=$( command -v ncdump ) + ncdump=$( command -v ncdump ) + NETCDF=$( echo "${ncdump}" | cut -d " " -f 3 ) export NETCDF ;; ("wcoss2" | "acorn" | "jet" | "gaea" | "s4")