-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow building of the ufs-weather-model, WW3 pre/post execs for GFS, GEFS, SFS in the same clone of global-workflow #3098
base: develop
Are you sure you want to change the base?
Changes from 7 commits
1c5b14b
98f26a8
041e7e1
e886c38
e536a3a
2a9f12b
b8eb15d
f0bf57c
3bd366a
b102c07
c26da40
8bee97c
612ef35
080186a
f8e3d6a
fc41b6d
c61ff88
200d6bd
37d1fb9
ab66442
dae774a
1d47c9e
b136b8a
ebf6176
93ad4bf
ea41c19
b5ede8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ APP="S2SWA" | |
CCPP_SUITES="FV3_GFS_v17_p8_ugwpv1,FV3_GFS_v17_coupled_p8_ugwpv1,FV3_global_nest_v1" # TODO: does the g-w need to build with all these CCPP_SUITES? | ||
PDLIB="ON" | ||
HYDRO="OFF" | ||
EXEC_NAME="ufs_model.x" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what circumstances should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can completely remove |
||
|
||
while getopts ":da:fj:vwy" option; do | ||
while getopts ":da:fj:e:vwy" option; do | ||
case "${option}" in | ||
d) BUILD_TYPE="Debug";; | ||
a) APP="${OPTARG}";; | ||
|
@@ -18,6 +19,7 @@ while getopts ":da:fj:vwy" option; do | |
v) export BUILD_VERBOSE="YES";; | ||
w) PDLIB="OFF";; | ||
y) HYDRO="ON";; | ||
e) EXEC_NAME="${OPTARG}";; | ||
:) | ||
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" | ||
;; | ||
|
@@ -40,13 +42,20 @@ if [[ ${BUILD_TYPE:-"Release"} = "DEBUG" ]] ; then | |
elif [[ "${FASTER:-OFF}" == ON ]] ; then | ||
MAKE_OPT+=" -DFASTER=ON" | ||
fi | ||
COMPILE_NR=0 | ||
|
||
case "${EXEC_NAME}" in | ||
"ufs_model.x") COMPILE_ID=0 ;; | ||
"gfs_model.x") COMPILE_ID=1 ;; | ||
"gefs_model.x") COMPILE_ID=2 ;; | ||
"sfs_model.x") COMPILE_ID=3 ;; | ||
*) echo "Unsupported executable name: ${EXEC_NAME}"; exit 1 ;; | ||
esac | ||
CLEAN_BEFORE=YES | ||
CLEAN_AFTER=NO | ||
|
||
BUILD_JOBS=${BUILD_JOBS:-8} ./tests/compile.sh "${MACHINE_ID}" "${MAKE_OPT}" "${COMPILE_NR}" "intel" "${CLEAN_BEFORE}" "${CLEAN_AFTER}" | ||
mv "./tests/fv3_${COMPILE_NR}.exe" ./tests/ufs_model.x | ||
mv "./tests/modules.fv3_${COMPILE_NR}.lua" ./tests/modules.ufs_model.lua | ||
cp "./modulefiles/ufs_common.lua" ./tests/ufs_common.lua | ||
BUILD_JOBS=${BUILD_JOBS:-8} ./tests/compile.sh "${MACHINE_ID}" "${MAKE_OPT}" "${COMPILE_ID}" "intel" "${CLEAN_BEFORE}" "${CLEAN_AFTER}" | ||
mv "./tests/fv3_${COMPILE_ID}.exe" "./tests/${EXEC_NAME}" | ||
if [[ ! -f "./tests/modules.ufs_model.lua" ]]; then mv "./tests/modules.fv3_${COMPILE_ID}.lua" "./tests/modules.ufs_model.lua"; fi | ||
if [[ ! -f "./tests/ufs_common.lua" ]]; then cp "./modulefiles/ufs_common.lua" ./tests/ufs_common.lua; fi | ||
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
exit 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,104 @@ | ||
#! /usr/bin/env bash | ||
set -x | ||
|
||
script_dir=$(dirname "${BASH_SOURCE[0]}") | ||
cd "${script_dir}" || exit 1 | ||
readonly _HOMEgfs=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}")")/.." && pwd -P) | ||
|
||
cd "${_HOMEgfs}/sorc" || exit 1 | ||
|
||
# Default settings | ||
APP="S2SWA" | ||
PDLIB="ON" | ||
|
||
while getopts ":j:a:dvw" option; do | ||
case "${option}" in | ||
a) APP="${OPTARG}";; | ||
d) BUILD_TYPE="Debug";; | ||
j) BUILD_JOBS="${OPTARG}";; | ||
v) export BUILD_VERBOSE="YES";; | ||
w) PDLIB="OFF";; | ||
:) | ||
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" | ||
usage | ||
;; | ||
*) | ||
echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}" | ||
usage | ||
;; | ||
d) BUILD_TYPE="Debug" ;; | ||
j) BUILD_JOBS="${OPTARG}" ;; | ||
v) export BUILD_VERBOSE="YES" ;; | ||
w) PDLIB="OFF" ;; | ||
:) | ||
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" | ||
usage | ||
;; | ||
*) | ||
echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}" | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
# Determine which switch to use | ||
if [[ "${APP}" == "ATMW" ]]; then | ||
ww3switch="model/esmf/switch" | ||
aerorahul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
if [[ "${PDLIB}" == "ON" ]]; then | ||
ww3switch="model/bin/switch_meshcap_pdlib" | ||
else | ||
ww3switch="model/bin/switch_meshcap" | ||
fi | ||
fi | ||
|
||
# Check final exec folder exists | ||
if [[ ! -d "../exec" ]]; then | ||
mkdir ../exec | ||
fi | ||
|
||
finalexecdir="$( pwd -P )/../exec" | ||
|
||
#Determine machine and load modules | ||
# Determine machine and load modules | ||
set +x | ||
source "${script_dir}/ufs_model.fd/tests/detect_machine.sh" | ||
source "${script_dir}/ufs_model.fd/tests/module-setup.sh" | ||
module use "${script_dir}/ufs_model.fd/modulefiles" | ||
source "${_HOMEgfs}/sorc/ufs_model.fd/tests/detect_machine.sh" | ||
source "${_HOMEgfs}/sorc/ufs_model.fd/tests/module-setup.sh" | ||
module use "${_HOMEgfs}/sorc/ufs_model.fd/modulefiles" | ||
module load "ufs_${MACHINE_ID}.intel" | ||
set -x | ||
|
||
#Set WW3 directory, switch, prep and post exes | ||
cd ufs_model.fd/WW3 || exit 1 | ||
WW3_DIR=$( pwd -P ) | ||
cd "${_HOMEgfs}/sorc/ufs_model.fd/WW3" || exit 1 | ||
WW3_DIR=$(pwd -P) | ||
export WW3_DIR | ||
export SWITCHFILE="${WW3_DIR}/${ww3switch}" | ||
|
||
# Build exes for prep jobs and post jobs: | ||
prep_exes="ww3_grid ww3_prep ww3_prnc ww3_grid" | ||
post_exes="ww3_outp ww3_outf ww3_outp ww3_gint ww3_ounf ww3_ounp ww3_grib" | ||
# Determine which switch to use | ||
if [[ "${PDLIB}" == "ON" ]]; then | ||
ww3switch="model/bin/switch_meshcap_pdlib" | ||
path_build="${WW3_DIR}/build_pdlib" | ||
path_install="${WW3_DIR}/install_pdlib" | ||
else | ||
ww3switch="model/bin/switch_meshcap" | ||
path_build="${WW3_DIR}/build" | ||
path_install="install" | ||
fi | ||
|
||
#create build directory: | ||
path_build="${WW3_DIR}/build_SHRD" | ||
[[ -d "${path_build}" ]] && rm -rf "${path_build}" | ||
mkdir -p "${path_build}" || exit 1 | ||
cd "${path_build}" || exit 1 | ||
echo "Forcing a SHRD build" | ||
aerorahul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
buildswitch="${path_build}/switch" | ||
|
||
cat "${SWITCHFILE}" > "${path_build}/tempswitch" | ||
|
||
sed -e "s/DIST/SHRD/g"\ | ||
-e "s/OMPG / /g"\ | ||
-e "s/OMPH / /g"\ | ||
-e "s/MPIT / /g"\ | ||
-e "s/MPI / /g"\ | ||
-e "s/B4B / /g"\ | ||
-e "s/PDLIB / /g"\ | ||
-e "s/SCOTCH / /g"\ | ||
-e "s/METIS / /g"\ | ||
-e "s/NOGRB/NCEP2/g"\ | ||
"${path_build}/tempswitch" > "${path_build}/switch" | ||
cat "${SWITCHFILE}" >"${path_build}/tempswitch" | ||
|
||
sed -e "s/DIST/SHRD/g" \ | ||
-e "s/OMPG / /g" \ | ||
-e "s/OMPH / /g" \ | ||
-e "s/MPIT / /g" \ | ||
-e "s/MPI / /g" \ | ||
-e "s/B4B / /g" \ | ||
-e "s/PDLIB / /g" \ | ||
-e "s/SCOTCH / /g" \ | ||
-e "s/METIS / /g" \ | ||
-e "s/NOGRB/NCEP2/g" \ | ||
"${path_build}/tempswitch" >"${path_build}/switch" | ||
rm "${path_build}/tempswitch" | ||
|
||
echo "Switch file is ${buildswitch} with switches:" | ||
cat "${buildswitch}" | ||
|
||
#define cmake build options | ||
MAKE_OPT="-DCMAKE_INSTALL_PREFIX=install" | ||
MAKE_OPT="-DCMAKE_INSTALL_PREFIX=${path_install}" | ||
[[ ${BUILD_TYPE:-"Release"} = "Debug" ]] && MAKE_OPT+=" -DCMAKE_BUILD_TYPE=Debug" | ||
|
||
#Build executables: | ||
# shellcheck disable=SC2086 | ||
cmake "${WW3_DIR}" -DSWITCH="${buildswitch}" ${MAKE_OPT} | ||
rc=$? | ||
if (( rc != 0 )); then | ||
if ((rc != 0)); then | ||
echo "Fatal error in cmake." | ||
exit "${rc}" | ||
fi | ||
|
||
make -j "${BUILD_JOBS:-8}" | ||
rc=$? | ||
if (( rc != 0 )); then | ||
if ((rc != 0)); then | ||
echo "Fatal error in make." | ||
exit "${rc}" | ||
fi | ||
|
||
make install | ||
if (( rc != 0 )); then | ||
rc=$? | ||
if ((rc != 0)); then | ||
echo "Fatal error in make install." | ||
exit "${rc}" | ||
fi | ||
|
||
# Copy to top-level exe directory | ||
for prog in ${prep_exes} ${post_exes}; do | ||
cp "${path_build}/install/bin/${prog}" "${finalexecdir}/" | ||
JessicaMeixner-NOAA marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rc=$? | ||
if (( rc != 0 )); then | ||
echo "FATAL: Unable to copy ${path_build}/${prog} to ${finalexecdir} (Error code ${rc})" | ||
exit "${rc}" | ||
fi | ||
done | ||
|
||
#clean-up build directory: | ||
echo "executables are in ${finalexecdir}" | ||
echo "cleaning up ${path_build}" | ||
rm -rf "${path_build}" | ||
|
||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SFS get its own executable or does it use the GEFS executable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, it will. For now,
SFS_POST=YES
will use thegefs
prefix.