From 0e5184dcba93977973cfadb26bd3f54b2fa545a2 Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Sat, 17 Feb 2024 12:40:40 -0700 Subject: [PATCH 01/21] Adding debug option for all build scripts. --- sorc/build_all.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index dd74c53487..f418445eca 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -16,9 +16,11 @@ function _usage() { Builds all of the global-workflow components by calling the individual build scripts in sequence. -Usage: ${BASH_SOURCE[0]} [-a UFS_app][-c build_config][-h][-j n][-v][-w] +Usage: ${BASH_SOURCE[0]} [-a UFS_app][-c build_config][-d][-h][-j n][-v][-w] -a UFS_app: Build a specific UFS app instead of the default + -d: + Build in debug mode -g: Build GSI -h: @@ -46,9 +48,10 @@ _wave_unst="" _build_job_max=20 # Reset option counter in case this script is sourced OPTIND=1 -while getopts ":a:ghj:uvw" option; do +while getopts ":a:dghj:uvw" option; do case "${option}" in a) _build_ufs_opt+="-a ${OPTARG} ";; + d) export BUILD_TYPE="DEBUG";; g) _build_gsi="YES" ;; h) _usage;; j) _build_job_max="${OPTARG} ";; @@ -115,21 +118,22 @@ declare -A build_opts # Mandatory builds, unless otherwise specified, for the UFS big_jobs=0 -build_jobs["ufs"]=8 -big_jobs=$((big_jobs+1)) -build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +#build_jobs["ufs"]=8 +#big_jobs=$((big_jobs+1)) +#build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" -build_jobs["upp"]=6 # The UPP is hardcoded to use 6 cores -build_opts["upp"]="" +#build_jobs["upp"]=6 # The UPP is hardcoded to use 6 cores +#build_opts["upp"]="" +#build_type["upp"]=${BUILD_TYPE:-"Release"} -build_jobs["ufs_utils"]=3 -build_opts["ufs_utils"]="${_verbose_opt}" +#build_jobs["ufs_utils"]=3 +#build_opts["ufs_utils"]="${_verbose_opt}" build_jobs["gfs_utils"]=1 build_opts["gfs_utils"]="${_verbose_opt}" -build_jobs["ww3prepost"]=3 -build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +#build_jobs["ww3prepost"]=3 +#build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" # Optional DA builds if [[ "${_build_ufsda}" == "YES" ]]; then @@ -160,6 +164,7 @@ fi requested_cpus=0 build_list="" for build in "${!build_jobs[@]}"; do + BUILD_TYPE=${BUILD_TYPE:-"Release"} if [[ -z "${build_list}" ]]; then build_list="${build}" else From ff4d6b9fcf51c4da228dbc0baefe1b14fa0807d1 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Sat, 17 Feb 2024 20:43:43 +0000 Subject: [PATCH 02/21] Added BUILD_TYPE support. --- sorc/build_gfs_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index 09bd4a9656..c33d63fb83 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -23,7 +23,7 @@ cwd=$(pwd) OPTIND=1 while getopts ":j:dvh" option; do case "${option}" in - d) export BUILD_TYPE="DEBUG";; + d) export BUILD_TYPE="Debug";; v) export BUILD_VERBOSE="YES";; j) export BUILD_JOBS="${OPTARG}";; h) From 553318fa9536a8c345ae215e313a3bf140e3a1cc Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Sat, 17 Feb 2024 20:54:33 +0000 Subject: [PATCH 03/21] Corrected BUILD_TYPE relative to what CMake expects. --- sorc/build_ww3prepost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index 19cdba98da..6b79557228 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -11,7 +11,7 @@ PDLIB="OFF" while getopts ":j:a:dvw" option; do case "${option}" in a) APP="${OPTARG}";; - d) BUILD_TYPE="DEBUG";; + d) BUILD_TYPE="Debug";; j) BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; w) PDLIB="ON";; From 83188dd901ee35c1610e5992f02a035910f34708 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Mon, 19 Feb 2024 18:46:26 +0000 Subject: [PATCH 04/21] CMake is case-dependent. --- sorc/build_gsi_monitor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gsi_monitor.sh b/sorc/build_gsi_monitor.sh index 3de1262aac..5ed772fb15 100755 --- a/sorc/build_gsi_monitor.sh +++ b/sorc/build_gsi_monitor.sh @@ -6,7 +6,7 @@ cwd=$(pwd) OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="DEBUG";; + d) export BUILD_TYPE="Debug";; j) export BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; :) From 029e02cb2f3ecdcca0bf6fb7115f1c841f65a9a1 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Mon, 19 Feb 2024 19:07:49 +0000 Subject: [PATCH 05/21] CMake is case-dependent. --- sorc/build_gsi_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gsi_utils.sh b/sorc/build_gsi_utils.sh index 81eab0f628..249cdff264 100755 --- a/sorc/build_gsi_utils.sh +++ b/sorc/build_gsi_utils.sh @@ -6,7 +6,7 @@ cwd=$(pwd) OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="DEBUG";; + d) export BUILD_TYPE="Debug";; j) export BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; :) From d238b4534fe84ab1b2f030e0db7645760709a45f Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Mon, 19 Feb 2024 19:36:27 +0000 Subject: [PATCH 06/21] CMake is case-dependent. --- sorc/build_gsi_enkf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gsi_enkf.sh b/sorc/build_gsi_enkf.sh index 9ba278e3ec..27198488f8 100755 --- a/sorc/build_gsi_enkf.sh +++ b/sorc/build_gsi_enkf.sh @@ -4,7 +4,7 @@ set -eux OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="DEBUG";; + d) export BUILD_TYPE="Debug";; j) export BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; :) From 549479835f8033070839f470494db3283cb771d6 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Mon, 19 Feb 2024 19:37:19 +0000 Subject: [PATCH 07/21] Bringing branch UTD with WIP. --- sorc/build_all.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index f418445eca..0e0f39177b 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -40,9 +40,11 @@ EOF script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) cd "${script_dir}" || exit 1 +BUILD_TYPE="Release" # This is the default for all applications. _build_ufs_opt="" _build_ufsda="NO" _build_gsi="NO" +_build_debug="" _verbose_opt="" _wave_unst="" _build_job_max=20 @@ -51,7 +53,9 @@ OPTIND=1 while getopts ":a:dghj:uvw" option; do case "${option}" in a) _build_ufs_opt+="-a ${OPTARG} ";; - d) export BUILD_TYPE="DEBUG";; + d) _build_debug="-d" + export BUILD_TYPE="Debug" + ;; g) _build_gsi="YES" ;; h) _usage;; j) _build_job_max="${OPTARG} ";; @@ -118,19 +122,21 @@ declare -A build_opts # Mandatory builds, unless otherwise specified, for the UFS big_jobs=0 -#build_jobs["ufs"]=8 -#big_jobs=$((big_jobs+1)) -#build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +build_jobs["ufs"]=8 +big_jobs=$((big_jobs+1)) +build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +# TODO: Done #build_jobs["upp"]=6 # The UPP is hardcoded to use 6 cores -#build_opts["upp"]="" -#build_type["upp"]=${BUILD_TYPE:-"Release"} +#build_opts["upp"]="${_build_debug}" +# TODO: Done #build_jobs["ufs_utils"]=3 -#build_opts["ufs_utils"]="${_verbose_opt}" +#build_opts["ufs_utils"]="${_verbose_opt}" -build_jobs["gfs_utils"]=1 -build_opts["gfs_utils"]="${_verbose_opt}" +# TODO: Done +#build_jobs["gfs_utils"]=1 +#build_opts["gfs_utils"]="${_verbose_opt}" #build_jobs["ww3prepost"]=3 #build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" From ab6b521edebfd2f8ae6067e30e318aaf30eff7a5 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Tue, 20 Feb 2024 18:05:56 +0000 Subject: [PATCH 08/21] Update for CMake to pick up debug option. --- sorc/build_ufs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_ufs.sh b/sorc/build_ufs.sh index 24ee8c5f13..2581a981d3 100755 --- a/sorc/build_ufs.sh +++ b/sorc/build_ufs.sh @@ -30,7 +30,7 @@ source "./tests/module-setup.sh" MAKE_OPT="-DAPP=${APP} -D32BIT=ON -DCCPP_SUITES=${CCPP_SUITES}" [[ ${PDLIB:-"OFF"} = "ON" ]] && MAKE_OPT+=" -DPDLIB=ON" -[[ ${BUILD_TYPE:-"Release"} = "DEBUG" ]] && MAKE_OPT+=" -DDEBUG=ON" +[[ ${BUILD_TYPE:-"Release"} = "Debug" ]] && MAKE_OPT+=" -DDEBUG=ON" COMPILE_NR=0 CLEAN_BEFORE=YES CLEAN_AFTER=NO From 36c304de35cd97a040b1f98361b5c75d9efca84c Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Wed, 21 Feb 2024 10:47:30 -0700 Subject: [PATCH 09/21] Removed left over debugging comments. --- sorc/build_all.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index 0e0f39177b..3b522e174e 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -126,20 +126,17 @@ build_jobs["ufs"]=8 big_jobs=$((big_jobs+1)) build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" -# TODO: Done -#build_jobs["upp"]=6 # The UPP is hardcoded to use 6 cores -#build_opts["upp"]="${_build_debug}" +build_jobs["upp"]=6 # The UPP is hardcoded to use 6 cores +build_opts["upp"]="${_build_debug}" -# TODO: Done -#build_jobs["ufs_utils"]=3 -#build_opts["ufs_utils"]="${_verbose_opt}" +build_jobs["ufs_utils"]=3 +build_opts["ufs_utils"]="${_verbose_opt}" -# TODO: Done -#build_jobs["gfs_utils"]=1 -#build_opts["gfs_utils"]="${_verbose_opt}" +build_jobs["gfs_utils"]=1 +build_opts["gfs_utils"]="${_verbose_opt}" -#build_jobs["ww3prepost"]=3 -#build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +build_jobs["ww3prepost"]=3 +build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" # Optional DA builds if [[ "${_build_ufsda}" == "YES" ]]; then From 20a8c163ecedc81a023ff9fd369c14d597c45e08 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Fri, 23 Feb 2024 16:16:29 +0000 Subject: [PATCH 10/21] Updates for gsi_monitor.fd. --- sorc/gsi_monitor.fd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/gsi_monitor.fd b/sorc/gsi_monitor.fd index ae256c0d69..4e0f72b8f6 160000 --- a/sorc/gsi_monitor.fd +++ b/sorc/gsi_monitor.fd @@ -1 +1 @@ -Subproject commit ae256c0d69df3232ee9dd3e81b176bf2c3cda312 +Subproject commit 4e0f72b8f6117d278c1414de8cb265cb2f41145d From 8bc2b205b6c1f42b6da5097255937433b4566da5 Mon Sep 17 00:00:00 2001 From: "Henry R. Winterbottom" <49202169+HenryWinterbottom-NOAA@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:49:49 -0700 Subject: [PATCH 11/21] Update build_ww3prepost.sh Reverted this change as it is beyond the scope of the PR. --- sorc/build_ww3prepost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index 6b79557228..19cdba98da 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -11,7 +11,7 @@ PDLIB="OFF" while getopts ":j:a:dvw" option; do case "${option}" in a) APP="${OPTARG}";; - d) BUILD_TYPE="Debug";; + d) BUILD_TYPE="DEBUG";; j) BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; w) PDLIB="ON";; From b815bed15190e52aa68cf21148e9a3eb5184504d Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Fri, 23 Feb 2024 14:42:34 -0700 Subject: [PATCH 12/21] Case correction. --- sorc/build_ww3prepost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index 19cdba98da..6b79557228 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -11,7 +11,7 @@ PDLIB="OFF" while getopts ":j:a:dvw" option; do case "${option}" in a) APP="${OPTARG}";; - d) BUILD_TYPE="DEBUG";; + d) BUILD_TYPE="Debug";; j) BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; w) PDLIB="ON";; From 69b8fa7b338798ee81061a9275e337014c778fa4 Mon Sep 17 00:00:00 2001 From: henrywinterbottom-wxdev Date: Mon, 26 Feb 2024 09:02:54 -0700 Subject: [PATCH 13/21] David Huber suggested updates. --- sorc/build_ww3prepost.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index 6b79557228..acbecf2fe1 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -91,9 +91,10 @@ cat "${buildswitch}" #define cmake build options MAKE_OPT="-DCMAKE_INSTALL_PREFIX=install" -[[ ${BUILD_TYPE:-"Release"} = "DEBUG" ]] && MAKE_OPT+=" -DDEBUG=ON" +[[ ${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 From 8d36d0cdb8ff732823180065d885a7bb2e9874ea Mon Sep 17 00:00:00 2001 From: "Henry R. Winterbottom" <49202169+HenryWinterbottom-NOAA@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:10:11 -0700 Subject: [PATCH 14/21] Update sorc/build_ww3prepost.sh Thank you, Dave. Co-authored-by: David Huber <69919478+DavidHuber-NOAA@users.noreply.github.com> --- sorc/build_ww3prepost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index acbecf2fe1..4b9e2ef265 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -95,7 +95,7 @@ MAKE_OPT="-DCMAKE_INSTALL_PREFIX=install" #Build executables: # shellcheck disable=SC2086 -cmake "${WW3_DIR}" -DSWITCH="${buildswitch}" "${MAKE_OPT}" +cmake "${WW3_DIR}" -DSWITCH="${buildswitch}" ${MAKE_OPT} rc=$? if (( rc != 0 )); then echo "Fatal error in cmake." From 58d5470b9c125f65f637de9144c01dbb656a8b29 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Thu, 29 Feb 2024 17:15:54 +0000 Subject: [PATCH 15/21] Update requested by reviewer. --- sorc/build_all.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index 500f49ba15..8a453ac21e 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -53,9 +53,9 @@ OPTIND=1 while getopts ":a:dghj:uvw" option; do case "${option}" in a) _build_ufs_opt+="-a ${OPTARG} ";; - d) _build_debug="-d" - export BUILD_TYPE="Debug" - ;; + d) _build_debug="-d" ;; +# export BUILD_TYPE="Debug" +# ;; g) _build_gsi="YES" ;; h) _usage;; j) _build_job_max="${OPTARG} ";; @@ -167,7 +167,6 @@ fi requested_cpus=0 build_list="" for build in "${!build_jobs[@]}"; do - BUILD_TYPE=${BUILD_TYPE:-"Release"} if [[ -z "${build_list}" ]]; then build_list="${build}" else From a6a4f6b6dc3c0304e26c675f36b8091caf7bbbf7 Mon Sep 17 00:00:00 2001 From: HenryWinterbottom-NOAA Date: Thu, 29 Feb 2024 18:13:53 +0000 Subject: [PATCH 16/21] Committing prior to clean clone and build. --- sorc/build_all.sh | 18 +++++++++--------- sorc/build_gdas.sh | 2 +- sorc/build_ufs.sh | 2 +- sorc/build_ufs_utils.sh | 1 + sorc/build_upp.sh | 3 ++- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index 8a453ac21e..bb3f5964b3 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -124,19 +124,19 @@ declare -A build_opts big_jobs=0 build_jobs["ufs"]=8 big_jobs=$((big_jobs+1)) -build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +build_opts["ufs"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt} ${_build_debug}" build_jobs["upp"]=2 -build_opts["upp"]="" +build_opts["upp"]="${_build_debug}" build_jobs["ufs_utils"]=2 -build_opts["ufs_utils"]="${_verbose_opt}" +build_opts["ufs_utils"]="${_verbose_opt} ${_build_debug}" build_jobs["gfs_utils"]=1 -build_opts["gfs_utils"]="${_verbose_opt}" +build_opts["gfs_utils"]="${_verbose_opt} ${_build_debug}" build_jobs["ww3prepost"]=2 -build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt}" +build_opts["ww3prepost"]="${_wave_unst} ${_verbose_opt} ${_build_ufs_opt} ${_build_debug}" # Optional DA builds if [[ "${_build_ufsda}" == "YES" ]]; then @@ -145,21 +145,21 @@ if [[ "${_build_ufsda}" == "YES" ]]; then else build_jobs["gdas"]=8 big_jobs=$((big_jobs+1)) - build_opts["gdas"]="${_verbose_opt}" + build_opts["gdas"]="${_verbose_opt} ${_build_debug}" fi fi if [[ "${_build_gsi}" == "YES" ]]; then build_jobs["gsi_enkf"]=8 - build_opts["gsi_enkf"]="${_verbose_opt}" + build_opts["gsi_enkf"]="${_verbose_opt} ${_build_debug}" fi if [[ "${_build_gsi}" == "YES" || "${_build_ufsda}" == "YES" ]] ; then build_jobs["gsi_utils"]=1 - build_opts["gsi_utils"]="${_verbose_opt}" + build_opts["gsi_utils"]="${_verbose_opt} ${_build_debug}" if [[ "${MACHINE_ID}" == "hercules" ]]; then echo "NOTE: The GSI Monitor is not supported on Hercules. Disabling build." else build_jobs["gsi_monitor"]=1 - build_opts["gsi_monitor"]="${_verbose_opt}" + build_opts["gsi_monitor"]="${_verbose_opt} ${_build_debug}" fi fi diff --git a/sorc/build_gdas.sh b/sorc/build_gdas.sh index b1a17c33dd..3b885079a4 100755 --- a/sorc/build_gdas.sh +++ b/sorc/build_gdas.sh @@ -4,7 +4,7 @@ set -eux OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="DEBUG";; + d) export BUILD_TYPE="Debug";; j) export BUILD_JOBS=${OPTARG};; v) export BUILD_VERBOSE="YES";; :) diff --git a/sorc/build_ufs.sh b/sorc/build_ufs.sh index 2581a981d3..d18dbef9fa 100755 --- a/sorc/build_ufs.sh +++ b/sorc/build_ufs.sh @@ -9,7 +9,7 @@ CCPP_SUITES="FV3_GFS_v17_p8_ugwpv1,FV3_GFS_v17_coupled_p8_ugwpv1" # TODO: does while getopts ":da:j:vw" option; do case "${option}" in - d) BUILD_TYPE="DEBUG";; + d) BUILD_TYPE="Debug";; a) APP="${OPTARG}";; j) BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; diff --git a/sorc/build_ufs_utils.sh b/sorc/build_ufs_utils.sh index e78ca3c180..fe38e16670 100755 --- a/sorc/build_ufs_utils.sh +++ b/sorc/build_ufs_utils.sh @@ -4,6 +4,7 @@ set -eux OPTIND=1 while getopts ":j:dv" option; do case "${option}" in + d) export BUILD_TYPE="Debug" ;; j) export BUILD_JOBS="${OPTARG}";; v) export BUILD_VERBOSE="YES";; :) diff --git a/sorc/build_upp.sh b/sorc/build_upp.sh index 8a2e1f6fcd..7d2e2b9175 100755 --- a/sorc/build_upp.sh +++ b/sorc/build_upp.sh @@ -8,7 +8,8 @@ OPTIND=1 _opts="" while getopts ":dj:v" option; do case "${option}" in - d) _opts+="-d ";; + d) _opts+="-d " + export BUILD_TYPE="Debug" ;; j) export BUILD_JOBS="${OPTARG}" ;; v) _opts+="-v ";; :) From fe4460938d4161e16413819c98c7682aa6219ab0 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 29 Feb 2024 16:26:07 -0500 Subject: [PATCH 17/21] patch on HWs pr --- sorc/build_all.sh | 38 ++++++++++++++++++++------------------ sorc/build_gdas.sh | 13 +++++-------- sorc/build_gfs_utils.sh | 10 ++++------ sorc/build_gsi_enkf.sh | 6 +++--- sorc/build_gsi_monitor.sh | 10 ++++------ sorc/build_gsi_utils.sh | 10 ++++------ sorc/build_ufs_utils.sh | 12 +++++------- sorc/build_upp.sh | 25 ++++++++++++------------- sorc/build_ww3prepost.sh | 16 ++++++++-------- ush/module-setup.sh | 4 ++-- 10 files changed, 67 insertions(+), 77 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index bb3f5964b3..ddc3c60450 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -31,16 +31,16 @@ Usage: ${BASH_SOURCE[0]} [-a UFS_app][-c build_config][-d][-h][-j n][-v][-w] Build UFS-DA -v: Execute all build scripts with -v option to turn on verbose where supported - -w: - Use unstructured wave grid + -w: + Use unstructured wave grid EOF exit 1 } -script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) -cd "${script_dir}" || exit 1 +# shellcheck disable=SC2155 +readonly HOMEgfs=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )/.." && pwd -P) +cd "${HOMEgfs}/sorc" || exit 1 -BUILD_TYPE="Release" # This is the default for all applications. _build_ufs_opt="" _build_ufsda="NO" _build_gsi="NO" @@ -54,8 +54,6 @@ while getopts ":a:dghj:uvw" option; do case "${option}" in a) _build_ufs_opt+="-a ${OPTARG} ";; d) _build_debug="-d" ;; -# export BUILD_TYPE="Debug" -# ;; g) _build_gsi="YES" ;; h) _usage;; j) _build_job_max="${OPTARG} ";; @@ -75,24 +73,24 @@ done shift $((OPTIND-1)) -logs_dir="${script_dir}/logs" +logs_dir="${HOMEgfs}/sorc/logs" if [[ ! -d "${logs_dir}" ]]; then echo "Creating logs folder" - mkdir "${logs_dir}" || exit 1 + mkdir -p "${logs_dir}" || exit 1 fi # Check final exec folder exists -if [[ ! -d "../exec" ]]; then - echo "Creating ../exec folder" - mkdir ../exec +if [[ ! -d "${HOMEgfs}/exec" ]]; then + echo "Creating ${HOMEgfs}/exec folder" + mkdir -p "${HOMEgfs}/exec" fi #------------------------------------ # GET MACHINE #------------------------------------ export COMPILER="intel" -source gfs_utils.fd/ush/detect_machine.sh -source gfs_utils.fd/ush/module-setup.sh +source ${HOMEgfs}/ush/detect_machine.sh +source ${HOMEgfs}/ush/module-setup.sh if [[ -z "${MACHINE_ID}" ]]; then echo "FATAL: Unable to determine target machine" exit 1 @@ -203,12 +201,16 @@ while [[ ${builds_started} -lt ${#build_jobs[@]} ]]; do if [[ -n "${build_jobs[${build}]+0}" && -z "${build_ids[${build}]+0}" ]]; then # Do we have enough processors to run it? if [[ ${_build_job_max} -ge $(( build_jobs[build] + procs_in_use )) ]]; then - if [[ "${build}" != "upp" ]]; then - "./build_${build}.sh" -j "${build_jobs[${build}]}" "${build_opts[${build}]:-}" > \ - "${logs_dir}/build_${build}.log" 2>&1 & - else + if [[ "${build}" == "upp" ]]; then + set -x "./build_${build}.sh" "${build_opts[${build}]}" > \ "${logs_dir}/build_${build}.log" 2>&1 & + set +x + else # upp + set -x + "./build_${build}.sh" ${build_opts[${build}]:-} -j "${build_jobs[${build}]}" > \ + "${logs_dir}/build_${build}.log" 2>&1 & + set +x fi build_ids["${build}"]=$! echo "Starting build_${build}.sh" diff --git a/sorc/build_gdas.sh b/sorc/build_gdas.sh index 3b885079a4..a52a4411c5 100755 --- a/sorc/build_gdas.sh +++ b/sorc/build_gdas.sh @@ -2,11 +2,12 @@ set -eux OPTIND=1 +_opts="-f " # forces a clean build while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="Debug";; - j) export BUILD_JOBS=${OPTARG};; - v) export BUILD_VERBOSE="YES";; + d) _opts+="-c -DCMAKE_BUILD_TYPE=Debug" ;; + j) BUILD_JOBS=${OPTARG};; + v) _opts+="-v ";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -19,12 +20,8 @@ while getopts ":j:dv" option; do done shift $((OPTIND-1)) -# TODO: GDASApp does not presently handle BUILD_TYPE - -BUILD_TYPE=${BUILD_TYPE:-"Release"} \ -BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ BUILD_JOBS="${BUILD_JOBS:-8}" \ WORKFLOW_BUILD="ON" \ -./gdas.cd/build.sh +./gdas.cd/build.sh ${_opts} exit diff --git a/sorc/build_gfs_utils.sh b/sorc/build_gfs_utils.sh index c33d63fb83..e53f71ddcd 100755 --- a/sorc/build_gfs_utils.sh +++ b/sorc/build_gfs_utils.sh @@ -18,14 +18,12 @@ EOF exit 1 } -cwd=$(pwd) - OPTIND=1 while getopts ":j:dvh" option; do case "${option}" in - d) export BUILD_TYPE="Debug";; - v) export BUILD_VERBOSE="YES";; - j) export BUILD_JOBS="${OPTARG}";; + d) BUILD_TYPE="Debug";; + v) BUILD_VERBOSE="YES";; + j) BUILD_JOBS="${OPTARG}";; h) usage ;; @@ -44,6 +42,6 @@ shift $((OPTIND-1)) BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ BUILD_JOBS=${BUILD_JOBS:-8} \ -"${cwd}/gfs_utils.fd/ush/build.sh" +"./gfs_utils.fd/ush/build.sh" exit diff --git a/sorc/build_gsi_enkf.sh b/sorc/build_gsi_enkf.sh index 27198488f8..ba24cefa81 100755 --- a/sorc/build_gsi_enkf.sh +++ b/sorc/build_gsi_enkf.sh @@ -4,9 +4,9 @@ set -eux OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="Debug";; - j) export BUILD_JOBS="${OPTARG}";; - v) export BUILD_VERBOSE="YES";; + d) BUILD_TYPE="Debug";; + j) BUILD_JOBS="${OPTARG}";; + v) BUILD_VERBOSE="YES";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage diff --git a/sorc/build_gsi_monitor.sh b/sorc/build_gsi_monitor.sh index 5ed772fb15..31add1882a 100755 --- a/sorc/build_gsi_monitor.sh +++ b/sorc/build_gsi_monitor.sh @@ -1,14 +1,12 @@ #! /usr/bin/env bash set -eux -cwd=$(pwd) - OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="Debug";; - j) export BUILD_JOBS="${OPTARG}";; - v) export BUILD_VERBOSE="YES";; + d) BUILD_TYPE="Debug";; + j) BUILD_JOBS="${OPTARG}";; + v) BUILD_VERBOSE="YES";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -24,6 +22,6 @@ shift $((OPTIND-1)) BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ BUILD_JOBS=${BUILD_JOBS:-8} \ -"${cwd}/gsi_monitor.fd/ush/build.sh" +"./gsi_monitor.fd/ush/build.sh" exit diff --git a/sorc/build_gsi_utils.sh b/sorc/build_gsi_utils.sh index 249cdff264..58c64e6e4a 100755 --- a/sorc/build_gsi_utils.sh +++ b/sorc/build_gsi_utils.sh @@ -1,14 +1,12 @@ #! /usr/bin/env bash set -eux -cwd=$(pwd) - OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="Debug";; - j) export BUILD_JOBS="${OPTARG}";; - v) export BUILD_VERBOSE="YES";; + d) BUILD_TYPE="Debug";; + j) BUILD_JOBS="${OPTARG}";; + v) BUILD_VERBOSE="YES";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -25,6 +23,6 @@ BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_VERBOSE=${BUILD_VERBOSE:-"NO"} \ BUILD_JOBS=${BUILD_JOBS:-8} \ UTIL_OPTS="-DBUILD_UTIL_ENKF_GFS=ON -DBUILD_UTIL_NCIO=ON" \ -"${cwd}/gsi_utils.fd/ush/build.sh" +"./gsi_utils.fd/ush/build.sh" exit diff --git a/sorc/build_ufs_utils.sh b/sorc/build_ufs_utils.sh index fe38e16670..63ec56cb41 100755 --- a/sorc/build_ufs_utils.sh +++ b/sorc/build_ufs_utils.sh @@ -4,9 +4,9 @@ set -eux OPTIND=1 while getopts ":j:dv" option; do case "${option}" in - d) export BUILD_TYPE="Debug" ;; - j) export BUILD_JOBS="${OPTARG}";; - v) export BUILD_VERBOSE="YES";; + d) BUILD_TYPE="Debug" ;; + j) BUILD_JOBS="${OPTARG}";; + v) BUILD_VERBOSE="YES";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -19,13 +19,11 @@ while getopts ":j:dv" option; do done shift $((OPTIND-1)) -script_dir=$(dirname "${BASH_SOURCE[0]}") -cd "${script_dir}/ufs_utils.fd" || exit 1 - CMAKE_OPTS="-DGFS=ON" \ +BUILD_TYPE=${BUILD_TYPE:-"Release"} \ BUILD_JOBS=${BUILD_JOBS:-8} \ BUILD_VERBOSE=${BUILD_VERBOSE:-} \ -./build_all.sh +./ufs_utils.fd/build_all.sh exit diff --git a/sorc/build_upp.sh b/sorc/build_upp.sh index 7d2e2b9175..e217e171db 100755 --- a/sorc/build_upp.sh +++ b/sorc/build_upp.sh @@ -7,24 +7,23 @@ cd "${script_dir}" || exit 1 OPTIND=1 _opts="" while getopts ":dj:v" option; do - case "${option}" in - d) _opts+="-d " - export BUILD_TYPE="Debug" ;; - j) export BUILD_JOBS="${OPTARG}" ;; - v) _opts+="-v ";; - :) - echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" - ;; - *) - echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}" - ;; - esac + case "${option}" in + d) _opts+="-d " ;; + j) BUILD_JOBS="${OPTARG}" ;; + v) _opts+="-v ";; + :) + echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" + ;; + *) + echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}" + ;; + esac done shift $((OPTIND-1)) # Check final exec folder exists if [[ ! -d "../exec" ]]; then - mkdir ../exec + mkdir -p ../exec fi cd ufs_model.fd/FV3/upp/tests diff --git a/sorc/build_ww3prepost.sh b/sorc/build_ww3prepost.sh index 4b9e2ef265..5b527a1641 100755 --- a/sorc/build_ww3prepost.sh +++ b/sorc/build_ww3prepost.sh @@ -6,7 +6,7 @@ cd "${script_dir}" || exit 1 # Default settings APP="S2SWA" -PDLIB="OFF" +PDLIB="OFF" while getopts ":j:a:dvw" option; do case "${option}" in @@ -27,15 +27,15 @@ while getopts ":j:a:dvw" option; do done # Determine which switch to use -if [[ "${APP}" == "ATMW" ]]; then +if [[ "${APP}" == "ATMW" ]]; then ww3switch="model/esmf/switch" -else - if [[ "${PDLIB}" == "ON" ]]; then +else + if [[ "${PDLIB}" == "ON" ]]; then ww3switch="model/bin/switch_meshcap_pdlib" - else + else ww3switch="model/bin/switch_meshcap" - fi -fi + fi +fi # Check final exec folder exists if [[ ! -d "../exec" ]]; then @@ -86,7 +86,7 @@ sed -e "s/DIST/SHRD/g"\ "${path_build}/tempswitch" > "${path_build}/switch" rm "${path_build}/tempswitch" -echo "Switch file is ${buildswitch} with switches:" +echo "Switch file is ${buildswitch} with switches:" cat "${buildswitch}" #define cmake build options diff --git a/ush/module-setup.sh b/ush/module-setup.sh index e204bae8a2..008ef7ee97 100755 --- a/ush/module-setup.sh +++ b/ush/module-setup.sh @@ -1,7 +1,7 @@ #!/bin/bash set -u -source "${HOMEgfs}/ush/detect_machine.sh" +source "${HOMEgfs}/ush/detect_machine.sh" if [[ ${MACHINE_ID} = jet* ]] ; then # We are on NOAA Jet @@ -125,7 +125,7 @@ elif [[ ${MACHINE_ID} = "noaacloud" ]]; then export SPACK_ROOT=/contrib/global-workflow/spack-stack/spack export PATH=${PATH}:${SPACK_ROOT}/bin . "${SPACK_ROOT}"/share/spack/setup-env.sh - + else echo WARNING: UNKNOWN PLATFORM 1>&2 fi From 0abcd83d180a74607486d59a7fda50a078094555 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 1 Mar 2024 09:34:11 -0500 Subject: [PATCH 18/21] apply shellcheck fixes --- sorc/build_all.sh | 12 +++++------- sorc/build_gdas.sh | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index ddc3c60450..7d1a625be0 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -89,8 +89,8 @@ fi # GET MACHINE #------------------------------------ export COMPILER="intel" -source ${HOMEgfs}/ush/detect_machine.sh -source ${HOMEgfs}/ush/module-setup.sh +source "${HOMEgfs}/ush/detect_machine.sh" +source "${HOMEgfs}/ush/module-setup.sh" if [[ -z "${MACHINE_ID}" ]]; then echo "FATAL: Unable to determine target machine" exit 1 @@ -202,15 +202,13 @@ while [[ ${builds_started} -lt ${#build_jobs[@]} ]]; do # Do we have enough processors to run it? if [[ ${_build_job_max} -ge $(( build_jobs[build] + procs_in_use )) ]]; then if [[ "${build}" == "upp" ]]; then - set -x "./build_${build}.sh" "${build_opts[${build}]}" > \ "${logs_dir}/build_${build}.log" 2>&1 & - set +x - else # upp - set -x + else # not upp + # double-quoting build_opts here will not work since it is a string of options + #shellcheck disable=SC2086 "./build_${build}.sh" ${build_opts[${build}]:-} -j "${build_jobs[${build}]}" > \ "${logs_dir}/build_${build}.log" 2>&1 & - set +x fi build_ids["${build}"]=$! echo "Starting build_${build}.sh" diff --git a/sorc/build_gdas.sh b/sorc/build_gdas.sh index a52a4411c5..80b66dcb34 100755 --- a/sorc/build_gdas.sh +++ b/sorc/build_gdas.sh @@ -20,6 +20,8 @@ while getopts ":j:dv" option; do done shift $((OPTIND-1)) +# double quoting opts will not work since it is a string of options +# shellcheck disable=SC2086 BUILD_JOBS="${BUILD_JOBS:-8}" \ WORKFLOW_BUILD="ON" \ ./gdas.cd/build.sh ${_opts} From bd84a8dd5e2ef498df17827740e5538e2ae6024d Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 1 Mar 2024 12:32:27 -0500 Subject: [PATCH 19/21] Update sorc/build_all.sh to eliminate upp special handling. Co-authored-by: David Huber <69919478+DavidHuber-NOAA@users.noreply.github.com> --- sorc/build_all.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sorc/build_all.sh b/sorc/build_all.sh index 7d1a625be0..3de13b7b60 100755 --- a/sorc/build_all.sh +++ b/sorc/build_all.sh @@ -201,15 +201,10 @@ while [[ ${builds_started} -lt ${#build_jobs[@]} ]]; do if [[ -n "${build_jobs[${build}]+0}" && -z "${build_ids[${build}]+0}" ]]; then # Do we have enough processors to run it? if [[ ${_build_job_max} -ge $(( build_jobs[build] + procs_in_use )) ]]; then - if [[ "${build}" == "upp" ]]; then - "./build_${build}.sh" "${build_opts[${build}]}" > \ - "${logs_dir}/build_${build}.log" 2>&1 & - else # not upp - # double-quoting build_opts here will not work since it is a string of options - #shellcheck disable=SC2086 - "./build_${build}.sh" ${build_opts[${build}]:-} -j "${build_jobs[${build}]}" > \ - "${logs_dir}/build_${build}.log" 2>&1 & - fi + # double-quoting build_opts here will not work since it is a string of options + #shellcheck disable=SC2086 + "./build_${build}.sh" ${build_opts[${build}]:-} -j "${build_jobs[${build}]}" > \ + "${logs_dir}/build_${build}.log" 2>&1 & build_ids["${build}"]=$! echo "Starting build_${build}.sh" procs_in_use=$(( procs_in_use + build_jobs[${build}] )) From 835ff69c904c9d1e5c543ea520aeba49789ca60a Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 1 Mar 2024 14:26:47 -0500 Subject: [PATCH 20/21] Update sorc/build_gdas.sh to add trailing space. --- sorc/build_gdas.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gdas.sh b/sorc/build_gdas.sh index 80b66dcb34..c95495981c 100755 --- a/sorc/build_gdas.sh +++ b/sorc/build_gdas.sh @@ -5,7 +5,7 @@ OPTIND=1 _opts="-f " # forces a clean build while getopts ":j:dv" option; do case "${option}" in - d) _opts+="-c -DCMAKE_BUILD_TYPE=Debug" ;; + d) _opts+="-c -DCMAKE_BUILD_TYPE=Debug " ;; j) BUILD_JOBS=${OPTARG};; v) _opts+="-v ";; :) From f6b1d6fee7ab202f0cfd0143c7d76eed98614ed4 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 1 Mar 2024 14:31:28 -0500 Subject: [PATCH 21/21] Update sorc/build_gdas.sh to force clean build directory with every invocation --- sorc/build_gdas.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/build_gdas.sh b/sorc/build_gdas.sh index c95495981c..43c503ab4d 100755 --- a/sorc/build_gdas.sh +++ b/sorc/build_gdas.sh @@ -24,6 +24,6 @@ shift $((OPTIND-1)) # shellcheck disable=SC2086 BUILD_JOBS="${BUILD_JOBS:-8}" \ WORKFLOW_BUILD="ON" \ -./gdas.cd/build.sh ${_opts} +./gdas.cd/build.sh ${_opts} -f exit