Skip to content

Commit

Permalink
Implemented ush/detect_machine.sh for host determination and removed …
Browse files Browse the repository at this point in the history
…redundant checks for expected file paths.
  • Loading branch information
henrywinterbottom-wxdev committed Feb 13, 2024
1 parent 3f99f70 commit 40f2cf6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
31 changes: 13 additions & 18 deletions ush/load_fv3gfs_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
33 changes: 16 additions & 17 deletions ush/load_ufsda_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40f2cf6

Please sign in to comment.