From 57f164312a13b834b94087a3b8259ed54fa4cafd Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 18 Jun 2024 12:23:25 +0200 Subject: [PATCH 01/25] add model components as git submodules --- .gitmodules | 15 +++++++++++++++ models/.gitkeep | 0 models/eCLM | 1 + models/icon | 1 + models/oasis3-mct | 1 + models/parflow | 1 + models/parflow_pdaf | 1 + models/pdaf | 1 + 8 files changed, 21 insertions(+) create mode 100644 .gitmodules create mode 100644 models/.gitkeep create mode 160000 models/eCLM create mode 160000 models/icon create mode 160000 models/oasis3-mct create mode 160000 models/parflow create mode 160000 models/parflow_pdaf create mode 160000 models/pdaf diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ad40ca8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "models/icon"] + path = models/icon + url = https://gitlab.jsc.fz-juelich.de/sdlts/tsmp_components_mirrors/icon2.6.4_oascoup +[submodule "models/parflow"] + path = models/parflow + url = https://github.com/parflow/parflow.git +[submodule "models/parflow_pdaf"] + path = models/parflow_pdaf + url = https://github.com/HPSCTerrSys/parflow +[submodule "models/pdaf"] + path = models/pdaf + url = https://github.com/HPSCTerrSys/pdaf.git +[submodule "models/eCLM"] + path = models/eCLM + url = https://github.com/HPSCTerrSys/eCLM.git diff --git a/models/.gitkeep b/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/models/eCLM b/models/eCLM new file mode 160000 index 0000000..c434963 --- /dev/null +++ b/models/eCLM @@ -0,0 +1 @@ +Subproject commit c434963afc5bee1b34fbfdd4ac561a070198da29 diff --git a/models/icon b/models/icon new file mode 160000 index 0000000..21be042 --- /dev/null +++ b/models/icon @@ -0,0 +1 @@ +Subproject commit 21be04212a5481980db6d8ba9b15d5dad94f8802 diff --git a/models/oasis3-mct b/models/oasis3-mct new file mode 160000 index 0000000..5253349 --- /dev/null +++ b/models/oasis3-mct @@ -0,0 +1 @@ +Subproject commit 5253349d4ce15259fcd76e0443495c1ddb7788bb diff --git a/models/parflow b/models/parflow new file mode 160000 index 0000000..6ea2098 --- /dev/null +++ b/models/parflow @@ -0,0 +1 @@ +Subproject commit 6ea209875f6478450ec0dbbff313ca7a97291b92 diff --git a/models/parflow_pdaf b/models/parflow_pdaf new file mode 160000 index 0000000..d67aa13 --- /dev/null +++ b/models/parflow_pdaf @@ -0,0 +1 @@ +Subproject commit d67aa13c831087d6f74ea07a1c5b6504d59b3d82 diff --git a/models/pdaf b/models/pdaf new file mode 160000 index 0000000..b8361a6 --- /dev/null +++ b/models/pdaf @@ -0,0 +1 @@ +Subproject commit b8361a61b55d98eb7fa90097a31f31075e094f9e From 6ace448502d2e5f2bef8b07550a87bc5bd7df2df Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 17 Jul 2024 09:56:07 +0200 Subject: [PATCH 02/25] add component feature to CmakeLists --- CMakeLists.txt | 107 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 88 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e193981..70392fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,39 +1,59 @@ cmake_minimum_required (VERSION 3.21.1) -project(eTSMP LANGUAGES C CXX Fortran) +project(TSMP2 LANGUAGES C CXX Fortran) +#project(TSMP2 LANGUAGES) include(ExternalProject) +# set default of components to off +option(ICON "Compile ICON within TSMP2 framework" OFF) +option(eCLM "Compile eCLM within TSMP2 framework" OFF) +option(ParFlow "Compile ParFlow within TSMP2 framework" OFF) +option(PDAF "Compile PDAF within TSMP2 framework" OFF) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(Utils) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bld) +#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +#message("eCLM bool value: $") +message("eCLM value: ${eCLM}") +#message("ICON value: ${ICON}") + +#MATH(EXPR MODELCOUNT "${ICON}+${eCLM}") +#message(${MODELCOUNT}) +#if (MODELCOUNT GREATER_EQUAL 1) +# message("WRITE MODELCOUNT > 1") +# set(OASIS On) +#endif() +##unset(MODELCOUNT CACHE) + +string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME) +set(MODELCOUNT 0) +set(MODEL_ID "") + +#if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +# set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) +#endif() +#message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Choose the type of build." FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE") endif() -find_package(MPIFortran REQUIRED) -if(DEFINED OASIS_SRC) - include(BuildOASIS3MCT) - list(APPEND MODEL_DEPENDENCIES OASIS3_MCT) -endif() - # TODO (for all Build*.cmake scripts): # - Check validity of compile flags # - Implement set of compile flags depending on compiler (e.g. GNU, Intel) and # build configuration (e.g. Debug, Release, Profiling) -if(DEFINED eCLM_SRC) - include(BuildeCLM) - list(APPEND COMPONENT_MODELS "eCLM") -endif() - -if(DEFINED CLM35_SRC) - include(BuildCLM3.5) - list(APPEND COMPONENT_MODELS "CLM3.5") -endif() - -if(DEFINED ICON_SRC) +if (${ICON}) + if(NOT DEFINED ICON_SRC) + set(ICON_SRC "${CMAKE_BINARY_DIR}/models/icon") + endif() include(BuildICON) list(APPEND COMPONENT_MODELS "ICON") + set(MODEL_ID "${MODEL_ID}ICON") + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if(DEFINED COSMO_SRC) @@ -41,9 +61,34 @@ if(DEFINED COSMO_SRC) list(APPEND COMPONENT_MODELS "COSMO5.1") endif() -if(DEFINED PARFLOW_SRC) +if (${eCLM}) + if(NOT DEFINED eCLM_SRC) + set(eCLM_SRC "${CMAKE_BINARY_DIR}/models/eCLM") + endif() + include(BuildeCLM) + list(APPEND COMPONENT_MODELS "eCLM") + set(MODEL_ID "${MODEL_ID}eCLM") + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") +endif() +message("eCLMSRC: ${eCLM_SRC}") +message("MODEL_ID: ${MODEL_ID}") +message("MODELCOUNT: ${MODELCOUNT}") + +if(DEFINED CLM35_SRC) + include(BuildCLM3.5) + list(APPEND COMPONENT_MODELS "CLM3.5") +endif() + +if (${ParFlow}) + if(NOT DEFINED PARFLOW_SRC AND NOT ${PDAF}) + set(PARFLOW_SRC "${CMAKE_BINARY_DIR}/models/parflow") + elseif (NOT DEFINED PARFLOW_SRC AND ${PDAF}) + set(PARFLOW_SRC "${CMAKE_BINARY_DIR}/models/parflow_pdaf") + endif() include(BuildParFlow) list(APPEND COMPONENT_MODELS "ParFlow") + set(MODEL_ID "${MODEL_ID}ParFlow") + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if(DEFINED PDAF_SRC) @@ -53,4 +98,28 @@ if(DEFINED PDAF_SRC) list(APPEND COMPONENT_MODELS "PDAF") endif() +#find_package(MPIFortran REQUIRED) +if (${MODELCOUNT} GREATER 1) + if(NOT DEFINED OASIS_SRC) + set(OASIS_SRC "${CMAKE_BINARY_DIR}/models/oasis3-mct") + endif() + include(BuildOASIS3MCT) + list(APPEND MODEL_DEPENDENCIES OASIS3_MCT) +endif() + + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) +endif() +message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") + +message("CMAKE CUR BIN DIR ${CMAKE_CURRENT_BINARY_DIR}") +message("CMAKE BIN DIR ${CMAKE_BINARY_DIR}") + +#if(NOT DEFINED BUILD_DIR) +# set(BUILD_DIR "./bld/$ENV{SYSTEMNAME^^}_${MODEL_ID}") +#endif() + print_model_versions("${COMPONENT_MODELS}" "${eTSMP_MODEL_VERSIONS}") + +message(FATAL_ERROR "at the end of script") From c68baa6a205f985c2e9e3d4c0fc98685e588419e Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 17 Jul 2024 10:01:17 +0200 Subject: [PATCH 03/25] add modelcounter in CMakeLists --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70392fe..7d1159b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,9 @@ include(ExternalProject) # set default of components to off option(ICON "Compile ICON within TSMP2 framework" OFF) +option(COSMO "Compile COSMO within TSMP2 framework" OFF) option(eCLM "Compile eCLM within TSMP2 framework" OFF) +option(CLM3.5 "Compile CLM3.5 within TSMP2 framework" OFF) option(ParFlow "Compile ParFlow within TSMP2 framework" OFF) option(PDAF "Compile PDAF within TSMP2 framework" OFF) @@ -27,20 +29,16 @@ message("eCLM value: ${eCLM}") #endif() ##unset(MODELCOUNT CACHE) -string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME) -set(MODELCOUNT 0) -set(MODEL_ID "") - -#if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -# set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) -#endif() -#message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Choose the type of build." FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG" "RELEASE") endif() +# init CMAKE internal variables +string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME) +set(MODELCOUNT 0) +set(MODEL_ID "") + # TODO (for all Build*.cmake scripts): # - Check validity of compile flags # - Implement set of compile flags depending on compiler (e.g. GNU, Intel) and @@ -48,7 +46,7 @@ endif() if (${ICON}) if(NOT DEFINED ICON_SRC) - set(ICON_SRC "${CMAKE_BINARY_DIR}/models/icon") + set(ICON_SRC "${CMAKE_SOURCE_DIR}/models/icon") endif() include(BuildICON) list(APPEND COMPONENT_MODELS "ICON") @@ -56,14 +54,19 @@ if (${ICON}) MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() -if(DEFINED COSMO_SRC) +if (${COSMO}) + if(DEFINED COSMO_SRC) + set(COSMO_SRC "${CMAKE_SOURCE_DIR}/models/cosmo5.01_fresh") + endif() include(BuildCOSMO) list(APPEND COMPONENT_MODELS "COSMO5.1") + set(MODEL_ID "${MODEL_ID}COSMO") + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${eCLM}) if(NOT DEFINED eCLM_SRC) - set(eCLM_SRC "${CMAKE_BINARY_DIR}/models/eCLM") + set(eCLM_SRC "${CMAKE_SOURCE_DIR}/models/eCLM") endif() include(BuildeCLM) list(APPEND COMPONENT_MODELS "eCLM") @@ -74,16 +77,21 @@ message("eCLMSRC: ${eCLM_SRC}") message("MODEL_ID: ${MODEL_ID}") message("MODELCOUNT: ${MODELCOUNT}") -if(DEFINED CLM35_SRC) +if (${CLM3.5}) + if(DEFINED CLM35_SRC) + set(CLM35_SRC "${CMAKE_SOURCE_DIR}/models/CLM3.5") + endif() include(BuildCLM3.5) list(APPEND COMPONENT_MODELS "CLM3.5") + set(MODEL_ID "${MODEL_ID}CLM3.5") + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${ParFlow}) if(NOT DEFINED PARFLOW_SRC AND NOT ${PDAF}) - set(PARFLOW_SRC "${CMAKE_BINARY_DIR}/models/parflow") + set(PARFLOW_SRC "${CMAKE_SOURCE_DIR}/models/parflow") elseif (NOT DEFINED PARFLOW_SRC AND ${PDAF}) - set(PARFLOW_SRC "${CMAKE_BINARY_DIR}/models/parflow_pdaf") + set(PARFLOW_SRC "${CMAKE_SOURCE_DIR}/models/parflow_pdaf") endif() include(BuildParFlow) list(APPEND COMPONENT_MODELS "ParFlow") @@ -91,7 +99,10 @@ if (${ParFlow}) MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() -if(DEFINED PDAF_SRC) +if (${PDAF}) + if(DEFINED PDAF_SRC) + set(CLM35_SRC "${CMAKE_SOURCE_DIR}/models/pdaf") + endif() include(BuildPDAF) include(BuildPDAFMODEL) include(BuildPDAFFRAMEWORK) @@ -101,20 +112,37 @@ endif() #find_package(MPIFortran REQUIRED) if (${MODELCOUNT} GREATER 1) if(NOT DEFINED OASIS_SRC) - set(OASIS_SRC "${CMAKE_BINARY_DIR}/models/oasis3-mct") + set(OASIS_SRC "${CMAKE_SOURCE_DIR}/models/oasis3-mct") endif() include(BuildOASIS3MCT) list(APPEND MODEL_DEPENDENCIES OASIS3_MCT) endif() +# set paths if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) + set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) endif() -message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") +message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") message("CMAKE CUR BIN DIR ${CMAKE_CURRENT_BINARY_DIR}") message("CMAKE BIN DIR ${CMAKE_BINARY_DIR}") +message("CMAKE CACHEDILEDIR ${CMAKE_CACHEFILE_DIR}") +message("CMAKE build dir ${CMAKE_BUILD_DIRECTORY}") +message("CMAKE execute dir ${EXECUTABLE_OUTPUT_PATH}, runtime ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}, build files ${CMAKE_BUILD_FILES_DIRECTORY}") +message("CMAKE CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") +message("CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") + +#GET_FILENAME_COMPONENT(PARENTDIR ${CMAKE_SOURCE_DIR} PATH) +#message("PARENTDIR ${PARENTDIR}) + +STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" + "${CMAKE_BINARY_DIR}" insource) +GET_FILENAME_COMPONENT(PARENTDIR ${CMAKE_SOURCE_DIR} PATH) +message("PARENTDIR ${PARENTDIR}") +STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" + "${PARENTDIR}" insourcesubdir) +message("insource ${insource} insourcesubdir ${insourcesubdir}") #if(NOT DEFINED BUILD_DIR) # set(BUILD_DIR "./bld/$ENV{SYSTEMNAME^^}_${MODEL_ID}") From 970304f7d5ba38cf2c3f3891c59baaa42bf87edb Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 29 Aug 2024 11:19:27 +0200 Subject: [PATCH 04/25] implementation of first version of front end - add shell script build_tsmp2.sh - CMakeLists.txt adaptations - Revise README and add quickstart with front-end - update gitignore --- .gitignore | 7 -- CMakeLists.txt | 85 +++++++++---------- README.md | 157 +++++++++++++++++++++++------------ build_tsmp2.sh | 216 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 359 insertions(+), 106 deletions(-) create mode 100755 build_tsmp2.sh diff --git a/.gitignore b/.gitignore index ac6f091..abf2c80 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,3 @@ bin/* bld/* run/ -eCLM/ -icon2.6.4_oascoup/ -oasis3-mct/ -parflow/ -CLM3.5/ -cosmo5.01_fresh/ -pdaf/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d1159b..57e70f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ cmake_minimum_required (VERSION 3.21.1) project(TSMP2 LANGUAGES C CXX Fortran) -#project(TSMP2 LANGUAGES) include(ExternalProject) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +include(Utils) + +# Prevent in-source builds +set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) + # set default of components to off option(ICON "Compile ICON within TSMP2 framework" OFF) option(COSMO "Compile COSMO within TSMP2 framework" OFF) @@ -11,23 +16,6 @@ option(CLM3.5 "Compile CLM3.5 within TSMP2 framework" OFF) option(ParFlow "Compile ParFlow within TSMP2 framework" OFF) option(PDAF "Compile PDAF within TSMP2 framework" OFF) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") -include(Utils) - -#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bld) -#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - -#message("eCLM bool value: $") -message("eCLM value: ${eCLM}") -#message("ICON value: ${ICON}") - -#MATH(EXPR MODELCOUNT "${ICON}+${eCLM}") -#message(${MODELCOUNT}) -#if (MODELCOUNT GREATER_EQUAL 1) -# message("WRITE MODELCOUNT > 1") -# set(OASIS On) -#endif() -##unset(MODELCOUNT CACHE) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Choose the type of build." FORCE) @@ -44,13 +32,19 @@ set(MODEL_ID "") # - Implement set of compile flags depending on compiler (e.g. GNU, Intel) and # build configuration (e.g. Debug, Release, Profiling) +# model settings +set(MODEL_ID "") if (${ICON}) if(NOT DEFINED ICON_SRC) set(ICON_SRC "${CMAKE_SOURCE_DIR}/models/icon") endif() include(BuildICON) list(APPEND COMPONENT_MODELS "ICON") - set(MODEL_ID "${MODEL_ID}ICON") + if ("${MODEL_ID}" STREQUAL "") + set(MODEL_ID "ICON") + else() + set(MODEL_ID "${MODEL_ID}-ICON") + endif() MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() @@ -70,7 +64,11 @@ if (${eCLM}) endif() include(BuildeCLM) list(APPEND COMPONENT_MODELS "eCLM") - set(MODEL_ID "${MODEL_ID}eCLM") + if ("${MODEL_ID}" STREQUAL "") + set(MODEL_ID "eCLM") + else() + set(MODEL_ID "${MODEL_ID}-eCLM") + endif() MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() message("eCLMSRC: ${eCLM_SRC}") @@ -95,7 +93,11 @@ if (${ParFlow}) endif() include(BuildParFlow) list(APPEND COMPONENT_MODELS "ParFlow") - set(MODEL_ID "${MODEL_ID}ParFlow") + if ("${MODEL_ID}" STREQUAL "") + set(MODEL_ID "ParFlow") + else() + set(MODEL_ID "${MODEL_ID}-ParFlow") + endif() MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() @@ -107,8 +109,15 @@ if (${PDAF}) include(BuildPDAFMODEL) include(BuildPDAFFRAMEWORK) list(APPEND COMPONENT_MODELS "PDAF") + if ("${MODEL_ID}" STREQUAL "") + set(MODEL_ID "PDAF") + else() + set(MODEL_ID "${MODEL_ID}-PDAF") + endif() endif() +#message("MODEL_ID ${MODEL_ID}") + #find_package(MPIFortran REQUIRED) if (${MODELCOUNT} GREATER 1) if(NOT DEFINED OASIS_SRC) @@ -119,35 +128,19 @@ if (${MODELCOUNT} GREATER 1) endif() # set paths - if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) endif() -message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") -message("CMAKE CUR BIN DIR ${CMAKE_CURRENT_BINARY_DIR}") -message("CMAKE BIN DIR ${CMAKE_BINARY_DIR}") -message("CMAKE CACHEDILEDIR ${CMAKE_CACHEFILE_DIR}") -message("CMAKE build dir ${CMAKE_BUILD_DIRECTORY}") -message("CMAKE execute dir ${EXECUTABLE_OUTPUT_PATH}, runtime ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}, build files ${CMAKE_BUILD_FILES_DIRECTORY}") -message("CMAKE CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") -message("CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") - -#GET_FILENAME_COMPONENT(PARENTDIR ${CMAKE_SOURCE_DIR} PATH) -#message("PARENTDIR ${PARENTDIR}) - -STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" - "${CMAKE_BINARY_DIR}" insource) -GET_FILENAME_COMPONENT(PARENTDIR ${CMAKE_SOURCE_DIR} PATH) -message("PARENTDIR ${PARENTDIR}") -STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" - "${PARENTDIR}" insourcesubdir) -message("insource ${insource} insourcesubdir ${insourcesubdir}") - -#if(NOT DEFINED BUILD_DIR) -# set(BUILD_DIR "./bld/$ENV{SYSTEMNAME^^}_${MODEL_ID}") -#endif() +#message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") +#message("CMAKE CUR BIN DIR ${CMAKE_CURRENT_BINARY_DIR}") +#message("CMAKE BIN DIR ${CMAKE_BINARY_DIR}") +#message("CMAKE CACHEDILEDIR ${CMAKE_CACHEFILE_DIR}") +#message("CMAKE build dir ${CMAKE_BUILD_DIRECTORY}") +#message("CMAKE execute dir ${EXECUTABLE_OUTPUT_PATH}, runtime ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}, build files ${CMAKE_BUILD_FILES_DIRECTORY}") +#message("CMAKE CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") +#message("CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") print_model_versions("${COMPONENT_MODELS}" "${eTSMP_MODEL_VERSIONS}") -message(FATAL_ERROR "at the end of script") +#message(FATAL_ERROR "at the end of script") diff --git a/README.md b/README.md index 58d26ff..1efb62e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,63 @@ ## Quickstart +> [!NOTE] +> Please work with caution when directly using the backend of TSMP2. + +1. Clone this repository. + +```bash +git clone https://github.com/HPSCTerrSys/TSMP2.git +export TSMP2_DIR=$(realpath TSMP2) +cd $TSMP2_DIR +``` + +2. Get model source code +Get needed submodules of component models. + +> [!NOTE] +> Please just download the submodules, which you need. E.g. if you want to run ICON-eCLM-ParFlow, you need to download the submodules `models/icon`,`models/eclm`,`models/parflow` and the coupler `models/oasis3-mct`. + +```bash +git submodule update --init -- models/icon +git submodule update --init -- models/eCLM +git submodule update --init -- models/parflow +git submodule update --init -- models/oasis3-mct +git submodule update --init -- models/pdaf +git submodule update --init -- models/parflow_pdaf +``` + +3. 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. + +```bash +# to see options +./build_tsmp2.sh --help + +# ICON-eCLM-ParFlow +./build_tsmp2.sh --ICON --eCLM --PARFLOW + +# eCLM-ParFlow +./build_tsmp2.sh --eCLM --PARFLOW + +# ICON-eCLM +./build_tsmp2.sh --ICON --eCLM + +# eCLM-PDAF +./build_tsmp2.sh --eCLM --PDAF + +# ICON (with source code) +./build_tsmp2.sh --ICON --ICON_SRC ${ICON_SRC} +``` + +The build-system is cmake-based. However, the top-level script is shell based for easier user handling. + + +## Backend TSMP2 + +> [!NOTE] +> For experienced users. + 1. Clone this repository. ```bash @@ -37,36 +95,36 @@ mkdir -p ${BUILD_DIR} ${INSTALL_DIR} ## NOTE: Download only the component models that you need! ## # eCLM -git clone https://github.com/HPSCTerrSys/eCLM.git -eCLM_SRC=`realpath eCLM` +git clone https://github.com/HPSCTerrSys/eCLM.git models/eclm +eCLM_SRC=`realpath models/eclm` # ICON -git clone https://icg4geo.icg.kfa-juelich.de/spoll/icon2.6.4_oascoup.git -ICON_SRC=`realpath icon2.6.4_oascoup` +git clone https://icg4geo.icg.kfa-juelich.de/spoll/icon2.6.4_oascoup.git models/icon +ICON_SRC=`realpath models/icon` # ParFlow -git clone -b v3.12.0 https://github.com/parflow/parflow.git -PARFLOW_SRC=`realpath parflow` +git clone -b v3.12.0 https://github.com/parflow/parflow.git models/parflow +PARFLOW_SRC=`realpath models/parflow` # ParFlow (PDAF-patched) -git clone -b v3.12.0-tsmp https://github.com/HPSCTerrSys/parflow -PARFLOW_SRC=`realpath parflow` +git clone -b v3.12.0-tsmp https://github.com/HPSCTerrSys/parflow models/parflow_pdaf +PARFLOW_SRC=`realpath models/parflow_pdaf` # CLM3.5 -git clone -b tsmp-patches-v0.1 https://github.com/HPSCTerrSys/CLM3.5.git -CLM35_SRC=`realpath CLM3.5` +git clone -b tsmp-patches-v0.1 https://github.com/HPSCTerrSys/CLM3.5.git models/clm35 +CLM35_SRC=`realpath models/clm35` # COSMO5.01 -git clone -b tsmp-oasis https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git -COSMO_SRC=`realpath cosmo5.01_fresh` +git clone -b tsmp-oasis https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git models/cosmo +COSMO_SRC=`realpath models/cosmo` # OASIS3-MCT (required for coupled models) -git clone -b tsmp-patches-v0.1 https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct -OASIS_SRC=`realpath oasis3-mct` +git clone -b tsmp-patches-v0.1 https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct models/oasis3-mct +OASIS_SRC=`realpath models/oasis3-mct` # PDAF -git clone -b PDAF_V2.2.1-tsmp https://github.com/HPSCTerrSys/pdaf.git -PDAF_SRC=`realpath pdaf` +git clone -b PDAF_V2.2.1-tsmp https://github.com/HPSCTerrSys/pdaf.git models/pdaf +PDAF_SRC=`realpath models/pdaf` ``` 5. Run CMake configure step for the model combination that you wish to build. The @@ -74,52 +132,47 @@ PDAF_SRC=`realpath pdaf` ```bash # -# Coupled models requires the option -DOASIS_SRC=${OASIS_SRC}. +# The component source is searched in models/component by default but there is also the possibility to choose the path to the source code of components with -D_SRC=${_SRC}. OASIS is taken by default when coupled models are chosen. # # ICON-eCLM cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DeCLM_SRC=${eCLM_SRC} \ - -DICON_SRC=${ICON_SRC} + -DeCLM=ON \ + -DICON=ON # eCLM-ParFlow cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DeCLM_SRC=${eCLM_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} + -DeCLM=ON \ + -DPARFLOW_SRC=ON # ICON-eCLM-ParFlow cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DeCLM_SRC=${eCLM_SRC} \ - -DICON_SRC=${ICON_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} + -DeCLM=ON \ + -DICON=ON \ + -DPARFLOW=ON # CLM3.5-COSMO5.01-ParFlow cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DCLM35_SRC=${CLM35_SRC} \ - -DCOSMO_SRC=${COSMO_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} + -DCLM35=ON \ + -DCOSMO=ON \ + -DPARFLOW=ON # CLM3.5-ParFlow cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DCLM35_SRC=${CLM35_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} + -DCLM35_SRC=ON \ + -DPARFLOW_SRC=ON # CLM3.5-COSMO5.01 cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DCLM35_SRC=${CLM35_SRC} \ - -DCOSMO_SRC=${COSMO_SRC} + -DOASIS_SRC=ON \ + -DCLM35_SRC=ON \ + -DCOSMO_SRC=ON # # For standalone models, remove -DOASIS_SRC=${OASIS_SRC} @@ -129,49 +182,47 @@ cmake -S . -B ${BUILD_DIR} \ # CLM3.5 standalone cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DCLM35_SRC=${CLM35_SRC} + -DCLM35=ON # eCLM standalone cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DeCLM_SRC=${eCLM_SRC} + -DeCLM=ON # ParFlow standalone cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DPARFLOW_SRC=${PARFLOW_SRC} + -DPARFLOW=ON # -# For TSMP-PDAF builds, add -PDAF_SRC=${PDAF_SRC} +# For TSMP-PDAF builds, add -PDAF=ON # # CLM3.5-PDAF cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DCLM35_SRC=${CLM35_SRC} \ - -DPDAF_SRC=${PDAF_SRC} + -DCLM35=ON \ + -DPDAF=ON # CLM3.5-ParFlow-PDAF cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DCLM35_SRC=${CLM35_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} \ - -DPDAF_SRC=${PDAF_SRC} + -DCLM35=ON \ + -DPARFLOW=ON \ + -DPDAF=ON # eCLM-PDAF cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DeCLM_SRC=${eCLM_SRC} \ - -DPDAF_SRC=${PDAF_SRC} + -DeCLM=ON \ + -DPDAF=ON # eCLM-ParFlow-PDAF cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=${OASIS_SRC} \ - -DeCLM_SRC=${eCLM_SRC} \ - -DPARFLOW_SRC=${PARFLOW_SRC} \ - -DPDAF_SRC=${PDAF_SRC} + -DeCLM=ON \ + -DPARFLOW=ON \ + -DPDAF=ON ``` diff --git a/build_tsmp2.sh b/build_tsmp2.sh new file mode 100755 index 0000000..b9a4efa --- /dev/null +++ b/build_tsmp2.sh @@ -0,0 +1,216 @@ +#!/bin/bash +### TSMP2 frontend +### Shell-based script to compile model components within the TSMP2 framework. +### +### For more information: +### ./build_tsmp2.sh --help + +## functions + +function help_tsmp2() { + echo "Usage: $0 [-v ] [--component_name] [--optionals]" + echo " -q, --quite Write less output during shell execution" + echo " --ICON Compile with ICON" + echo " --eCLM Compile with eCLM" + echo " --ParFlow Compile with ParFlow" + echo " --PDAF Compile with PDAF" + echo " --COSMO Compile with COSMO" + echo " --CLM35 Compile with CLM3.5" + echo " --ICON_SRC Set ICON_SRC directory" + echo " --eCLM_SRC Set eCLM_SRC directory" + echo " --ParFlow_SRC Set ParFlow_SRC directory" + echo " --OASIS_SRC Set OASIS3-MCT directory" + echo " --PDAF_SRC Set PDAF_SRC directory" + echo " --build_config Set build configuration: 'Debug' 'Release'" + echo " --compiler Set compiler for building" + echo " --source_dir Set source dir of cmake, if not set is used" + echo " --build_dir Set build dir cmake, if not set bld/_ is used. Build artifacts will be generated in this folder." + echo " --install_dir Set install dir cmake, if not set bin/_ is used. Model executables and libraries will be installed here" + echo " --tsmp2_dir Set tsmp2_dir, if not set pwd is used" + echo " --tsmp2_env Set model environment." + echo "" + echo "Example: $0 --ICON --eCLM --ParFlow" + exit 1 +} + +function set_component(){ +local -n component=$1 +cmake_name=$2 +if [ "${component}" = "y" ];then + if [ ! "${model_id}" ];then + model_id="${cmake_name}" + else + model_id+="-${cmake_name}" + fi # model_id + cmake_comp_str+=" -D${cmake_name}=ON" + if [[ $cmake_name = @(ICON|eCLM|PARFLOW|COSMO|CLM35) ]]; then + model_count=$(( $model_count + 1 )) + fi # cmake_name +fi # component +} + +function set_compsrc(){ +local -n compsrc_name=$1 +cmake_srcname=$2 +if [ -n "${compsrc_name}" ];then + cmake_compsrc_str+=" -D${cmake_srcname}=${compsrc_name}" +fi # compsrc +} + +function message(){ +#local -n messstr="$1" +if [ -z "${quite}" ];then + echo "$1" #$messstr +fi # message +} + +### +## PROGRAM START +### + +## get params +while [[ "$#" -gt 0 ]]; do + case "${1,,}" in + -h|--help) help_tsmp2;; + -q|--quite) quite=y;; + --icon) icon=y;; + --eclm) eclm=y;; + --parflow) parflow=y;; + --pdaf) pdaf=y;; + --cosmo) cosmo=y;; + --clm35) clm35=y;; + --icon_src) icon_src="$2"; shift ;; + --eclm_src) eclm_src="$2"; shift ;; + --parflow_src) parflow_src="$2"; shift ;; + --pdaf_src) pdaf_src="$2"; shift ;; + --oasis_src) oasis_src="$2"; shift ;; + --build_config) build_config="$2"; shift ;; + --compiler) compiler="$2"; shift ;; + --build_dir) build_dir="$2"; shift ;; + --source_dir) source_dir="$2"; shift ;; + --install_dir) install_dir="$2"; shift ;; + --tsmp2_dir) tsmp2_dir="$2"; shift ;; + --tsmp2_env) tsmp2_env="$2"; shift ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift +done + +## Create MODEL-ID + COMPONENT STRING +model_id="" +model_count=0 +cmake_comp_str="" + +message "set model-id and component string" +# fun set_component shell_name cmake_name +set_component icon "ICON" +set_component eclm "eCLM" +set_component parflow "PARFLOW" +set_component pdaf "PDAF" +set_component cosmo "COSMO" +set_component clm35 "CLM35" + +if [ $model_count = 0 ];then + echo "No model component is chosen" + exit 1 +fi + +## CONCADINATE SOURCE CODE STRING +message "set component source dir" +cmake_compsrc_str="" +set_compsrc icon_src "ICON_SRC" +set_compsrc eclm_src "eCLM_SRC" +set_compsrc parflow_src "PARFLOW_SRC" +set_compsrc oasis_src "OASIS_SRC" +set_compsrc pdaf_src "PDAF_SRC" +set_compsrc cosmo_src "COSMO_SRC" +set_compsrc clm35_src "CLM35_SRC" + +## CMAKE options + +message "set CMAKE options" +# build_config +if [[ -z $build_config ]];then + cmake_build_config="" +else + cmake_build_config=" -DCMAKE_BUILD_TYPE=${build_config}" +fi + +# set compiler +if [[ -z $compiler ]];then + cmake_compiler="" +else + cmake_comiler=" -DCMAKE_CXX_COMPILER_ID=${compiler}" +fi + +# set INSTALL and BUILD DIR (neccesary for building) +if [ -n ${tsmp2_dir} ]; then + cmake_tsmp2_dir="${PWD}" +else + cmake_tsmp2_dir="${tsmp2_dir}" +fi # tsmp2_dir + +if [ -z ${SYSTEMNAME} ]; then SYSTEMNAME="UNKN"; fi + +if [ -n ${build_dir} ]; then + cmake_build_dir="${cmake_tsmp2_dir}/bld/${SYSTEMNAME^^}_${model_id}" +else + cmake_build_dir="${build_dir}" +fi # build_dir + +if [ -n ${install_dir} ]; then + cmake_install_dir="-DCMAKE_INSTALL_PREFIX=${cmake_tsmp2_dir}/bin/${SYSTEMNAME^^}_${model_id}" +else + cmake_install_dir="-DCMAKE_INSTALL_PREFIX=${install_dir}" +fi # install_dir + +build_log="$(dirname ${cmake_build_dir})/${model_id}_$(date +%Y-%m-%d_%H-%M).log" + +## source environment +message "source environment" +if [ -n ${tsmp2_env} ]; then + tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2023_Intel.sh" +else + tsmp2_env="${tsmp2_env}" +fi # tsmp2_env +source $tsmp2_env + +## CMAKE config +# rm -rf ${cmake_build_dir} +mkdir -pv ${cmake_build_dir} $( echo "${cmake_install_dir}" |cut -d\= -f2) +message "====================" +message "== TSMP2 settings ==" +message "====================" +message "MODEL-ID: $model_id" +message "TSMP2DIR: $cmake_tsmp2_dir" +message "BUILDDIR: $cmake_build_dir" +message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" +message "CMAKE command:" +message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " + +cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ + ${cmake_build_config} \ + ${cmake_comp_str} \ + ${cmake_compsrc_str} \ + ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} \ + |& tee ${build_log} + +## Build and install + +message "CMAKE build:" +message "cmake --build ${cmake_build_dir} |& tee -a $build_log" +cmake --build ${cmake_build_dir} |& tee -a $build_log + +message "CMAKE install:" +message "cmake --install ${cmake_build_dir} |& tee -a $build_log" +cmake --install ${cmake_build_dir} |& tee -a $build_log + +## Copy log and environment +message "Copy log and environment to install_dir" +cp ${tsmp2_env} $( echo "${cmake_install_dir}" |cut -d\= -f2) +cp ${build_log} $( echo "${cmake_install_dir}" |cut -d\= -f2) + +## message +message "Log can be found in: ${build_log}" +message "Model environment used: ${tsmp_env}" +message "Model binaries can be found in: $( echo "${cmake_install_dir}" |cut -d\= -f2)" From e730e217930d13f6348f807cde5a36ec3c08443b Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 29 Aug 2024 11:26:30 +0200 Subject: [PATCH 05/25] Update ReadMe --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1efb62e..f08e8f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Quickstart -> [!NOTE] -> Please work with caution when directly using the backend of TSMP2. +> [!TIP] +> The top-level TSMP2 script `build_tsmp2.sh` is a shell-based. However, the build-system itself is cmake-based. During execution, the CMAKE-command is printed. Thus, one can always reproduce the build command of the framework. 1. Clone this repository. @@ -50,8 +50,6 @@ To build a model component one need to activate the component model `--`. ./build_tsmp2.sh --ICON --ICON_SRC ${ICON_SRC} ``` -The build-system is cmake-based. However, the top-level script is shell based for easier user handling. - ## Backend TSMP2 From df2259f80b655a25f8f99942cae25f239dc5d454 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 29 Aug 2024 17:39:46 +0200 Subject: [PATCH 06/25] tip-o fix, clean-up and change to stg2022 --- CMakeLists.txt | 9 --------- build_tsmp2.sh | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57e70f2..d339dbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,15 +132,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) endif() -#message("CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}") -#message("CMAKE CUR BIN DIR ${CMAKE_CURRENT_BINARY_DIR}") -#message("CMAKE BIN DIR ${CMAKE_BINARY_DIR}") -#message("CMAKE CACHEDILEDIR ${CMAKE_CACHEFILE_DIR}") -#message("CMAKE build dir ${CMAKE_BUILD_DIRECTORY}") -#message("CMAKE execute dir ${EXECUTABLE_OUTPUT_PATH}, runtime ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}, build files ${CMAKE_BUILD_FILES_DIRECTORY}") -#message("CMAKE CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") -#message("CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") - print_model_versions("${COMPONENT_MODELS}" "${eTSMP_MODEL_VERSIONS}") #message(FATAL_ERROR "at the end of script") diff --git a/build_tsmp2.sh b/build_tsmp2.sh index b9a4efa..ac7fc14 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -169,7 +169,7 @@ build_log="$(dirname ${cmake_build_dir})/${model_id}_$(date +%Y-%m-%d_%H-%M).log ## source environment message "source environment" if [ -n ${tsmp2_env} ]; then - tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2023_Intel.sh" + tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2022_Intel.sh" else tsmp2_env="${tsmp2_env}" fi # tsmp2_env @@ -212,5 +212,5 @@ cp ${build_log} $( echo "${cmake_install_dir}" |cut -d\= -f2) ## message message "Log can be found in: ${build_log}" -message "Model environment used: ${tsmp_env}" +message "Model environment used: ${tsmp2_env}" message "Model binaries can be found in: $( echo "${cmake_install_dir}" |cut -d\= -f2)" From 1f886f0b85b82bbfd2866b2ce440ecb456b81bd3 Mon Sep 17 00:00:00 2001 From: Johannes Keller Date: Fri, 30 Aug 2024 17:58:25 +0200 Subject: [PATCH 07/25] bugfixes for setting `PDAF_SRC` --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d339dbb..9d87145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,8 +102,8 @@ if (${ParFlow}) endif() if (${PDAF}) - if(DEFINED PDAF_SRC) - set(CLM35_SRC "${CMAKE_SOURCE_DIR}/models/pdaf") + if(NOT DEFINED PDAF_SRC) + set(PDAF_SRC "${CMAKE_SOURCE_DIR}/models/pdaf") endif() include(BuildPDAF) include(BuildPDAFMODEL) From 4b94069011cb4e365fa8be78041e27cf342e8f63 Mon Sep 17 00:00:00 2001 From: Johannes Keller Date: Fri, 30 Aug 2024 19:18:08 +0200 Subject: [PATCH 08/25] use `${PDAF}` instead of `PDAF_SRC` for checking PDAF --- cmake/BuildCLM3.5.cmake | 2 +- cmake/BuildOASIS3MCT.cmake | 2 +- cmake/BuildeCLM.cmake | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/BuildCLM3.5.cmake b/cmake/BuildCLM3.5.cmake index f4f90ca..566e169 100644 --- a/cmake/BuildCLM3.5.cmake +++ b/cmake/BuildCLM3.5.cmake @@ -5,7 +5,7 @@ list(APPEND CLM35_CONFIG_OPTS -cc ${CMAKE_C_COMPILER}) list(APPEND CLM35_CONFIG_OPTS -fc ${CMAKE_Fortran_COMPILER}) list(APPEND CLM35_CONFIG_OPTS -clm_bld ${CMAKE_BINARY_DIR}/CLM3_5/bld) list(APPEND CLM35_CONFIG_OPTS -clm_exedir ${CMAKE_INSTALL_PREFIX}/bin) -if(DEFINED PDAF_SRC) +if(${PDAF}) list(APPEND CLM35_CONFIG_OPTS -clm_libdir ${CMAKE_INSTALL_PREFIX}/lib) list(APPEND CLM35_CONFIG_OPTS -clm_incdir ${CMAKE_INSTALL_PREFIX}/include/clm3.5) set(CLM35_MAKE_TARGET "all") diff --git a/cmake/BuildOASIS3MCT.cmake b/cmake/BuildOASIS3MCT.cmake index 878d35c..f04ec7c 100644 --- a/cmake/BuildOASIS3MCT.cmake +++ b/cmake/BuildOASIS3MCT.cmake @@ -34,7 +34,7 @@ file(APPEND ${OASIS_MAKE_INC} "AR = ar\n") file(APPEND ${OASIS_MAKE_INC} "ARFLAGS = -ruv\n") file(APPEND ${OASIS_MAKE_INC} "DYNOPT = -fPIC\n") file(APPEND ${OASIS_MAKE_INC} "LDDYNOPT = -shared\n") -if(DEFINED PDAF_SRC) +if(${PDAF}) file(APPEND ${OASIS_MAKE_INC} "CPPDEF = -Duse_netCDF -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY -DUSE_PDAF\n") else() file(APPEND ${OASIS_MAKE_INC} "CPPDEF = -Duse_netCDF -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY\n") diff --git a/cmake/BuildeCLM.cmake b/cmake/BuildeCLM.cmake index c753a61..b18fa6c 100644 --- a/cmake/BuildeCLM.cmake +++ b/cmake/BuildeCLM.cmake @@ -10,7 +10,7 @@ else() list(APPEND COUP_OAS_FLAGS -DUSE_OASIS=False) endif() -if(DEFINED PDAF_SRC) +if(${PDAF}) list(APPEND PDAF_FLAGS -DUSE_PDAF=True) endif() @@ -40,7 +40,7 @@ ExternalProject_Add_Step(eCLM install-scripts USES_TERMINAL TRUE ) -if(DEFINED PDAF_SRC) +if(${PDAF}) ExternalProject_Add_Step(eCLM pdaf-workaround COMMAND mv ${CMAKE_INSTALL_PREFIX}/lib/libmct.a ${CMAKE_INSTALL_PREFIX}/lib/libmct2.a COMMENT "Workaround for PDAF: Renaming libmct.a to libmct2.a ..." @@ -51,4 +51,4 @@ if(DEFINED PDAF_SRC) endif() get_model_version(${eCLM_SRC} eCLM_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "eCLM: ${eCLM_VERSION}") \ No newline at end of file +list(APPEND eTSMP_MODEL_VERSIONS "eCLM: ${eCLM_VERSION}") From fc895301e83017add41b984fc8dc16ef75e59ba0 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Mon, 2 Sep 2024 11:58:37 +0200 Subject: [PATCH 09/25] clean-up and ICON build -clean up confusing messages in CMakeLists.txt -add message to indicate cmake call -change ICON build according to model component not comp_srcs --- CMakeLists.txt | 7 +------ build_tsmp2.sh | 16 ++++++++++++---- cmake/BuildICON.cmake | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d87145..5c8db79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,9 +71,6 @@ if (${eCLM}) endif() MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() -message("eCLMSRC: ${eCLM_SRC}") -message("MODEL_ID: ${MODEL_ID}") -message("MODELCOUNT: ${MODELCOUNT}") if (${CLM3.5}) if(DEFINED CLM35_SRC) @@ -116,9 +113,7 @@ if (${PDAF}) endif() endif() -#message("MODEL_ID ${MODEL_ID}") - -#find_package(MPIFortran REQUIRED) +find_package(MPIFortran REQUIRED) if (${MODELCOUNT} GREATER 1) if(NOT DEFINED OASIS_SRC) set(OASIS_SRC "${CMAKE_SOURCE_DIR}/models/oasis3-mct") diff --git a/build_tsmp2.sh b/build_tsmp2.sh index ac7fc14..d7c2ac6 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -58,10 +58,9 @@ fi # compsrc } function message(){ -#local -n messstr="$1" if [ -z "${quite}" ];then - echo "$1" #$messstr -fi # message + echo "$1" +fi # quite } ### @@ -82,6 +81,8 @@ while [[ "$#" -gt 0 ]]; do --icon_src) icon_src="$2"; shift ;; --eclm_src) eclm_src="$2"; shift ;; --parflow_src) parflow_src="$2"; shift ;; + --cosmo_src) cosmo_src="$2"; shift ;; + --clm35_src) clm35_src="$2"; shift ;; --pdaf_src) pdaf_src="$2"; shift ;; --oasis_src) oasis_src="$2"; shift ;; --build_config) build_config="$2"; shift ;; @@ -169,7 +170,7 @@ build_log="$(dirname ${cmake_build_dir})/${model_id}_$(date +%Y-%m-%d_%H-%M).log ## source environment message "source environment" if [ -n ${tsmp2_env} ]; then - tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2022_Intel.sh" + tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2023_Intel.sh" else tsmp2_env="${tsmp2_env}" fi # tsmp2_env @@ -187,6 +188,7 @@ message "BUILDDIR: $cmake_build_dir" message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" message "CMAKE command:" message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " +message "== CMAKE CONNFIGURE start" cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_build_config} \ @@ -195,15 +197,21 @@ cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} \ |& tee ${build_log} +message "== CMAKE CONFIGURE finished" + ## Build and install message "CMAKE build:" message "cmake --build ${cmake_build_dir} |& tee -a $build_log" +message "== CMAKE BUILD start" cmake --build ${cmake_build_dir} |& tee -a $build_log +message "== CMAKE BUILD finished" message "CMAKE install:" message "cmake --install ${cmake_build_dir} |& tee -a $build_log" +message "== CMAKE BUILD start" cmake --install ${cmake_build_dir} |& tee -a $build_log +message "== CMAKE BUILD finished" ## Copy log and environment message "Copy log and environment to install_dir" diff --git a/cmake/BuildICON.cmake b/cmake/BuildICON.cmake index 0796a72..fbc3387 100644 --- a/cmake/BuildICON.cmake +++ b/cmake/BuildICON.cmake @@ -39,7 +39,7 @@ list(APPEND ICON_LIBS "${NetCDF_LIBRARIES}") list(JOIN ICON_LIBS " " ICON_LIBS) list(APPEND EXTRA_CONFIG_ARGS --disable-coupling --disable-ocean --disable-jsbach --enable-ecrad --enable-parallel-netcdf) -if(DEFINED eCLM_SRC OR DEFINED CLM35_SRC) +if(DEFINED eCLM OR DEFINED CLM35) list(APPEND EXTRA_CONFIG_ARGS --enable-oascoupling) endif() From 4993a6de61f7bf1785078c8f2354bb5fddfdf812 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Mon, 2 Sep 2024 12:59:12 +0200 Subject: [PATCH 10/25] update readme quickstart and cmake/BuildICON.cmake --- README.md | 2 +- build_tsmp2.sh | 2 +- cmake/BuildICON.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f08e8f1..cacf339 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Quickstart > [!TIP] -> The top-level TSMP2 script `build_tsmp2.sh` is a shell-based. However, the build-system itself is cmake-based. During execution, the CMAKE-command is printed. Thus, one can always reproduce the build command of the framework. +> The top-level TSMP2 script `build_tsmp2.sh` is a shell-based. However, the build-system itself is cmake-based. During execution, the CMAKE-command is printed. If needed, one could always build the component model by using CMake directly instead of the top-level shell script. 1. Clone this repository. diff --git a/build_tsmp2.sh b/build_tsmp2.sh index d7c2ac6..1c55e3b 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -188,7 +188,7 @@ message "BUILDDIR: $cmake_build_dir" message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" message "CMAKE command:" message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " -message "== CMAKE CONNFIGURE start" +message "== CMAKE CONFIGURE start" cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_build_config} \ diff --git a/cmake/BuildICON.cmake b/cmake/BuildICON.cmake index fbc3387..a044f07 100644 --- a/cmake/BuildICON.cmake +++ b/cmake/BuildICON.cmake @@ -39,7 +39,7 @@ list(APPEND ICON_LIBS "${NetCDF_LIBRARIES}") list(JOIN ICON_LIBS " " ICON_LIBS) list(APPEND EXTRA_CONFIG_ARGS --disable-coupling --disable-ocean --disable-jsbach --enable-ecrad --enable-parallel-netcdf) -if(DEFINED eCLM OR DEFINED CLM35) +if( ${eCLM} OR ${CLM3.5} ) list(APPEND EXTRA_CONFIG_ARGS --enable-oascoupling) endif() From 1dc5dbfd0d30accee947bcc95e91628c1dc72807 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Mon, 2 Sep 2024 23:28:01 +0200 Subject: [PATCH 11/25] update ReadMe and build_tsmp2.sh (review) -add version in build_tsmp2.sh -fix spelling quiet in build_tsmp2.sh -change bash shebang for more portability in build_tsmp2.sh -add pipefail in build_tsmp2.sh -rephrase tip in README -change header to Building TSMP2 with CMake in README --- README.md | 17 ++++++++--------- build_tsmp2.sh | 19 ++++++++++++------- cmake/BuildeCLM.cmake | 6 +++--- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cacf339..4c26c17 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Quickstart > [!TIP] -> The top-level TSMP2 script `build_tsmp2.sh` is a shell-based. However, the build-system itself is cmake-based. During execution, the CMAKE-command is printed. If needed, one could always build the component model by using CMake directly instead of the top-level shell script. +> `build_tsmp2.sh` is a lightweighted shell-script calling the cmake-based build-system. During execution of `build_tsmp2.sh`, the executed CMake-command is printed out. For advanced build use-cases, users can modify the outputed CMake command or directly head over to [Building TSMP2 with CMake](#Building-TSMP2-with-CMake). 1. Clone this repository. @@ -51,7 +51,7 @@ To build a model component one need to activate the component model `--`. ``` -## Backend TSMP2 +## Building TSMP2 with CMake > [!NOTE] > For experienced users. @@ -162,19 +162,18 @@ cmake -S . -B ${BUILD_DIR} \ # CLM3.5-ParFlow cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DCLM35_SRC=ON \ - -DPARFLOW_SRC=ON + -DCLM35=ON \ + -DPARFLOW=ON # CLM3.5-COSMO5.01 cmake -S . -B ${BUILD_DIR} \ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DOASIS_SRC=ON \ - -DCLM35_SRC=ON \ - -DCOSMO_SRC=ON + -DCLM35=ON \ + -DCOSMO=ON # -# For standalone models, remove -DOASIS_SRC=${OASIS_SRC} -# and pass the path to the component model (i.e. -D_SRC=${_SRC}). +# For standalone models +# pass the component model name (i.e. -D=ON). # # CLM3.5 standalone diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 1c55e3b..d504447 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -1,15 +1,19 @@ -#!/bin/bash +#!/usr/bin/env bash ### TSMP2 frontend ### Shell-based script to compile model components within the TSMP2 framework. ### ### For more information: ### ./build_tsmp2.sh --help +# Force script to exit when error occurs +set -eo pipefail + ## functions function help_tsmp2() { echo "Usage: $0 [-v ] [--component_name] [--optionals]" - echo " -q, --quite Write less output during shell execution" + echo " -q, --quiet Write less output during shell execution" + echo " --version Print $0 scipt version" echo " --ICON Compile with ICON" echo " --eCLM Compile with eCLM" echo " --ParFlow Compile with ParFlow" @@ -58,9 +62,9 @@ fi # compsrc } function message(){ -if [ -z "${quite}" ];then +if [ -z "${quiet}" ];then echo "$1" -fi # quite +fi # quiet } ### @@ -71,7 +75,8 @@ fi # quite while [[ "$#" -gt 0 ]]; do case "${1,,}" in -h|--help) help_tsmp2;; - -q|--quite) quite=y;; + -q|--quiet) quiet=y;; + --version) echo "$0 version 0.1.0"; exit 1;; --icon) icon=y;; --eclm) eclm=y;; --parflow) parflow=y;; @@ -97,7 +102,7 @@ while [[ "$#" -gt 0 ]]; do shift done -## Create MODEL-ID + COMPONENT STRING +## Create MODEL_ID + COMPONENT STRING model_id="" model_count=0 cmake_comp_str="" @@ -182,7 +187,7 @@ mkdir -pv ${cmake_build_dir} $( echo "${cmake_install_dir}" |cut -d\= -f2) message "====================" message "== TSMP2 settings ==" message "====================" -message "MODEL-ID: $model_id" +message "MODEL_ID: $model_id" message "TSMP2DIR: $cmake_tsmp2_dir" message "BUILDDIR: $cmake_build_dir" message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" diff --git a/cmake/BuildeCLM.cmake b/cmake/BuildeCLM.cmake index b18fa6c..aa453ab 100644 --- a/cmake/BuildeCLM.cmake +++ b/cmake/BuildeCLM.cmake @@ -1,9 +1,9 @@ -if(DEFINED ICON_SRC OR DEFINED PARFLOW_SRC) +if(${ICON} OR ${PARFLOW}) list(APPEND COUP_OAS_FLAGS -DUSE_OASIS=True) - if(DEFINED PARFLOW_SRC) + if(${PARFLOW}) list(APPEND COUP_OAS_FLAGS -DCOUP_OAS_PFL=True) endif() - if(DEFINED ICON_SRC) + if(${ICON}) list(APPEND COUP_OAS_FLAGS -DCOUP_OAS_ICON=True) endif() else() From 31edba8607ef94cc4f6e143255d2f38ffd116719 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 3 Sep 2024 15:28:55 +0200 Subject: [PATCH 12/25] take the directory of build_tsmp2.sh for cmake_tsmp2_dir and remove option tsmp2_dir --- build_tsmp2.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index d504447..ee865b5 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -27,10 +27,9 @@ function help_tsmp2() { echo " --PDAF_SRC Set PDAF_SRC directory" echo " --build_config Set build configuration: 'Debug' 'Release'" echo " --compiler Set compiler for building" - echo " --source_dir Set source dir of cmake, if not set is used" + echo " --source_dir Set source dir of cmake" echo " --build_dir Set build dir cmake, if not set bld/_ is used. Build artifacts will be generated in this folder." echo " --install_dir Set install dir cmake, if not set bin/_ is used. Model executables and libraries will be installed here" - echo " --tsmp2_dir Set tsmp2_dir, if not set pwd is used" echo " --tsmp2_env Set model environment." echo "" echo "Example: $0 --ICON --eCLM --ParFlow" @@ -95,7 +94,6 @@ while [[ "$#" -gt 0 ]]; do --build_dir) build_dir="$2"; shift ;; --source_dir) source_dir="$2"; shift ;; --install_dir) install_dir="$2"; shift ;; - --tsmp2_dir) tsmp2_dir="$2"; shift ;; --tsmp2_env) tsmp2_env="$2"; shift ;; *) echo "Unknown parameter passed: $1"; exit 1 ;; esac @@ -149,13 +147,10 @@ else cmake_comiler=" -DCMAKE_CXX_COMPILER_ID=${compiler}" fi -# set INSTALL and BUILD DIR (neccesary for building) -if [ -n ${tsmp2_dir} ]; then - cmake_tsmp2_dir="${PWD}" -else - cmake_tsmp2_dir="${tsmp2_dir}" -fi # tsmp2_dir +# Get tsmp2_dir (full path) from location of $0 +cmake_tsmp2_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +# set INSTALL and BUILD DIR (neccesary for building) if [ -z ${SYSTEMNAME} ]; then SYSTEMNAME="UNKN"; fi if [ -n ${build_dir} ]; then @@ -192,14 +187,14 @@ message "TSMP2DIR: $cmake_tsmp2_dir" message "BUILDDIR: $cmake_build_dir" message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" message "CMAKE command:" -message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " +message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " message "== CMAKE CONFIGURE start" cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_build_config} \ ${cmake_comp_str} \ ${cmake_compsrc_str} \ - ${cmake_build_config} ${cmake_compiler} ${cmake_install_dir} \ + ${cmake_compiler} ${cmake_install_dir} \ |& tee ${build_log} message "== CMAKE CONFIGURE finished" From 1950e09e32d8afd3e04ea226bd1bed30b55d34c8 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 3 Sep 2024 15:42:13 +0200 Subject: [PATCH 13/25] rename eTSMP to TSMP2 in xxxx_MODEL_VERSIONS --- CMakeLists.txt | 2 +- cmake/BuildCLM3.5.cmake | 2 +- cmake/BuildCOSMO.cmake | 2 +- cmake/BuildICON.cmake | 2 +- cmake/BuildOASIS3MCT.cmake | 2 +- cmake/BuildPDAF.cmake | 2 +- cmake/BuildParFlow.cmake | 2 +- cmake/BuildeCLM.cmake | 2 +- cmake/Utils.cmake | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8db79..6b72cc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) endif() -print_model_versions("${COMPONENT_MODELS}" "${eTSMP_MODEL_VERSIONS}") +print_model_versions("${COMPONENT_MODELS}" "${TSMP2_MODEL_VERSIONS}") #message(FATAL_ERROR "at the end of script") diff --git a/cmake/BuildCLM3.5.cmake b/cmake/BuildCLM3.5.cmake index 566e169..cbdf80e 100644 --- a/cmake/BuildCLM3.5.cmake +++ b/cmake/BuildCLM3.5.cmake @@ -48,4 +48,4 @@ ExternalProject_Add(CLM3_5 ) get_model_version(${CLM35_SRC} CLM35_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "CLM3.5: ${CLM35_VERSION}") +list(APPEND TSMP2_MODEL_VERSIONS "CLM3.5: ${CLM35_VERSION}") diff --git a/cmake/BuildCOSMO.cmake b/cmake/BuildCOSMO.cmake index c58090e..fc923df 100644 --- a/cmake/BuildCOSMO.cmake +++ b/cmake/BuildCOSMO.cmake @@ -36,4 +36,4 @@ install (FILES ${COSMO_BLD_DIR}/lmparbin_pur GROUP_EXECUTE GROUP_READ) get_model_version(${COSMO_SRC} COSMO_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "COSMO5.1: ${COSMO_VERSION}") \ No newline at end of file +list(APPEND TSMP2_MODEL_VERSIONS "COSMO5.1: ${COSMO_VERSION}") \ No newline at end of file diff --git a/cmake/BuildICON.cmake b/cmake/BuildICON.cmake index a044f07..aa85e85 100644 --- a/cmake/BuildICON.cmake +++ b/cmake/BuildICON.cmake @@ -65,4 +65,4 @@ ExternalProject_Add(ICON ) get_model_version(${ICON_SRC} ICON_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "ICON: ${ICON_VERSION}") +list(APPEND TSMP2_MODEL_VERSIONS "ICON: ${ICON_VERSION}") diff --git a/cmake/BuildOASIS3MCT.cmake b/cmake/BuildOASIS3MCT.cmake index f04ec7c..d3cc924 100644 --- a/cmake/BuildOASIS3MCT.cmake +++ b/cmake/BuildOASIS3MCT.cmake @@ -68,4 +68,4 @@ ExternalProject_Add(OASIS3_MCT set(OASIS_ROOT ${OASIS_INSTALL_PREFIX} CACHE PATH "Full path to the root directory containing OASIS3-MCT include files and libraries.") set(OASIS_LIBRARIES "-L${OASIS_ROOT}/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip" CACHE STRING "OASIS3-MCT linker options") get_model_version(${OASIS_SRC} OASIS_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "OASIS3-MCT: ${OASIS_VERSION}") +list(APPEND TSMP2_MODEL_VERSIONS "OASIS3-MCT: ${OASIS_VERSION}") diff --git a/cmake/BuildPDAF.cmake b/cmake/BuildPDAF.cmake index 4879800..02ef074 100644 --- a/cmake/BuildPDAF.cmake +++ b/cmake/BuildPDAF.cmake @@ -129,5 +129,5 @@ ExternalProject_Add(PDAF ) get_model_version(${PDAF_SRC} PDAF_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "PDAF: ${PDAF_VERSION}") +list(APPEND TSMP2_MODEL_VERSIONS "PDAF: ${PDAF_VERSION}") diff --git a/cmake/BuildParFlow.cmake b/cmake/BuildParFlow.cmake index d1b5e97..834b58a 100644 --- a/cmake/BuildParFlow.cmake +++ b/cmake/BuildParFlow.cmake @@ -42,4 +42,4 @@ ExternalProject_Add(ParFlow ) get_model_version(${PARFLOW_SRC} PARFLOW_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "ParFlow: ${PARFLOW_VERSION}") \ No newline at end of file +list(APPEND TSMP2_MODEL_VERSIONS "ParFlow: ${PARFLOW_VERSION}") \ No newline at end of file diff --git a/cmake/BuildeCLM.cmake b/cmake/BuildeCLM.cmake index aa453ab..69e5ae9 100644 --- a/cmake/BuildeCLM.cmake +++ b/cmake/BuildeCLM.cmake @@ -51,4 +51,4 @@ if(${PDAF}) endif() get_model_version(${eCLM_SRC} eCLM_VERSION) -list(APPEND eTSMP_MODEL_VERSIONS "eCLM: ${eCLM_VERSION}") +list(APPEND TSMP2_MODEL_VERSIONS "eCLM: ${eCLM_VERSION}") diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index 03740ef..8a255d8 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -1,6 +1,6 @@ find_package(Git) if(NOT Git_FOUND) - message(WARNING "eTSMP: git executable not found. Model versions would not be detected.") + message(WARNING "TSMP2: git executable not found. Model versions would not be detected.") endif() function(get_model_version MODEL_DIR MODEL_VERSION) From 8839b4d0c5b22d917e1798bffc7cdf2914ffa62c Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 3 Sep 2024 18:13:38 +0200 Subject: [PATCH 14/25] add check_build_oasis function -use function for OASIS3 build check -shift MODELCOUNT to function -add TSMP2_ENV output in build_tsmp2.sh log --- CMakeLists.txt | 26 +++++++++++--------------- build_tsmp2.sh | 15 ++++++++------- cmake/BuildeCLM.cmake | 4 ++-- cmake/Utils.cmake | 21 ++++++++++++++++++++- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b72cc0..fc1b878 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ endif() # init CMAKE internal variables string(TOUPPER $ENV{SYSTEMNAME} SYSTEMNAME) -set(MODELCOUNT 0) set(MODEL_ID "") # TODO (for all Build*.cmake scripts): @@ -34,6 +33,17 @@ set(MODEL_ID "") # model settings set(MODEL_ID "") + +find_package(MPIFortran REQUIRED) +check_build_oasis(BUILD_OASIS) # check if >=2 components (ICON, COSMO, eCLM, CLM3.5, ParFlow) are build +if (BUILD_OASIS) + if(NOT DEFINED OASIS_SRC) + set(OASIS_SRC "${CMAKE_SOURCE_DIR}/models/oasis3-mct") + endif() + include(BuildOASIS3MCT) + list(APPEND MODEL_DEPENDENCIES OASIS3_MCT) +endif() + if (${ICON}) if(NOT DEFINED ICON_SRC) set(ICON_SRC "${CMAKE_SOURCE_DIR}/models/icon") @@ -45,7 +55,6 @@ if (${ICON}) else() set(MODEL_ID "${MODEL_ID}-ICON") endif() - MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${COSMO}) @@ -55,7 +64,6 @@ if (${COSMO}) include(BuildCOSMO) list(APPEND COMPONENT_MODELS "COSMO5.1") set(MODEL_ID "${MODEL_ID}COSMO") - MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${eCLM}) @@ -69,7 +77,6 @@ if (${eCLM}) else() set(MODEL_ID "${MODEL_ID}-eCLM") endif() - MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${CLM3.5}) @@ -79,7 +86,6 @@ if (${CLM3.5}) include(BuildCLM3.5) list(APPEND COMPONENT_MODELS "CLM3.5") set(MODEL_ID "${MODEL_ID}CLM3.5") - MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${ParFlow}) @@ -95,7 +101,6 @@ if (${ParFlow}) else() set(MODEL_ID "${MODEL_ID}-ParFlow") endif() - MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") endif() if (${PDAF}) @@ -113,15 +118,6 @@ if (${PDAF}) endif() endif() -find_package(MPIFortran REQUIRED) -if (${MODELCOUNT} GREATER 1) - if(NOT DEFINED OASIS_SRC) - set(OASIS_SRC "${CMAKE_SOURCE_DIR}/models/oasis3-mct") - endif() - include(BuildOASIS3MCT) - list(APPEND MODEL_DEPENDENCIES OASIS3_MCT) -endif() - # set paths if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin/${SYSTEMNAME}_${MODEL_ID}" CACHE PATH "default install path" FORCE) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index ee865b5..9fd2ecf 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -183,12 +183,13 @@ message "====================" message "== TSMP2 settings ==" message "====================" message "MODEL_ID: $model_id" -message "TSMP2DIR: $cmake_tsmp2_dir" -message "BUILDDIR: $cmake_build_dir" -message "INSTALLDIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" +message "TSMP2_DIR: $cmake_tsmp2_dir" +message "TSMP2_ENV: $tsmp2_env" +message "BUILD_DIR: $cmake_build_dir" +message "INSTALL_DIR: $( echo "${cmake_install_dir}" |cut -d\= -f2)" message "CMAKE command:" message "cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} ${cmake_build_config} ${cmake_comp_str} ${cmake_compsrc_str} ${cmake_compiler} ${cmake_install_dir} |& tee ${build_log} " -message "== CMAKE CONFIGURE start" +message "== CMAKE GENERATE PROJECT start" cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_build_config} \ @@ -197,7 +198,7 @@ cmake -S ${cmake_tsmp2_dir} -B ${cmake_build_dir} \ ${cmake_compiler} ${cmake_install_dir} \ |& tee ${build_log} -message "== CMAKE CONFIGURE finished" +message "== CMAKE GENERATE PROJECT finished" ## Build and install @@ -209,9 +210,9 @@ message "== CMAKE BUILD finished" message "CMAKE install:" message "cmake --install ${cmake_build_dir} |& tee -a $build_log" -message "== CMAKE BUILD start" +message "== CMAKE INSTALL start" cmake --install ${cmake_build_dir} |& tee -a $build_log -message "== CMAKE BUILD finished" +message "== CMAKE INSTALL finished" ## Copy log and environment message "Copy log and environment to install_dir" diff --git a/cmake/BuildeCLM.cmake b/cmake/BuildeCLM.cmake index 69e5ae9..ca7bd83 100644 --- a/cmake/BuildeCLM.cmake +++ b/cmake/BuildeCLM.cmake @@ -1,6 +1,6 @@ -if(${ICON} OR ${PARFLOW}) +if(${ICON} OR ${ParFlow}) list(APPEND COUP_OAS_FLAGS -DUSE_OASIS=True) - if(${PARFLOW}) + if(${ParFlow}) list(APPEND COUP_OAS_FLAGS -DCOUP_OAS_PFL=True) endif() if(${ICON}) diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index 8a255d8..8a3c610 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -3,6 +3,25 @@ if(NOT Git_FOUND) message(WARNING "TSMP2: git executable not found. Model versions would not be detected.") endif() +# Count how many component models shoul be build, and if >=2 compile with OASIS +function(check_build_oasis BUILD_OASIS) + # Combine all options into a list + list(APPEND COMPONENT_MODELS ICON COSMO eCLM CLM3.5 ParFlow) + # Count enabled models + set(MODELCOUNT 0) + foreach(comp_model IN LISTS COMPONENT_MODELS) + if (${comp_model}) + MATH(EXPR MODELCOUNT "${MODELCOUNT}+1") + endif() + endforeach() + # + if (${MODELCOUNT} GREATER_EQUAL 2) + set(${BUILD_OASIS} TRUE PARENT_SCOPE) + else() + set(${BUILD_OASIS} FALSE PARENT_SCOPE) + endif() +endfunction() + function(get_model_version MODEL_DIR MODEL_VERSION) if(Git_FOUND) EXECUTE_PROCESS( @@ -33,4 +52,4 @@ function(print_model_versions COMPONENT_MODELS MODEL_VERSIONS) endforeach() endif() message(STATUS ${H_SEPARATOR}) -endfunction() \ No newline at end of file +endfunction() From 2c4a3d5af6bd040fedcaeb4548251d1195c4a796 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 3 Sep 2024 23:13:11 +0200 Subject: [PATCH 15/25] fix/unify if-clause in build_tsmp2.sh --- build_tsmp2.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 9fd2ecf..2a63b85 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -134,14 +134,14 @@ set_compsrc clm35_src "CLM35_SRC" message "set CMAKE options" # build_config -if [[ -z $build_config ]];then +if [ -z "$build_config" ];then cmake_build_config="" else cmake_build_config=" -DCMAKE_BUILD_TYPE=${build_config}" fi # set compiler -if [[ -z $compiler ]];then +if [ -z "$compiler" ];then cmake_compiler="" else cmake_comiler=" -DCMAKE_CXX_COMPILER_ID=${compiler}" @@ -151,15 +151,15 @@ fi cmake_tsmp2_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # set INSTALL and BUILD DIR (neccesary for building) -if [ -z ${SYSTEMNAME} ]; then SYSTEMNAME="UNKN"; fi +if [ -z "${SYSTEMNAME}" ]; then SYSTEMNAME="UNKN"; fi -if [ -n ${build_dir} ]; then +if [ -z "${build_dir}" ]; then cmake_build_dir="${cmake_tsmp2_dir}/bld/${SYSTEMNAME^^}_${model_id}" else cmake_build_dir="${build_dir}" fi # build_dir -if [ -n ${install_dir} ]; then +if [ -z "${install_dir}" ]; then cmake_install_dir="-DCMAKE_INSTALL_PREFIX=${cmake_tsmp2_dir}/bin/${SYSTEMNAME^^}_${model_id}" else cmake_install_dir="-DCMAKE_INSTALL_PREFIX=${install_dir}" @@ -169,7 +169,7 @@ build_log="$(dirname ${cmake_build_dir})/${model_id}_$(date +%Y-%m-%d_%H-%M).log ## source environment message "source environment" -if [ -n ${tsmp2_env} ]; then +if [ -z "${tsmp2_env}" ]; then tsmp2_env="${cmake_tsmp2_dir}/env/jsc.2023_Intel.sh" else tsmp2_env="${tsmp2_env}" From 1ef5fffa03e31886e4eb4d474b5331197ac803ab Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 4 Sep 2024 15:13:06 +0200 Subject: [PATCH 16/25] Cloning of component submodules in build_tsmp2.sh --- README.md | 20 ++++---------------- build_tsmp2.sh | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4c26c17..41e4485 100644 --- a/README.md +++ b/README.md @@ -7,28 +7,16 @@ ```bash git clone https://github.com/HPSCTerrSys/TSMP2.git -export TSMP2_DIR=$(realpath TSMP2) cd $TSMP2_DIR ``` -2. Get model source code -Get needed submodules of component models. - -> [!NOTE] -> Please just download the submodules, which you need. E.g. if you want to run ICON-eCLM-ParFlow, you need to download the submodules `models/icon`,`models/eclm`,`models/parflow` and the coupler `models/oasis3-mct`. +2. Build model components with TSMP2 framework -```bash -git submodule update --init -- models/icon -git submodule update --init -- models/eCLM -git submodule update --init -- models/parflow -git submodule update --init -- models/oasis3-mct -git submodule update --init -- models/pdaf -git submodule update --init -- models/parflow_pdaf -``` +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. -3. Build model components with TSMP2 framework +> [!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 `--`. -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. ```bash # to see options diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 2a63b85..8519f3f 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -60,6 +60,32 @@ if [ -n "${compsrc_name}" ];then fi # compsrc } +function dwn_compsrc(){ +comp_name=$1 +local -n comp_namey=$1 +local -n comp_srcname=$2 +sub_srcname=$3 +if [ -n "${comp_namey}" ] && [ -z "${comp_srcname}" ];then + if [ "${comp_name}" = "parflow" ] && [ -n "${pdaf}" ];then + submodule_name=$(echo "models/${sub_srcname}_pdaf") + else + submodule_name=$(echo "models/"${sub_srcname}) + fi + if [ -d "${cmake_tsmp2_dir}/${submodule_name}" ];then + echo "submodule ${submodule_name} aleady exist. Do you want overwrite it? (y/n)" + read yn + if [ "${yn,}" = "y" ];then + message "Overwrite submodule ${submodule_name}" + git submodule update -- ${submodule_name} + else + message "Do not overwrite submodule ${submodule_name}" + fi + else + git submodule update --init -- ${submodule_name} + fi +fi # compsrc +} + function message(){ if [ -z "${quiet}" ];then echo "$1" @@ -100,6 +126,9 @@ while [[ "$#" -gt 0 ]]; do shift done +# Get tsmp2_dir (full path) from location of $0 +cmake_tsmp2_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + ## Create MODEL_ID + COMPONENT STRING model_id="" model_count=0 @@ -117,6 +146,8 @@ set_component clm35 "CLM35" if [ $model_count = 0 ];then echo "No model component is chosen" exit 1 +elif [ $model_count -ge 2 ];then + oasis=y fi ## CONCADINATE SOURCE CODE STRING @@ -130,6 +161,15 @@ set_compsrc pdaf_src "PDAF_SRC" set_compsrc cosmo_src "COSMO_SRC" set_compsrc clm35_src "CLM35_SRC" +## download model components +dwn_compsrc icon icon_src "icon" +dwn_compsrc eclm eclm_src "eCLM" +dwn_compsrc parflow parflow_src "parflow" +dwn_compsrc oasis oasis_src "oasis3-mct" +dwn_compsrc pdaf pdaf_src "pdaf" +dwn_compsrc cosmo cosmo_src "cosmo" +dwn_compsrc clm35 clm35_src "clm35" + ## CMAKE options message "set CMAKE options" @@ -147,9 +187,6 @@ else cmake_comiler=" -DCMAKE_CXX_COMPILER_ID=${compiler}" fi -# Get tsmp2_dir (full path) from location of $0 -cmake_tsmp2_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - # set INSTALL and BUILD DIR (neccesary for building) if [ -z "${SYSTEMNAME}" ]; then SYSTEMNAME="UNKN"; fi From 7c39c983ef1baad5a89deb6deaee9abde0bf0c89 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 4 Sep 2024 18:12:31 +0200 Subject: [PATCH 17/25] add branches to submodules --- .gitmodules | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitmodules b/.gitmodules index ad40ca8..df62a89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,24 @@ [submodule "models/icon"] path = models/icon url = https://gitlab.jsc.fz-juelich.de/sdlts/tsmp_components_mirrors/icon2.6.4_oascoup + branch = master [submodule "models/parflow"] path = models/parflow url = https://github.com/parflow/parflow.git + branch = master [submodule "models/parflow_pdaf"] path = models/parflow_pdaf url = https://github.com/HPSCTerrSys/parflow + branch = tsmp-pdaf [submodule "models/pdaf"] path = models/pdaf url = https://github.com/HPSCTerrSys/pdaf.git + branch = tsmp-pdaf-patched [submodule "models/eCLM"] path = models/eCLM url = https://github.com/HPSCTerrSys/eCLM.git + branch = master +[submodule "models/oasis3-mct"] + path = models/oasis3-mct + url = https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct + branch = v5.0_patched From e34789b612bcfce9adbb37d7ad3b219b0be61275 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 5 Sep 2024 18:44:05 +0200 Subject: [PATCH 18/25] add --init to submodule overwrite and fix ParFlow component name --- build_tsmp2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 8519f3f..30a21b0 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -46,7 +46,7 @@ if [ "${component}" = "y" ];then model_id+="-${cmake_name}" fi # model_id cmake_comp_str+=" -D${cmake_name}=ON" - if [[ $cmake_name = @(ICON|eCLM|PARFLOW|COSMO|CLM35) ]]; then + if [[ $cmake_name = @(ICON|eCLM|ParFlow|COSMO|CLM3.5) ]]; then model_count=$(( $model_count + 1 )) fi # cmake_name fi # component @@ -76,7 +76,7 @@ if [ -n "${comp_namey}" ] && [ -z "${comp_srcname}" ];then read yn if [ "${yn,}" = "y" ];then message "Overwrite submodule ${submodule_name}" - git submodule update -- ${submodule_name} + git submodule update --init -- ${submodule_name} else message "Do not overwrite submodule ${submodule_name}" fi @@ -138,10 +138,10 @@ message "set model-id and component string" # fun set_component shell_name cmake_name set_component icon "ICON" set_component eclm "eCLM" -set_component parflow "PARFLOW" +set_component parflow "ParFlow" set_component pdaf "PDAF" set_component cosmo "COSMO" -set_component clm35 "CLM35" +set_component clm35 "CLM3.5" if [ $model_count = 0 ];then echo "No model component is chosen" From 88f56532cbd9d78dec77a39ac41924cc056db9ba Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 5 Sep 2024 22:16:32 +0200 Subject: [PATCH 19/25] add CLM3.5 and COSMO5.01 as submodules --- .gitmodules | 8 ++++++++ README.md | 12 ++++++------ models/CLM3.5 | 1 + models/cosmo5.01_fresh | 1 + 4 files changed, 16 insertions(+), 6 deletions(-) create mode 160000 models/CLM3.5 create mode 160000 models/cosmo5.01_fresh diff --git a/.gitmodules b/.gitmodules index df62a89..e6b1861 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,11 @@ path = models/oasis3-mct url = https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct branch = v5.0_patched +[submodule "models/CLM3.5"] + path = models/CLM3.5 + url = https://github.com/HPSCTerrSys/CLM3.5.git + branch = tsmp-patches-v0.1 +[submodule "models/cosmo5.01_fresh"] + path = models/cosmo5.01_fresh + url = https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git + branch = tsmp-oasis diff --git a/README.md b/README.md index 41e4485..cebcc0a 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ mkdir -p ${BUILD_DIR} ${INSTALL_DIR} ## NOTE: Download only the component models that you need! ## # eCLM -git clone https://github.com/HPSCTerrSys/eCLM.git models/eclm -eCLM_SRC=`realpath models/eclm` +git clone https://github.com/HPSCTerrSys/eCLM.git models/eCLM +eCLM_SRC=`realpath models/eCLM` # ICON git clone https://icg4geo.icg.kfa-juelich.de/spoll/icon2.6.4_oascoup.git models/icon @@ -97,12 +97,12 @@ git clone -b v3.12.0-tsmp https://github.com/HPSCTerrSys/parflow models/parflow_ PARFLOW_SRC=`realpath models/parflow_pdaf` # CLM3.5 -git clone -b tsmp-patches-v0.1 https://github.com/HPSCTerrSys/CLM3.5.git models/clm35 -CLM35_SRC=`realpath models/clm35` +git clone -b tsmp-patches-v0.1 https://github.com/HPSCTerrSys/CLM3.5.git models/CLM3.5 +CLM35_SRC=`realpath models/CLM3.5` # COSMO5.01 -git clone -b tsmp-oasis https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git models/cosmo -COSMO_SRC=`realpath models/cosmo` +git clone -b tsmp-oasis https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git models/cosmo5.01_fresh +COSMO_SRC=`realpath models/cosmo5.01_fresh` # OASIS3-MCT (required for coupled models) git clone -b tsmp-patches-v0.1 https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct models/oasis3-mct diff --git a/models/CLM3.5 b/models/CLM3.5 new file mode 160000 index 0000000..9f1cfcc --- /dev/null +++ b/models/CLM3.5 @@ -0,0 +1 @@ +Subproject commit 9f1cfccef269556c4ee992fffb8a9afe1e4e32d8 diff --git a/models/cosmo5.01_fresh b/models/cosmo5.01_fresh new file mode 160000 index 0000000..91e02eb --- /dev/null +++ b/models/cosmo5.01_fresh @@ -0,0 +1 @@ +Subproject commit 91e02eb88ffd8eb251fcdc25cb575d14869dcdfd From ffb75f25bc1a84cb5ee2d0808320e46d745dec38 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Fri, 13 Sep 2024 00:04:32 +0200 Subject: [PATCH 20/25] update eCLM submodule --- models/eCLM | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/eCLM b/models/eCLM index c434963..4582f14 160000 --- a/models/eCLM +++ b/models/eCLM @@ -1 +1 @@ -Subproject commit c434963afc5bee1b34fbfdd4ac561a070198da29 +Subproject commit 4582f148490edf621cbc1a6f11692017bc344469 From 33ef15ba467735b5a53d35aa2e6c52fa8f55fa49 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Fri, 13 Sep 2024 00:21:22 +0200 Subject: [PATCH 21/25] remove source_dir option in build_tsmp2.sh, README typ-o - take cmake_tsmp2_dir as cmake source directory --- README.md | 2 +- build_tsmp2.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index cebcc0a..09fb098 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Quickstart > [!TIP] -> `build_tsmp2.sh` is a lightweighted shell-script calling the cmake-based build-system. During execution of `build_tsmp2.sh`, the executed CMake-command is printed out. For advanced build use-cases, users can modify the outputed CMake command or directly head over to [Building TSMP2 with CMake](#Building-TSMP2-with-CMake). +> `build_tsmp2.sh` is a lightweight shell-script calling the CMake-based build-system. During execution of `build_tsmp2.sh`, the executed CMake-command is printed out. For advanced build use-cases, users can modify the outputed CMake command or directly head over to [Building TSMP2 with CMake](#Building-TSMP2-with-CMake). 1. Clone this repository. diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 30a21b0..e41ddaa 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -27,7 +27,6 @@ function help_tsmp2() { echo " --PDAF_SRC Set PDAF_SRC directory" echo " --build_config Set build configuration: 'Debug' 'Release'" echo " --compiler Set compiler for building" - echo " --source_dir Set source dir of cmake" echo " --build_dir Set build dir cmake, if not set bld/_ is used. Build artifacts will be generated in this folder." echo " --install_dir Set install dir cmake, if not set bin/_ is used. Model executables and libraries will be installed here" echo " --tsmp2_env Set model environment." @@ -118,7 +117,6 @@ while [[ "$#" -gt 0 ]]; do --build_config) build_config="$2"; shift ;; --compiler) compiler="$2"; shift ;; --build_dir) build_dir="$2"; shift ;; - --source_dir) source_dir="$2"; shift ;; --install_dir) install_dir="$2"; shift ;; --tsmp2_env) tsmp2_env="$2"; shift ;; *) echo "Unknown parameter passed: $1"; exit 1 ;; From d61a0d49d418d9eb3040b293ad389435060d0ca8 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Fri, 13 Sep 2024 10:44:36 +0200 Subject: [PATCH 22/25] change submodule remote url of COSMO --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index e6b1861..d31661e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,5 +28,5 @@ branch = tsmp-patches-v0.1 [submodule "models/cosmo5.01_fresh"] path = models/cosmo5.01_fresh - url = https://icg4geo.icg.kfa-juelich.de/ModelSystems/tsmp_src/cosmo5.01_fresh.git + url = https://gitlab.jsc.fz-juelich.de/sdlts/tsmp_components_mirrors/cosmo5.01_fresh.git branch = tsmp-oasis From 89b1fc3f8455d56e467314b6d1df5074c1db2300 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 25 Sep 2024 14:05:01 +0200 Subject: [PATCH 23/25] fix submodule overwrite prompting --- build_tsmp2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index e41ddaa..5c1dcb5 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -70,7 +70,7 @@ if [ -n "${comp_namey}" ] && [ -z "${comp_srcname}" ];then else submodule_name=$(echo "models/"${sub_srcname}) fi - if [ -d "${cmake_tsmp2_dir}/${submodule_name}" ];then + if [ "$( ls -A ${cmake_tsmp2_dir}/${submodule_name} | wc -l)" -ne 0 ];then echo "submodule ${submodule_name} aleady exist. Do you want overwrite it? (y/n)" read yn if [ "${yn,}" = "y" ];then From f2c82f577c56ecc2f88cda9c808a0ac41664b10d Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 25 Sep 2024 14:06:26 +0200 Subject: [PATCH 24/25] update models/pdaf submodule --- models/pdaf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/pdaf b/models/pdaf index b8361a6..a2c3a4b 160000 --- a/models/pdaf +++ b/models/pdaf @@ -1 +1 @@ -Subproject commit b8361a61b55d98eb7fa90097a31f31075e094f9e +Subproject commit a2c3a4b69003dbfebe13bf8909f81288bbf19a20 From fe704e7f43b567c15bc848c4b93f5570cb707a2d Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Wed, 25 Sep 2024 17:47:54 +0200 Subject: [PATCH 25/25] include --force option when overwriting submodule --- build_tsmp2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tsmp2.sh b/build_tsmp2.sh index 5c1dcb5..7ee6eed 100755 --- a/build_tsmp2.sh +++ b/build_tsmp2.sh @@ -75,7 +75,7 @@ if [ -n "${comp_namey}" ] && [ -z "${comp_srcname}" ];then read yn if [ "${yn,}" = "y" ];then message "Overwrite submodule ${submodule_name}" - git submodule update --init -- ${submodule_name} + git submodule update --init --force -- ${submodule_name} else message "Do not overwrite submodule ${submodule_name}" fi