Skip to content

Commit

Permalink
update the build.sh script (#167)
Browse files Browse the repository at this point in the history
1. Removal of `-t` option to build for specified machine (we now use`ush/detech_machine.sh` to automatically do this)
2. Removal of `ADD_RRFS_TESTS` cmake option since we always want to build these tests in RDASApp
3. Addition of `-x` option to toggle building the super executables (use `-x` to build them; default is to not build them)
4. Addition of `-j` option to specify number of build tasks (default is 4 on Orion, 6 on other supported machines)
  • Loading branch information
SamuelDegelia-NOAA authored Sep 14, 2024
1 parent 1f02518 commit 04b5139
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
32 changes: 17 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ usage() {
echo "Usage: $0 -p <prefix> | -t <target> -h"
echo
echo " -p installation prefix <prefix> DEFAULT: <none>"
echo " -t target to build for <target> DEFAULT: $MACHINE_ID"
echo " -c additional CMake options DEFAULT: <none>"
echo " -v build with verbose output DEFAULT: NO"
echo " -j number of build jobs DEFAULT: 4 on Orion, 6 on other machines"
echo " -f force a clean build DEFAULT: NO"
echo " -s only build a subset of the bundle DEFAULT: NO"
echo " -m select dycore DEFAULT: FV3andMPAS"
echo " -x build super executables DEFAULT: NO"
echo " -h display this message and quit"
echo
exit 1
Expand All @@ -37,26 +38,26 @@ INSTALL_PREFIX=""
CMAKE_OPTS=""
BUILD_TARGET="${MACHINE_ID:-'localhost'}"
BUILD_VERBOSE="NO"
ADD_RRFS_TESTS="YES"
CLEAN_BUILD="NO"
BUILD_JCSDA="YES"
BUILD_SUPER_EXE="NO"
DYCORE="FV3andMPAS"
COMPILER="${COMPILER:-intel}"

while getopts "p:t:c:m:hvfs-:" opt; do
while getopts "p:c:m:j:hvfsx" opt; do
case $opt in
p)
INSTALL_PREFIX=$OPTARG
;;
t)
BUILD_TARGET=$OPTARG
;;
c)
CMAKE_OPTS=$OPTARG
;;
m)
DYCORE=$OPTARG
;;
j)
BUILD_JOBS=$OPTARG
;;
v)
BUILD_VERBOSE=YES
;;
Expand All @@ -66,6 +67,9 @@ while getopts "p:t:c:m:hvfs-:" opt; do
s)
BUILD_JCSDA=NO
;;
x)
BUILD_SUPER_EXE=YES
;;
h|\?|:)
usage
;;
Expand All @@ -88,7 +92,12 @@ case ${BUILD_TARGET} in
;;
esac

CMAKE_OPTS+=" -DADD_RRFS_TESTS=$ADD_RRFS_TESTS"
# Set default number of build jobs based on machine
if [[ $BUILD_TARGET == 'orion' ]]; then # lower due to memory limit on login nodes
BUILD_JOBS=${BUILD_JOBS:-4}
else # hera, hercules, jet
BUILD_JOBS=${BUILD_JOBS:-6}
fi

BUILD_DIR=${BUILD_DIR:-$dir_root/build}
if [[ $CLEAN_BUILD == 'YES' ]]; then
Expand Down Expand Up @@ -137,14 +146,7 @@ if [[ $DYCORE == 'MPAS' || $DYCORE == 'FV3andMPAS' ]]; then
$dir_root/rrfs-test/scripts/link_mpasjedi_expr.sh
fi

# Set lower number of build jobs on Orion due to memory limit on login nodes
if [[ $BUILD_TARGET == 'orion' ]]; then
BUILD_JOBS=${BUILD_JOBS:-4}
else # hera, hercules, jet
BUILD_JOBS=${BUILD_JOBS:-6}
fi

CMAKE_OPTS+=" -DMPIEXEC_MAX_NUMPROCS:STRING=120"
CMAKE_OPTS+=" -DMPIEXEC_MAX_NUMPROCS:STRING=120 -DBUILD_SUPER_EXE=$BUILD_SUPER_EXE"
# Configure
echo "Configuring ..."
set -x
Expand Down
11 changes: 5 additions & 6 deletions bundle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ endif()
ecbuild_bundle( PROJECT iodaconv SOURCE "../sorc/iodaconv" )
endif()

# rdas mega executable
ecbuild_bundle( PROJECT rdas SOURCE "../mains" )

if(ADD_RRFS_TESTS)
ecbuild_bundle( PROJECT rrfs-test SOURCE "../rrfs-test" )
endif(ADD_RRFS_TESTS)
# rdas tests and super executables
ecbuild_bundle( PROJECT rrfs-test SOURCE "../rrfs-test" )
if(BUILD_SUPER_EXE)
ecbuild_bundle( PROJECT rdas SOURCE "../mains" )
endif()

endif(BUILD_RDASBUNDLE)

Expand Down
10 changes: 4 additions & 6 deletions rrfs-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ add_to_dictionary(rrfs_mpasjedi_tests "rrfs_mpasjedi_2024052700_letkf" "mpasj
add_to_dictionary(rrfs_mpasjedi_tests "rrfs_mpasjedi_2024052700_getkf" "mpasjedi_enkf.x")
add_to_dictionary(rrfs_mpasjedi_tests "rrfs_mpasjedi_2024052700_bumploc" "mpasjedi_error_covariance_toolbox.x")

if (ADD_RRFS_TESTS)
message(STATUS "Use test data from rrfs-test-data repository")
set (rrfs-test_data_local "${CMAKE_SOURCE_DIR}/rrfs-test-data/")
set (src_yaml "${CMAKE_SOURCE_DIR}/rrfs-test/testinput")
message(STATUS "Use test data from rrfs-test-data repository")
set (rrfs-test_data_local "${CMAKE_SOURCE_DIR}/rrfs-test-data/")
set (src_yaml "${CMAKE_SOURCE_DIR}/rrfs-test/testinput")
# It's unclear if anyone is using the local data functionality, therefore comment it out
# for now and add in if someone complains / remove if completely if not.
#elseif (DEFINED ENV{FV3_JEDI_TESTFILES})
# message(STATUS "Use test data from local directory $ENV{FV3_JEDI_TESTFILES}")
# # A bit of guesswork here, I don't know if folks using this option stored it in the same directory structure
# set (fv3-jedi_data_testinput_tier_1_local "$ENV{FV3_JEDI_TESTFILES}/fv3-jedi-data/testinput_tier_1")
if(FV3_DYCORE)
if(FV3_DYCORE)

message(STATUS "MACHINE_ID is " ${MACHINE_ID})
if("${MACHINE_ID}" STREQUAL "orion")
Expand Down Expand Up @@ -106,5 +105,4 @@ if (ADD_RRFS_TESTS)
set(MPI_ARGS ${RESTORE_MPI_ARGS})
endif()

endif()
endif()

0 comments on commit 04b5139

Please sign in to comment.