Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
VER_ECCODES: 2.40.0
VER_OASIS: tsmp-patches-v0.1
VER_ICON_UPSTREAM: release-2026.04-public
MAKE_JOBS: 4

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -131,7 +132,7 @@ jobs:
export CPPFLAGS=-I/usr/include/hdf5/openmpi
export LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi
./configure --prefix=${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}
make -j4 install
make -j${MAKE_JOBS} install

# Verify
tree -L 2 ${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}
Expand Down Expand Up @@ -166,7 +167,7 @@ jobs:
export CPPFLAGS=-I${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}/include
export LDFLAGS=-L${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}/lib
./configure --prefix=${DEPENDENCIES_ROOT}/netcdf-f90-${VER_NETCDF_F90}
make -j4 install
make -j${MAKE_JOBS} install

# Verify
tree -L 2 ${DEPENDENCIES_ROOT}/netcdf-f90-${VER_NETCDF_F90}
Expand Down Expand Up @@ -204,7 +205,7 @@ jobs:
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DMPI_INCLUDE_DIR="${MPI_HOME}/include" \
-DHYPRE_ENABLE_OPENMP="ON"
cmake --build bld --parallel 4
cmake --build bld --parallel ${MAKE_JOBS}
cmake --install bld

# Verify
Expand Down Expand Up @@ -243,7 +244,7 @@ jobs:
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DMPI_INCLUDE_DIR="${MPI_HOME}/include" \
-DHYPRE_ENABLE_CUDA="ON"
cmake --build bld --parallel 4
cmake --build bld --parallel ${MAKE_JOBS}
cmake --install bld

# Verify
Expand Down Expand Up @@ -278,7 +279,7 @@ jobs:

# Install
cmake -S . -B bld -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_ROOT}/eccodes-${VER_ECCODES}
cmake --build bld --parallel 4
cmake --build bld --parallel ${MAKE_JOBS}
cmake --install bld

# Verify
Expand Down Expand Up @@ -471,7 +472,7 @@ jobs:
if [[ "${{ matrix.config.name }}" == "ICON standalone" ]]; then
MODEL_OPTS="${MODEL_OPTS} --ICON_SRC ${TSMP2_ROOT}/models/icon-model"
fi
BUILD_TSMP2_CMD="./build_tsmp2.sh ${MODEL_OPTS} --no_update"
BUILD_TSMP2_CMD="./build_tsmp2.sh ${MODEL_OPTS} --no_update --parallel ${MAKE_JOBS}"
echo $BUILD_TSMP2_CMD && echo ""
eval $BUILD_TSMP2_CMD

Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.21.1)
cmake_minimum_required (VERSION 3.28)
project(TSMP2 LANGUAGES C CXX Fortran)
include(ExternalProject)

Expand All @@ -24,6 +24,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE")
endif()

if(NOT DEFINED PARALLEL_JOBS)
set(PARALLEL_JOBS "1" CACHE STRING "Number of parallel make jobs for building model components." FORCE)
endif()

# init CMAKE internal variables
string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME)
set(MODEL_ID "")
Expand Down Expand Up @@ -144,5 +148,3 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()

print_model_versions("${COMPONENT_MODELS}" "${TSMP2_MODEL_VERSIONS}")

#message(FATAL_ERROR "at the end of script")
13 changes: 12 additions & 1 deletion build_tsmp2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function help_tsmp2() {
echo " --install_dir Set install dir cmake, if not set bin/<SYSTEMNAME>_<model-id> is used. Model executables and libraries will be installed here"
echo " --clean_first Delete build_dir if it already exists"
echo " --env Set model environment."
echo " --version Print $0 scipt version"
echo " -j, --parallel Set the maximum number of jobs to build the code, if not set compilation is serial."
echo " -q, --quiet Write less output during shell execution"
echo " -v, --verbose Enable verbose output from Makefile builds using CMAKE_VERBOSE_MAKEFILE"
echo ""
Expand Down Expand Up @@ -144,6 +144,7 @@ while [[ "$#" -gt 0 ]]; do
--build_dir) build_dir="$2"; shift ;;
--install_dir) install_dir="$2"; shift ;;
--env) env="$2"; shift ;;
-j|--parallel) parallel_jobs="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
Expand Down Expand Up @@ -319,6 +320,15 @@ else
fi
mkdir -p "${cmake_install_dir}"

if [[ -z "${parallel_jobs}" ]]; then
if [[ ! -z "${TSMP2_PARALLEL_JOBS}" ]]; then
parallel_jobs=${TSMP2_PARALLEL_JOBS}
else
parallel_jobs=1
fi
fi
message "Parallel make jobs set to ${parallel_jobs}"

#
# 5. CMake configure
#
Expand All @@ -336,6 +346,7 @@ cmake_conf="-S ${cmake_tsmp2_dir} -B ${cmake_build_dir}"
cmake_conf+=" -DCMAKE_BUILD_TYPE=${cmake_build_type}"
cmake_conf+=" -DCMAKE_INSTALL_PREFIX=${cmake_install_dir}"
cmake_conf+=" -DCMAKE_VERBOSE_MAKEFILE=${cmake_verbose_makefile}"
cmake_conf+=" -DPARALLEL_JOBS=${parallel_jobs}"
cmake_conf+=" ${cmake_comp_str}"
cmake_conf+=" ${cmake_compsrc_str}"
message "cmake ${cmake_conf}" |& tee "${build_log}"
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildICON.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ ExternalProject_Add(ICON
MPI_LAUNCH=${MPIEXEC_EXECUTABLE}
--prefix=${CMAKE_INSTALL_PREFIX}
${EXTRA_CONFIG_ARGS}
BUILD_COMMAND make -j8 install
BUILD_COMMAND make -j ${PARALLEL_JOBS} install
INSTALL_COMMAND ""
BUILD_ALWAYS YES
DEPENDS ${MODEL_DEPENDENCIES}
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildOASIS3MCT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ExternalProject_Add(OASIS3_MCT
SOURCE_DIR ${OASIS_SRC}
BUILD_IN_SOURCE FALSE
CONFIGURE_COMMAND ""
BUILD_COMMAND make -f ${OASIS_SRC}/util/make_dir/TopMakefileOasis3 static-libs -C ${OASIS_BLD_DIR}
BUILD_COMMAND make -j ${PARALLEL_JOBS} -f ${OASIS_SRC}/util/make_dir/TopMakefileOasis3 static-libs -C ${OASIS_BLD_DIR}
INSTALL_COMMAND ""
)

Expand Down
44 changes: 23 additions & 21 deletions cmake/BuildParFlow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,29 @@ endif()

# Pass options to ParFlow CMake
ExternalProject_Add(ParFlow
PREFIX ParFlow
SOURCE_DIR ${PARFLOW_SRC}
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${PF_CFLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DCMAKE_Fortran_FLAGS=${PF_FFLAGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DPARFLOW_ENABLE_HYPRE=ON
-DPARFLOW_ENABLE_NETCDF=ON
-DPARFLOW_AMPS_SEQUENTIAL_IO=ON
-DPARFLOW_ENABLE_TIMING=TRUE
-DPARFLOW_ACCELERATOR_BACKEND=${PF_ACC_BACKEND}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DPARFLOW_ENABLE_SLURM=${ENABLE_SLURM}
${PF_UMPIRE_FLAG}
${PF_SUNDIALS_FLAG}
${PF_CLM_FLAGS}
DEPENDS ${MODEL_DEPENDENCIES}
PREFIX ParFlow
SOURCE_DIR ${PARFLOW_SRC}
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${PF_CFLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DCMAKE_Fortran_FLAGS=${PF_FFLAGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DPARFLOW_ENABLE_HYPRE=ON
-DPARFLOW_ENABLE_NETCDF=ON
-DPARFLOW_AMPS_SEQUENTIAL_IO=ON
-DPARFLOW_ENABLE_TIMING=TRUE
-DPARFLOW_ACCELERATOR_BACKEND=${PF_ACC_BACKEND}
-DMPIEXEC_EXECUTABLE=${MPIEXEC_EXECUTABLE}
-DMPIEXEC_NUMPROC_FLAG=${MPIEXEC_NUMPROC_FLAG}
-DPARFLOW_ENABLE_SLURM=${ENABLE_SLURM}
${PF_UMPIRE_FLAG}
${PF_SUNDIALS_FLAG}
${PF_CLM_FLAGS}
BUILD_COMMAND make -j ${PARALLEL_JOBS} install
INSTALL_COMMAND ""
DEPENDS ${MODEL_DEPENDENCIES}
)

get_model_version(${PARFLOW_SRC} PARFLOW_VERSION)
Expand Down
5 changes: 2 additions & 3 deletions cmake/BuildeCLM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ ExternalProject_Add(eCLM
${COUP_OAS_FLAGS}
${PDAF_FLAGS}
BUILD_ALWAYS YES
BUILD_COMMAND "" # This needs to be empty to avoid building eCLM twice.
# This happens because INSTALL_COMMAND triggers rebuild
# which is abnormal. This is a problem in eCLM and should be fixed.
BUILD_COMMAND ""
INSTALL_COMMAND make -j ${PARALLEL_JOBS} install
DEPENDS ${MODEL_DEPENDENCIES}
)

Expand Down
1 change: 1 addition & 0 deletions env/jsc.2025.gnu.openmpi
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export FC=mpif90
export CXX=mpicxx
export MPI_HOME=$EBROOTOPENMPI
export MPIEXEC_EXECUTABLE=$(which srun)
export TSMP2_PARALLEL_JOBS=16

# Display compiler settings
module list
Expand Down
1 change: 1 addition & 0 deletions env/jsc.2025.gnu.psmpi
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export CC=mpicc
export FC=mpif90
export CXX=mpicxx
export MPI_HOME=$EBROOTPSMPI
export TSMP2_PARALLEL_JOBS=16

# Display compiler settings
module list
Expand Down
1 change: 1 addition & 0 deletions env/jsc.2025.intel.psmpi
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export FC=mpif90
export CXX=mpicxx
export MPI_HOME=$EBROOTPSMPI
export MPIEXEC_EXECUTABLE=$(which srun)
export TSMP2_PARALLEL_JOBS=16

# Display compiler settings
module list
Expand Down
1 change: 1 addition & 0 deletions env/jsc.2026.gnu.openmpi
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export CXX=mpicxx
export MPI_HOME=$EBROOTOPENMPI
export UMPIRE_ROOT=$EBROOTUMPIRE
export SUNDIALS_ROOT=$EBROOTSUNDIALS
export TSMP2_PARALLEL_JOBS=16

# Display compiler settings
module list
Expand Down
1 change: 1 addition & 0 deletions env/jsc.2026.nvhpc.openmpi
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export CUDACXX=nvcc
export MPI_HOME=$EBROOTOPENMPI
export UMPIRE_ROOT=$EBROOTUMPIRE
export SUNDIALS_ROOT=$EBROOTSUNDIALS
export TSMP2_PARALLEL_JOBS=16

# Display compiler settings
module list
Expand Down
1 change: 1 addition & 0 deletions env/ubuntu.gnu.openmpi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export MPI_HOME=/usr/lib/x86_64-linux-gnu/openmpi
export MPIEXEC_EXECUTABLE=$(which srun)
export SYSTEMNAME="UBUNTU"
export STAGE=$(lsb_release -sr)
export TSMP2_PARALLEL_JOBS=8

# ParFlow additional libraries
if [[ "$1" == "--parflowgpu" ]]; then
Expand Down
1 change: 1 addition & 0 deletions env/uni-bonn.gnu.openmpi
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export FC=mpif90
export CXX=mpicxx
export MPI_HOME=$EBROOTOPENMPI
export MPIEXEC_EXECUTABLE=$(which mpirun)
export TSMP2_PARALLEL_JOBS=8

# Display compiler settings
module list
Expand Down
Loading