Skip to content

Commit

Permalink
Unify build system
Browse files Browse the repository at this point in the history
Combines the checkout and build from the standard and coupled workflows
system that checks out the current UFS.

The model source directory is now ufs_model.fd rather than fv3gfs.fd or
ufs_coupled.fd. The build script is renamed build_ufs.sh and the link
script is renamed to simply link.sh.

The checkout script checks out the same UFS version (current as of
2021 Jul 20) for all applications, removing the coupled option from the
coupled branch. A new option, -m, allows the user to specify a different
model hash to check out. Checkout log files are now placed in the logs
directory like the build logs in order to keep the sorc directory clean.

Two new options are added to the build_all script: -c to build the
coupled (S2SW) app, and -a to build the aerosol (ATMAERO) app. Without
either argument, the traditional (ATMW) app is built. If either option
is provided, the cpl_build.cfg file controls which executables are built;
otherwise fv3gfs_build.cfg is still used. The build_ufs script corre-
spondingly accepts the same options.

The reg2grb2 source directory is copied over from the coupled model and
cmake files for workflow_utils are updated correspondingly to build.
Additionally, the build_workflow_utils modulefiles are updated to use the
ncio module in hpc-stack and the hack that cloned and built it as part of
the workflow_utils build is removed.

The build_ww3prepost script is updated to make the code more easily main-
tained and the corresponding modulefiles are updated to remove unnecessary
modules.

The link script is updated to the new fix location (ending in fix_NEW)
removes links with targets that no longer exist. A new third argument to
link, coupled, is added to additionally link files needed by the coupled
system.

Note that while the checkout, build, and link have all been tested and
complete without error, the workflow is otherwise untested and may not
work until additional updates are made to use the current UFS.

Refs: NOAA-EMC#366, NOAA-EMC#368, NOAA-EMC#374
  • Loading branch information
WalterKolczynski-NOAA committed Jul 26, 2021
1 parent 2d5a8ec commit b4ee33a
Show file tree
Hide file tree
Showing 21 changed files with 1,925 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ parm/wafs
#--------------------------------------------
sorc/*log
sorc/logs
sorc/fv3gfs.fd
sorc/ufs_model.fd
sorc/gfs_post.fd
sorc/gfs_wafs.fd
sorc/gldas.fd
Expand Down
17 changes: 2 additions & 15 deletions modulefiles/modulefile.ww3.hera
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@ module load jasper/2.0.25
module load zlib/1.2.11
module load png/1.6.35

module load hdf5/1.10.6
module load netcdf/4.7.4
module load pio/2.5.2
module load esmf/8_1_1
module load fms/2020.04.03

module load bacio/2.4.1
module load crtm/2.3.0
module load g2/3.4.1
module load g2tmpl/1.9.1
module load ip/3.3.3
module load nemsio/2.5.2
module load sp/2.3.3
module load w3emc/2.7.3
module load w3nco/2.4.1
module load wgrib2/2.0.8
module load upp/10.0.6

module load netcdf/4.7.4
17 changes: 2 additions & 15 deletions modulefiles/modulefile.ww3.orion
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,7 @@ module load jasper/2.0.25
module load zlib/1.2.11
module load png/1.6.35

module load hdf5/1.10.6
module load netcdf/4.7.4
module load pio/2.5.2
module load esmf/8_1_1
module load fms/2020.04.03

module load bacio/2.4.1
module load crtm/2.3.0
module load g2/3.4.1
module load g2tmpl/1.9.1
module load ip/3.3.3
module load nemsio/2.5.2
module load sp/2.3.3
module load w3emc/2.7.3
module load w3nco/2.4.1
module load wgrib2/2.0.8
module load upp/10.0.6

module load netcdf/4.7.4
17 changes: 2 additions & 15 deletions modulefiles/modulefile.ww3.wcoss_dell_p3
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,7 @@ module load jasper/2.0.25
module load zlib/1.2.11
module load png/1.6.35

module load hdf5/1.10.6
module load netcdf/4.7.4
module load pio/2.5.2
module load esmf/8_1_1
module load fms/2020.04.03

module load bacio/2.4.1
module load crtm/2.3.0
module load g2/3.4.1
module load g2tmpl/1.9.1
module load ip/3.3.3
module load nemsio/2.5.2
module load sp/2.3.3
module load w3emc/2.7.3
module load w3nco/2.4.1
module load wgrib2/2.0.8
module load upp/10.0.6

module load netcdf/4.7.4
4 changes: 3 additions & 1 deletion modulefiles/workflow_utils.hera
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ module load sp/2.3.3
module load ip/3.3.3
module load nemsio/2.5.2
module load nemsiogfs/2.5.3
#module load ncio/1.0.0
module load ncio/1.0.0
module load landsfcutil/2.4.1
module load wgrib2/2.0.8
module load sigio/2.3.2
module load g2/3.4.1
module load bufr/11.4.0
Expand Down
4 changes: 3 additions & 1 deletion modulefiles/workflow_utils.orion
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ module load sp/2.3.3
module load ip/3.3.3
module load nemsio/2.5.2
module load nemsiogfs/2.5.3
#module load ncio/1.0.0
module load ncio/1.0.0
module load landsfcutil/2.4.1
module load wgrib2/2.0.8
module load sigio/2.3.2
module load g2/3.4.1
module load bufr/11.4.0
Expand Down
4 changes: 3 additions & 1 deletion modulefiles/workflow_utils.wcoss_dell_p3
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ module load sp/2.3.3
module load ip/3.3.3
module load nemsio/2.5.2
module load nemsiogfs/2.5.3
#module load ncio/1.0.0
module load ncio/1.0.0
module load landsfcutil/2.4.1
module load wgrib2/2.0.8
module load sigio/2.3.2
module load g2/3.4.1
module load bufr/11.4.0
Expand Down
4 changes: 3 additions & 1 deletion sorc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,19 @@ find_package(sp REQUIRED)
find_package(ip REQUIRED)
find_package(ncio REQUIRED)
find_package(nemsio REQUIRED)
find_package(nemsiogfs REQUIRED)
find_package(sigio REQUIRED)
find_package(g2 REQUIRED)
find_package(bufr REQUIRED)
find_package(landsfcutil REQUIRED)
find_package(wgrib2 REQUIRED)

add_subdirectory(enkf_chgres_recenter.fd)
add_subdirectory(enkf_chgres_recenter_nc.fd)
add_subdirectory(fv3nc2nemsio.fd)
add_subdirectory(regrid_nemsio.fd)
add_subdirectory(gaussian_sfcanl.fd)
add_subdirectory(gfs_bufr.fd)
add_subdirectory(reg2grb2.fd)
add_subdirectory(tocsbufr.fd)
add_subdirectory(fbwndgfs.fd)
add_subdirectory(vint.fd)
Expand Down
49 changes: 34 additions & 15 deletions sorc/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ set +x
# Anything other than "true" will use libraries locally.
#------------------------------------

_build_ufs_options=""

while getopts "ac" option;do
case $option in
a)
echo "Received -a flag, building ufs-weather-model for ATMAERO app"
echo "skipping builds not needed for prototype runs"
_build_ufs_options=-a
break
;;
c)
echo "Received -c flag, building ufs-weather-model for S2SW app"
echo "skipping builds not needed for prototype runs"
_build_ufs_options=-c
break
;;
esac
done

export USE_PREINST_LIBS="true"

#------------------------------------
Expand Down Expand Up @@ -37,28 +56,14 @@ source ./machine-setup.sh > /dev/null 2>&1
#------------------------------------
# INCLUDE PARTIAL BUILD
#------------------------------------

. ./partial_build.sh
. ./partial_build.sh $@

#------------------------------------
# Exception Handling Init
#------------------------------------
ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}
err=0

#------------------------------------
# build fv3
#------------------------------------
$Build_fv3gfs && {
echo " .... Building fv3 .... "
./build_fv3.sh > $logs_dir/build_fv3.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building fv3."
echo "The log file is in $logs_dir/build_fv3.log"
fi
((err+=$rc))
}

#------------------------------------
# build WW3 pre & post execs
Expand All @@ -74,6 +79,20 @@ fi
((err+=$rc))
}

#------------------------------------
# build forecast model
#------------------------------------
$Build_ufs_model && {
echo " .... Building forecast model .... "
./build_ufs.sh ${_build_ufs_options} > $logs_dir/build_ufs.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building UFS model."
echo "The log file is in $logs_dir/build_ufs.log"
fi
((err+=$rc))
}

#------------------------------------
# build gsi
#------------------------------------
Expand Down
28 changes: 0 additions & 28 deletions sorc/build_fv3.sh

This file was deleted.

49 changes: 49 additions & 0 deletions sorc/build_ufs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /usr/bin/env bash
set -eux

# Build ATMW by default
APP="ATMW"
CCPP_SUITES="FV3_GFS_v16,FV3_GFS_v16_RRTMGP,FV3_GFS_v16_ugwpv1"

while getopts "ac" option; do
case "${option}" in
a)
APP="ATMAERO"
CCPP_SUITES="FV3_GFS_v16,FV3_GFS_v16_ugwpv1"
shift
;;
c)
APP="S2SW"
CCPP_SUITES="FV3_GFS_v16_coupled,FV3_GFS_v16_couplednsst,FV3_GFS_v16_coupled_nsstNoahmpUGWPv1"
shift
;;
*)
echo "Unrecognized option: ${1}"
exit 1
;;
esac
done

source ./machine-setup.sh > /dev/null 2>&1
cwd=$(pwd)

# Remove previous build directory if it exists
if [ -d ufs_model.fd/build ]; then
rm -R ufs_model.fd/build
fi

# Set target platform
case "${target}" in
hera|orion|stampede)
target=${target}.intel
;;
esac

MOD_PATH=$cwd/ufs_model.fd/modulefiles

module purge

cd ufs_model.fd/
module use ${MOD_PATH}
module load ufs_${target}
CMAKE_FLAGS="-DAPP=${APP} -DCCPP_SUITES=${CCPP_SUITES}" ./build.sh
24 changes: 4 additions & 20 deletions sorc/build_workflow_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,19 @@ set -eux
readonly UTILS_DIR=$(cd "$(dirname "$($cmd -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)

# Adapt for global-workflow structure.
target=${target:-"NULL"}
source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1
modulefile=${UTILS_DIR}/../modulefiles/workflow_utils.$target
if [[ -f $modulefile ]]; then
set +x
source ${UTILS_DIR}/machine-setup.sh > /dev/null 2>&1
source $modulefile
module list
set -x
else
echo "FATAL: modulefile $modulefile not found!"
exit 1
fi
# End adaptation

# Begin hack
# In place until nceplibs-ncio is in hpc-stack and available as a module
# After nceplibs-ncio is in hpc-stack, add the following line to
# ${UTILS_DIR}/../modulefiles/workflow_utils.<platform>
# "module load ncio/<ncio-version>"
# and remove this hack

[[ -d nceplibs-ncio ]] && rm -rf nceplibs-ncio
git clone -b develop https://github.com/noaa-emc/nceplibs-ncio
cd nceplibs-ncio
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=../install ..
make -j ${BUILD_JOBS:-4} VERBOSE=${BUILD_VERBOSE:-}
make install
cd ../..
export ncio_ROOT=$PWD/nceplibs-ncio/install
# End hack

BUILD_DIR=${BUILD_DIR:-${UTILS_DIR}/build}
[[ -d $BUILD_DIR ]] && rm -rf $BUILD_DIR
mkdir -p ${BUILD_DIR}
Expand Down
Loading

0 comments on commit b4ee33a

Please sign in to comment.