Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/bnu_soil
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Aug 11, 2023
2 parents ecf2442 + 9d1622b commit 400cc13
Show file tree
Hide file tree
Showing 12 changed files with 454 additions and 188 deletions.
59 changes: 41 additions & 18 deletions build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,72 @@

set -eux

# Get the root of the cloned ufs-utils directory
if [[ $(uname -s) == Darwin ]]; then
readonly DIR_ROOT=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
else
readonly DIR_ROOT=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
fi

# User Options
target=${target:-"NULL"}
compiler=${compiler:-"intel"}
export MOD_PATH
PW_CSP=${PW_CSP:-} # TODO: This is an implementation from EPIC and consistent with the UFS WM build system.

if [[ "$target" == "linux.*" || "$target" == "macosx.*" ]]; then
unset -f module
set +x
source ./modulefiles/build.$target > /dev/null
set -x
unset -f module
set +x
source "${DIR_ROOT}/modulefiles/build.${target}" > /dev/null
set -x
else
set +x
source ./sorc/machine-setup.sh
module use ./modulefiles
module load build.$target.$compiler > /dev/null
module list
set +x
source "${DIR_ROOT}/sorc/machine-setup.sh"
if [[ "${target}" == "noaacloud" ]]; then
#TODO: This will need to be revisited once the EPIC supported-stacks come online.
#TODO: This is a hack due to how the spack-stack module files are generated; there may be a better way to do this.
source /contrib/global-workflow/spack-stack/envs/spack_2021.0.3.env
else
module use "${DIR_ROOT}/modulefiles"
fi
module load "build.$target.$compiler" > /dev/null
module list
set -x
fi

# Ensure the submodules have been initialized.

if [[ ! -d ./ccpp-physics/physics ]]; then
if [[ ! -d "${DIR_ROOT}/ccpp-physics/physics" ]]; then
cd "${DIR_ROOT}"
git submodule init
git submodule update
fi

# Collect BUILD Options
CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Release}"

# Install options; destination for built executables, libraries, CMake Package config
CMAKE_FLAGS+=" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-${DIR_ROOT}} -DCMAKE_INSTALL_BINDIR=${INSTALL_BINDIR:-exec}"

# Testing options
# The unit test data download is part of the build system. Not all machines can
# access the EMC ftp site, so turn off the build (-DBUILD_TESTING=OFF) of the units tests accordingly.
# Those with access to the EMC ftp site are: Orion and Hera.

CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DCMAKE_INSTALL_BINDIR=exec -DBUILD_TESTING=OFF"
CMAKE_FLAGS+=" -DBUILD_TESTING=${BUILD_TESTING:-OFF}"

# Allow users of this script to provide CMake options e.g. -DGFS=ON|OFF to build GFS specific utilities only
CMAKE_OPTS=${CMAKE_OPTS:-}

rm -fr ./build
mkdir ./build && cd ./build
# Re-use or create a new BUILD_DIR (Default: create new BUILD_DIR)
BUILD_DIR=${BUILD_DIR:-"${DIR_ROOT}/build"}
[[ ${BUILD_CLEAN:-"YES"} =~ [yYtT] ]] && rm -rf "$BUILD_DIR"
mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}"

cmake .. ${CMAKE_FLAGS} ${CMAKE_OPTS}
cmake ${CMAKE_FLAGS} ${CMAKE_OPTS} "${DIR_ROOT}"

make -j ${BUILD_JOBS:-8} VERBOSE=${BUILD_VERBOSE:-}
make -j "${BUILD_JOBS:-8}" VERBOSE="${BUILD_VERBOSE:-}"
make install

#ctest
#ctest -I 4,5

exit
exit 0
59 changes: 59 additions & 0 deletions modulefiles/build.noaacloud.intel.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
help([[
Load environment to compile UFS_UTILS on NOAA CSPs using Intel
]])

cmake_ver=os.getenv("cmake_ver") or "3.16.1"
load(pathJoin("cmake", cmake_ver))

hpc_intel_ver=os.getenv("hpc_intel_ver") or "2021.3.0"
load(pathJoin("intel", hpc_intel_ver))

impi_ver=os.getenv("impi_ver") or "2021.3.0"
load(pathJoin("impi", impi_ver))

bacio_ver=os.getenv("bacio_ver") or "2.4.1"
load(pathJoin("bacio", bacio_ver))

g2_ver=os.getenv("g2_ver") or "3.4.5"
load(pathJoin("g2", g2_ver))

ip_ver=os.getenv("ip_ver") or "4.0.0"
load(pathJoin("ip", ip_ver))

nemsio_ver=os.getenv("nemsio_ver") or "2.5.4"
load(pathJoin("nemsio", nemsio_ver))

sp_ver=os.getenv("sp_ver") or "2.3.3"
load(pathJoin("sp", sp_ver))

w3emc_ver=os.getenv("w3emc_ver") or "2.9.2"
load(pathJoin("w3emc", w3emc_ver))

sfcio_ver=os.getenv("sfcio_ver") or "1.4.1"
load(pathJoin("sfcio", sfcio_ver))

sigio_ver=os.getenv("sigio_ver") or "2.3.2"
load(pathJoin("sigio", sigio_ver))

zlib_ver=os.getenv("zlib_ver") or "1.2.11"
load(pathJoin("zlib", zlib_ver))

png_ver=os.getenv("png_ver") or "1.6.35"
load(pathJoin("libpng", png_ver))

hdf5_ver=os.getenv("hdf5_ver") or "1.10.6"
load(pathJoin("hdf5", hdf5_ver))

netcdf_ver=os.getenv("netcdf_ver") or "4.6.1"
load(pathJoin("netcdf", netcdf_ver))

nccmp_ver=os.getenv("nccmp_ver") or "1.8.9.0"
load(pathJoin("nccmp", nccmp_ver))

esmf_ver=os.getenv("esmf_ver") or "8.4.0b08"
load(pathJoin("esmf", esmf_ver))

nco_ver=os.getenv("nco_ver") or "4.9.1"
load(pathJoin("nco", nco_ver))

whatis("Description: UFS_UTILS build environment")
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

#------------------------------------------------------------------
# Run global_cycle for a C768 case to test the ingest and
# application of soil temperature increments from the GSI.
# Run global_cycle for a C192 case to test the ingest and
# application of soil moisture and temperature increments
# from the GSI, into Noah-MP restarts.
# Compare output to a baseline set of files using the 'nccmp'
# utility.
#------------------------------------------------------------------
Expand All @@ -22,13 +23,9 @@ export CDATE=2019073000
export FHOUR=00
export DELTSFC=6

export CASE=C768
export CASE=C192

export COMIN=$HOMEreg/input_data
export FNTSFA=$COMIN/gdas.t00z.rtgssthr.grb
export FNSNOA=$COMIN/gdas.t00z.snogrb_t1534.3072.1536
export FNACNA=$COMIN/gdas.t00z.seaice.5min.blend.grb
export NST_FILE=$COMIN/gdas.t00z.dtfanl.nc
export COMIN=$HOMEreg/input_data_noahmp

export LND_SOI_FILE=$COMIN/sfcincr_gsi

Expand All @@ -52,7 +49,7 @@ $BASE_GSM/ush/global_cycle_driver.sh
iret=$?
if [ $iret -ne 0 ]; then
set +x
echo "<<< C768 LANDINC SOILT CYCLE TEST FAILED. >>>"
echo "<<< C192 LANDINC SOIL NOAHMP CYCLE TEST FAILED. >>>"
exit $iret
fi

Expand All @@ -63,7 +60,7 @@ for files in *tile*.nc
do
if [ -f $files ]; then
echo CHECK $files
$NCCMP -dmfqS $files $HOMEreg/baseline_data/c768.lndincsoil/$files
$NCCMP -dmfqS $files $HOMEreg/baseline_data/c192.lndincsoilnoahmp/$files
iret=$?
if [ $iret -ne 0 ]; then
test_failed=1
Expand All @@ -75,15 +72,15 @@ set +x
if [ $test_failed -ne 0 ]; then
echo
echo "*****************************************"
echo "<<< C768 LANDINC SOILT CYCLE TEST FAILED. >>>"
echo "<<< C192 LANDINC SOIL-NOAHP CYCLE TEST FAILED. >>>"
echo "*****************************************"
if [ "$UPDATE_BASELINE" = "TRUE" ]; then
$BASE_GSM/reg_tests/update_baseline.sh $HOMEreg "c768.lndincsoil" $commit_num
$BASE_GSM/reg_tests/update_baseline.sh $HOMEreg "c192.lndincsoilnoahmp" $commit_num
fi
else
echo
echo "*****************************************"
echo "<<< C768 LANDINC SOILT CYCLE TEST PASSED. >>>"
echo "<<< C192 LANDINC SOIL-NOAHMP CYCLE TEST PASSED. >>>"
echo "*****************************************"
fi

Expand Down
4 changes: 2 additions & 2 deletions reg_tests/global_cycle/driver.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C
LOG_FILE=consistency.log02
export DATA="${DATA_DIR}/test2"
export COMOUT=$DATA
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \
-o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh)
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \
-o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh)

LOG_FILE=consistency.log03
export DATA="${DATA_DIR}/test3"
Expand Down
4 changes: 2 additions & 2 deletions reg_tests/global_cycle/driver.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C
LOG_FILE=consistency.log02
export DATA="${DATA_DIR}/test2"
export COMOUT=$DATA
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \
--partition=xjet -o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh)
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \
--partition=xjet -o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh)

LOG_FILE=consistency.log03
export DATA="${DATA_DIR}/test3"
Expand Down
4 changes: 2 additions & 2 deletions reg_tests/global_cycle/driver.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C
LOG_FILE=consistency.log02
export DATA="${DATA_DIR}/test2"
export COMOUT=$DATA
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c768.lndincsoil \
-o $LOG_FILE -e $LOG_FILE ./C768.lndincsoil.sh)
TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.lndincsoilnoahmp \
-o $LOG_FILE -e $LOG_FILE ./C192.lndincsoilnoahmp.sh)

LOG_FILE=consistency.log03
export DATA="${DATA_DIR}/test3"
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/global_cycle/driver.wcoss2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST1=$(qsub -V -o ${LOG_FILE}01 -e ${LOG_FILE}01 -q $QUEUE -A $PROJECT_CODE -l
export DATA="${DATA_DIR}/test2"
export COMOUT=$DATA
TEST2=$(qsub -V -o ${LOG_FILE}02 -e ${LOG_FILE}02 -q $QUEUE -A $PROJECT_CODE -l walltime=00:05:00 \
-N c768.lndincsoil -l select=1:ncpus=12:mem=8GB $PWD/C768.lndincsoil.sh)
-N c192.lndincsoilnoahmp -l select=1:ncpus=12:mem=8GB $PWD/C192.lndincsoilnoahmp.sh)

export DATA="${DATA_DIR}/test3"
export COMOUT=$DATA
Expand Down
Loading

0 comments on commit 400cc13

Please sign in to comment.