From 175fc7b99238a2ab882e507999527ad3dfee1503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Thu, 25 May 2023 09:46:31 +0200 Subject: [PATCH] Including an icon.load_cmd for the cases where the build command includes a hash that can't be used for load. Defaults to the value of icon.build_cmd --- conf/common/build.yml | 6 ++++++ templates/common/build_icon.sh | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/common/build.yml b/conf/common/build.yml index 4521d09..d235d17 100644 --- a/conf/common/build.yml +++ b/conf/common/build.yml @@ -23,6 +23,12 @@ icon: # spack.compiler: "gcc@11.2.0/bcn7mbu" # spack.upstreams: "/sw/spack-levante/" # build_cmd: "icon-nwp@%ICON.VERSION%%gcc@11.2.0 source=dkrz_https ^openmpi@4.1.2%gcc@11.2.0 ^hdf5%gcc@11.2.0+fortran+hl" + + # The load_cmd will be used to load icon-nwp with spack + # in most cases it can be the same value as the build_cmd, but for some cases where using dependencies with a + # specific hash it doesn't work anymore. For those cases, the default value can be replaced by the build_cmd without + # the dependencies with hash. + load_cmd: "%icon.build_cmd%" version: master # The latest release at the moment of creating this file was 2.6.5-nwp0 python_environment: diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh index 0b53ce4..6558938 100644 --- a/templates/common/build_icon.sh +++ b/templates/common/build_icon.sh @@ -23,6 +23,8 @@ if [ ! $(rpm -qa | grep bzip2) ]; then fi SPACK_BUILD_ICON="%ICON.BUILD_CMD%" +SPACK_LOAD_ICON="%ICON.LOAD_CMD%" + if [ ! -z "$SPACK_BUILD_ICON" ]; then echo "Installing ICON with spack!" echo "cmd=$SPACK_BUILD_ICON" @@ -36,7 +38,7 @@ if [ ! -z "$SPACK_BUILD_ICON" ]; then spack install --reuse $SPACK_BUILD_ICON #TODO: had some problems with spack load when more than one version is available, adding --first to overcome that # although in principle we should not install the model if its already installed. - spack load --first $SPACK_BUILD_ICON + spack load --first ${SPACK_LOAD_ICON} else echo "\%icon.build_cmd\% is not defined. If you want to compile icon with spack, please provide a spack compile instruction string in your build.yml" fi -- GitLab