From ee4be43af4eaa833e7b5077951274dd50c694e0f Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 11:06:17 +0100 Subject: [PATCH 01/11] Specify component model as arguments --- build_tsmp2.sh | 57 +++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index aedf90f..d66549e 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -11,18 +11,24 @@ set -eo pipefail ## functions function help_tsmp2() { - echo "Usage: $0 [-v ] [--component_name] [--optionals]" - echo " -q, --quiet Write less output during shell execution" - echo " -v, --verbose Enable verbose output from Makefile builds using CMAKE_VERBOSE_MAKEFILE" - echo " --version Print $0 scipt version" - echo " --ICON Compile with ICON" - echo " --eCLM Compile with eCLM" - echo " --ParFlow Compile with ParFlow (CPU mode)" - echo " --ParFlowGPU Compile with ParFlow (GPU mode)" - echo " --PDAF Compile with PDAF" - echo " --COSMO Compile with COSMO" - echo " --CLM35 Compile with CLM3.5" - echo " --CLM3.5 Compile with CLM3.5 (same as option --CLM35)" + echo "build_tsmp2.sh - Shell-based script to compile model components within the TSMP2 framework." + echo "" + echo "Usage:" + echo "" + echo " ./build_tsmp2.sh [component models...] [options...]" + echo "" + echo "Component models:" + echo "" + echo " icon Compile with ICON atmosphere model." + echo " eclm Compile with eCLM land surface model." + echo " parflow Compile with ParFlow subsurface model." + echo " parflowGPU Compile with ParFlow subsurface model (GPU-enabled)" + echo " pdaf Compile with PDAF data assimilation framework." + echo " cosmo Compile with COSMO atmosphere model (legacy)" + echo " clm35 Compile with CLM3.5 land surface model (legacy)" + echo "" + echo "Options:" + echo "" echo " --ICON_SRC Set ICON_SRC directory" echo " --eCLM_SRC Set eCLM_SRC directory" echo " --ParFlow_SRC Set ParFlow_SRC directory" @@ -34,8 +40,16 @@ function help_tsmp2() { echo " --install_dir Set install dir cmake, if not set bin/_ 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 " -q, --quiet Write less output during shell execution" + echo " -v, --verbose Enable verbose output from Makefile builds using CMAKE_VERBOSE_MAKEFILE" + echo "" + echo "Examples:" + echo "" + echo " ./build_tsmp2.sh icon eclm parflow" + echo " ./build_tsmp2.sh eclm parflowGPU" + echo " ./build_tsmp2.sh iconGPU eclm" echo "" - echo "Example: $0 --ICON --eCLM --ParFlow" exit 1 } @@ -99,19 +113,20 @@ fi # quiet ### ## get params +# TODO: -- switches should be deprecated in favor of while [[ "$#" -gt 0 ]]; do case "${1,,}" in -h|--help) help_tsmp2;; -q|--quiet) quiet=y;; -v|--verbose) verbose_makefile=y;; - --version) echo "$0 version 0.1.0"; exit 0;; - --icon) icon=y;; - --eclm) eclm=y;; - --parflow) parflow=y; parflowCPU=y; parflowCMakeModelID="ParFlow" ;; - --parflowgpu) parflow=y; parflowGPU=y; parflowCMakeModelID="ParFlowGPU" ;; - --pdaf) pdaf=y;; - --cosmo) cosmo=y;; - --clm35|--clm3.5) clm35=y;; + --version) echo "$0 version 0.1.0"; exit 1;; + --icon|icon) icon=y;; + --eclm|eclm) eclm=y;; + --parflow|parflow) parflow=y parflowGPU=n parflowCMakeModelID="ParFlow";; + --parflowgpu|parflowgpu) parflow=y parflowGPU=y parflowCMakeModelID="ParFlowGPU";; + --pdaf|pdaf) pdaf=y;; + --cosmo|cosmo) cosmo=y;; + --clm35|clm35) clm35=y;; --no_update) update_compsrc=n;; --clean_first) clean_first=y;; --icon_src) icon_src="$2"; shift ;; From 28fe4455ae475a5ff1d9273f977d8662537a8843 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 11:29:36 +0100 Subject: [PATCH 02/11] Updated Quickstard.md --- docs/users_guide/building_TSMP2/Quickstart.md | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/docs/users_guide/building_TSMP2/Quickstart.md b/docs/users_guide/building_TSMP2/Quickstart.md index d1eb84e..1282a5c 100644 --- a/docs/users_guide/building_TSMP2/Quickstart.md +++ b/docs/users_guide/building_TSMP2/Quickstart.md @@ -13,32 +13,41 @@ cd TSMP2 2. Build model components with TSMP2 framework -To build a model component one need to activate the component model `--`. The options are not case-sensitive and do not need to be in an specific order. +To build a model component one need to activate the component model ``. The options are not case-sensitive and do not need to be in an specific order. ```{note} -The component models (git submodules) are cloned during the execution of `build_tsmp2.sh`. If the component model (`models/`) are already exists, the user is asked if the folder should be overwritten or not. If you do want to use the default model component source codes, one can use the option `--`. +The component models (git submodules) are cloned during the execution of `build_tsmp2.sh`. If the component model (`models/`) are already exists, the user is asked if the folder should be overwritten or not. If you do want to use the default model component source codes, one can use the option ``. ``` ```bash # to see options ./build_tsmp2.sh --help -# ICON-eCLM-ParFlow -./build_tsmp2.sh --ICON --eCLM --PARFLOW +# Build the fully-coupled model (ICON-eCLM-ParFlow) +./build_tsmp2.sh icon eclm parflow -# eCLM-ParFlow -./build_tsmp2.sh --eCLM --PARFLOW +# Other possible model combinations +./build_tsmp2.sh eclm parflow +./build_tsmp2.sh icon eclm +./build_tsmp2.sh eclm pdaf -# ICON-eCLM -./build_tsmp2.sh --ICON --eCLM +# Build ICON from a local source repo +./build_tsmp2.sh ICON --ICON_SRC ${ICON_SRC} -# eCLM-PDAF -./build_tsmp2.sh --eCLM --PDAF +# Build ParFlow on Marvin (Uni Bonn) +./build_tsmp2.sh ParFlow --env env/uni-bonn.gnu.openmpi parflow -# ICON (with source code) -./build_tsmp2.sh --ICON --ICON_SRC ${ICON_SRC} -# ParFlow on Marvin (Uni Bonn) -./build_tsmp2.sh --ParFlow --env env/uni-bonn.gnu.openmpi +# Fancy way of building a fully-coupled model +echo "eCLM ICON ParFlow" | xargs -t ./build_tsmp2.sh --no_update --clean_first + +# Build multiple combinations (useful for CI) +cat << EOF > model_combinations.txt +icon eclm parflow +eclm parflowgpu +icon eclm +eclm pdaf +EOF +cat model_combinations.txt | xargs -t -n 3 ./build_tsmp2.sh --no_update ``` From 3da662facbc6c4405439df9f23211c751c81bb3e Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 11:52:47 +0100 Subject: [PATCH 03/11] Minor wording fixes --- build_tsmp2.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index d66549e..c6f6c35 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash ### TSMP2 frontend -### Shell-based script to compile model components within the TSMP2 framework. +### Bash script for compiling model components within the TSMP2 framework. ### ### For more information: ### ./build_tsmp2.sh --help @@ -11,7 +11,7 @@ set -eo pipefail ## functions function help_tsmp2() { - echo "build_tsmp2.sh - Shell-based script to compile model components within the TSMP2 framework." + echo "build_tsmp2.sh - Bash script for compiling model components within the TSMP2 framework." echo "" echo "Usage:" echo "" @@ -48,7 +48,8 @@ function help_tsmp2() { echo "" echo " ./build_tsmp2.sh icon eclm parflow" echo " ./build_tsmp2.sh eclm parflowGPU" - echo " ./build_tsmp2.sh iconGPU eclm" + echo " ./build_tsmp2.sh icon eclm" + echo " ./build_tsmp2.sh eclm pdaf" echo "" exit 1 } From da73cef9742a7c9e7c5301bf09e0581a7ca7788d Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 11:55:39 +0100 Subject: [PATCH 04/11] Applied new comp model input format in CI --- .github/workflows/CI.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d210874..88d4a78 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,35 +20,35 @@ jobs: name: "ICON-eCLM-ParFlow", use_oasis: "True", parflow_dir: "parflow", - model_opts: "--ICON --eCLM --ParFlow" + model_opts: "ICON eCLM ParFlow" } - { name: "eCLM-ParFlowGPU", use_oasis: "True", parflow_dir: "parflow", - model_opts: "--eCLM --ParFlowGPU" + model_opts: "eCLM ParFlowGPU" } # - { # name: "CLM3.5-PDAF", # use_oasis: "False", -# model_opts: "--CLM35 --PDAF" +# model_opts: "CLM35 PDAF" # } - { name: "eCLM-PDAF", use_oasis: "False", - model_opts: "--eCLM --PDAF" + model_opts: "eCLM PDAF" } # - { # name: "CLM3.5-ParFlow-PDAF", # use_oasis: "True", # parflow_dir: "parflow_pdaf", -# model_opts: "--CLM35 --ParFlow --PDAF" +# model_opts: "CLM35 ParFlow PDAF" # } # - { # name: "eCLM-ParFlow-PDAF", # use_oasis: "True", # parflow_dir: "parflow_pdaf", -# model_opts: "--eCLM --ParFlow --PDAF" +# model_opts: "eCLM ParFlow PDAF" # } env: SYSTEMNAME: UBUNTU From 31edf558b9214e763c30cd3697312188cf0e8aba Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 12:01:26 +0100 Subject: [PATCH 05/11] typo: must be parflowCPU --- build_tsmp2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index c6f6c35..786332f 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -123,7 +123,7 @@ while [[ "$#" -gt 0 ]]; do --version) echo "$0 version 0.1.0"; exit 1;; --icon|icon) icon=y;; --eclm|eclm) eclm=y;; - --parflow|parflow) parflow=y parflowGPU=n parflowCMakeModelID="ParFlow";; + --parflow|parflow) parflow=y parflowCPU=n parflowCMakeModelID="ParFlow";; --parflowgpu|parflowgpu) parflow=y parflowGPU=y parflowCMakeModelID="ParFlowGPU";; --pdaf|pdaf) pdaf=y;; --cosmo|cosmo) cosmo=y;; From 151f7fe709150d05e8e2d8c898f143d89c85e36f Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 12:02:49 +0100 Subject: [PATCH 06/11] More typo fixes --- build_tsmp2.sh | 2 +- docs/users_guide/building_TSMP2/Quickstart.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 786332f..a53b87e 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -123,7 +123,7 @@ while [[ "$#" -gt 0 ]]; do --version) echo "$0 version 0.1.0"; exit 1;; --icon|icon) icon=y;; --eclm|eclm) eclm=y;; - --parflow|parflow) parflow=y parflowCPU=n parflowCMakeModelID="ParFlow";; + --parflow|parflow) parflow=y parflowCPU=y parflowCMakeModelID="ParFlow";; --parflowgpu|parflowgpu) parflow=y parflowGPU=y parflowCMakeModelID="ParFlowGPU";; --pdaf|pdaf) pdaf=y;; --cosmo|cosmo) cosmo=y;; diff --git a/docs/users_guide/building_TSMP2/Quickstart.md b/docs/users_guide/building_TSMP2/Quickstart.md index 1282a5c..635fbac 100644 --- a/docs/users_guide/building_TSMP2/Quickstart.md +++ b/docs/users_guide/building_TSMP2/Quickstart.md @@ -35,7 +35,7 @@ The component models (git submodules) are cloned during the execution of `build_ ./build_tsmp2.sh ICON --ICON_SRC ${ICON_SRC} # Build ParFlow on Marvin (Uni Bonn) -./build_tsmp2.sh ParFlow --env env/uni-bonn.gnu.openmpi parflow +./build_tsmp2.sh ParFlow --env env/uni-bonn.gnu.openmpi # Fancy way of building a fully-coupled model From 6b08b56964bfee675822a042a0a5399d9a2637c8 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 12:57:00 +0100 Subject: [PATCH 07/11] Fixed removed --clm3.5 option --- build_tsmp2.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index a53b87e..e3bc3bd 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -25,7 +25,7 @@ function help_tsmp2() { echo " parflowGPU Compile with ParFlow subsurface model (GPU-enabled)" echo " pdaf Compile with PDAF data assimilation framework." echo " cosmo Compile with COSMO atmosphere model (legacy)" - echo " clm35 Compile with CLM3.5 land surface model (legacy)" + echo " clm3.5 Compile with CLM3.5 land surface model (legacy)" echo "" echo "Options:" echo "" @@ -127,7 +127,7 @@ while [[ "$#" -gt 0 ]]; do --parflowgpu|parflowgpu) parflow=y parflowGPU=y parflowCMakeModelID="ParFlowGPU";; --pdaf|pdaf) pdaf=y;; --cosmo|cosmo) cosmo=y;; - --clm35|clm35) clm35=y;; + --clm35|--clm3.5|clm3.5) clm35=y;; --no_update) update_compsrc=n;; --clean_first) clean_first=y;; --icon_src) icon_src="$2"; shift ;; From f7872c91654fb9a17c914c987320e8082708ef68 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 13:06:32 +0100 Subject: [PATCH 08/11] xargs: -L 1 treats each line as argument/s to build_tsmp2.sh --- docs/users_guide/building_TSMP2/Quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/building_TSMP2/Quickstart.md b/docs/users_guide/building_TSMP2/Quickstart.md index 635fbac..dac1a44 100644 --- a/docs/users_guide/building_TSMP2/Quickstart.md +++ b/docs/users_guide/building_TSMP2/Quickstart.md @@ -48,6 +48,6 @@ eclm parflowgpu icon eclm eclm pdaf EOF -cat model_combinations.txt | xargs -t -n 3 ./build_tsmp2.sh --no_update +cat model_combinations.txt | xargs -t -L 1 ./build_tsmp2.sh --no_update ``` From 1355205457a3414ba5f47a42ddf9e9c9bb926638 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 13:30:23 +0100 Subject: [PATCH 09/11] Removed extra space --- build_tsmp2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index e3bc3bd..4d61d14 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -25,7 +25,7 @@ function help_tsmp2() { echo " parflowGPU Compile with ParFlow subsurface model (GPU-enabled)" echo " pdaf Compile with PDAF data assimilation framework." echo " cosmo Compile with COSMO atmosphere model (legacy)" - echo " clm3.5 Compile with CLM3.5 land surface model (legacy)" + echo " clm3.5 Compile with CLM3.5 land surface model (legacy)" echo "" echo "Options:" echo "" From 0ed3a1241400528e43b4563a7fdf671425007b19 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 15:15:21 +0100 Subject: [PATCH 10/11] Separated advanced build_tsmp2 usage into another section --- docs/users_guide/building_TSMP2/Quickstart.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/building_TSMP2/Quickstart.md b/docs/users_guide/building_TSMP2/Quickstart.md index dac1a44..ed78add 100644 --- a/docs/users_guide/building_TSMP2/Quickstart.md +++ b/docs/users_guide/building_TSMP2/Quickstart.md @@ -36,10 +36,17 @@ The component models (git submodules) are cloned during the execution of `build_ # Build ParFlow on Marvin (Uni Bonn) ./build_tsmp2.sh ParFlow --env env/uni-bonn.gnu.openmpi +``` + +## `build_tsmp2.sh` cheatsheet +```bash +# Specify model combinations thru xargs +echo "icon eclm parflow" | xargs -t ./build_tsmp2.sh --no_update --clean_first -# Fancy way of building a fully-coupled model -echo "eCLM ICON ParFlow" | xargs -t ./build_tsmp2.sh --no_update --clean_first +# Build models with custom environment, build, and install directories +echo "icon eclm parflow" | xargs -t -L 1 ./build_tsmp2.sh --no_update --env env/jsc.2025.gnu.psmpi --build_dir bld/ICON_eCLM_ParFlow_GNUPSMPI --install_dir bin/ICON_eCLM_ParFlow_GNUPSMPI +echo "eclm parflowgpu" | xargs -t -L 1 ./build_tsmp2.sh --no_update --env env/jsc.2025.gnu.openmpi --build_dir bld/eCLM_ParFlowGPU_GNUOPENMPI --install_dir bin/eCLM_ParFlowGPU_GNUOPENMPI # Build multiple combinations (useful for CI) cat << EOF > model_combinations.txt @@ -49,5 +56,8 @@ icon eclm eclm pdaf EOF cat model_combinations.txt | xargs -t -L 1 ./build_tsmp2.sh --no_update + +# Force-update all component models before building +yes y | ./build_tsmp2.sh icon eclm parflow ``` From 981e6577486bf3fa2339bd9fca5883a67419c9e8 Mon Sep 17 00:00:00 2001 From: kvrigor Date: Thu, 27 Nov 2025 15:16:29 +0100 Subject: [PATCH 11/11] Bump script version to 0.2.0 --- build_tsmp2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 4d61d14..b0e6526 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -120,7 +120,7 @@ while [[ "$#" -gt 0 ]]; do -h|--help) help_tsmp2;; -q|--quiet) quiet=y;; -v|--verbose) verbose_makefile=y;; - --version) echo "$0 version 0.1.0"; exit 1;; + --version) echo "$0 version 0.2.0"; exit 0;; --icon|icon) icon=y;; --eclm|eclm) eclm=y;; --parflow|parflow) parflow=y parflowCPU=y parflowCMakeModelID="ParFlow";;