From 0ace322d61d82bfb164c0662d3c2bcaab0a0e6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Wed, 6 Sep 2023 09:22:58 +0200 Subject: [PATCH] Build Icon creates a file called icon_environment.env which can be sourced to set up the proper environment to run icon. --- templates/common/build_icon.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh index c73a72b..188a64f 100644 --- a/templates/common/build_icon.sh +++ b/templates/common/build_icon.sh @@ -70,3 +70,31 @@ if [ ! -f "${definitions_tar_file}" ]; then # Create a file containing the environment variable that needs to be set in order to use DWD's definitions: echo "export ECCODES_DEFINITION_PATH=${WORKDIR}/definitions.edzw-${eccodes_version}-1" >eccodes_defs.env fi + + +# Create a file to set the proper environment to run ICON: + +cat >icon_environment.env <<EOF + # This file loads the proper environment to run icon. +# Activate spack +. ${WORKDIR}/proj/platforms/common/spack_utils.sh +load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.externals%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%" "%spack.upstreams%" + + +# Get proper load command. +SPACK_BUILD_ICON="%ICON.BUILD_CMD%" +SPACK_LOAD_ICON="%ICON.LOAD_CMD%" + +if [ "${SPACK_LOAD_ICON}" == "build_cmd" ]; then + SPACK_LOAD_ICON=${SPACK_BUILD_ICON} +fi +# Load icon module +spack load --first ${SPACK_LOAD_ICON} + +# Set environment variable for eccodes-dwd definitions: +source ${WORKDIR}/eccodes_defs.env + +# Increase stack size limit +ulimit -s unlimited + +EOF \ No newline at end of file -- GitLab