diff --git a/conf/common/build.yml b/conf/common/build.yml index 2b31549bd0327f5b416e7b8bb24696ea10fe2ea6..2dc1e57a7d4e964d6b19534ffb997f3a8aa6e6ec 100644 --- a/conf/common/build.yml +++ b/conf/common/build.yml @@ -8,6 +8,7 @@ spack: compiler: gcc@12.2.0 # desired compiler for spack root: "%HPCROOTDIR%/spack" # path to a spack install, will be downloaded to if not present user_cache_path: "%HPCROOTDIR%/spack_user_cache_path" # spack puts data here when bootstrapping, leave empty to use home folder + user_config_path: "%HPCROOTDIR%/spack_user_config_path" # spack puts data here when bootstrapping, leave empty to use home folder disable_local_config: true # if false, spack install into home folder build_cmd: "icon-nwp@%ICON.VERSION%% %SPACK.COMPILER% ^openmpi+pmi+legacylaunchers schedulers=slurm fabrics=ucx ucx+dc+dm+ib_hw_tm+mlx5_dv+rc+rdmacm+thread_multiple+ud+verbs ^gettext@0.20.2 " diff --git a/platforms/common/spack_utils.sh b/platforms/common/spack_utils.sh index 1ad23dd71537acda11910ff6212096632cb66476..b4708e9eca434c03609fc3b366abc61254017f52 100644 --- a/platforms/common/spack_utils.sh +++ b/platforms/common/spack_utils.sh @@ -29,12 +29,13 @@ function _init_spack() { function load_spack() { export SPACK_INIT_CMD=$1 - export SPACK_ROOT=$2 # i.e.: spack - export SPACK_URL=$3 # i.e.: https://github.com/spack/spack.git - export SPACK_BRANCH=$4 # i.e.: develop - export SPACK_COMPILER=$5 # i.e.: gcc@12.2.0 + export SPACK_ROOT=$2 # i.e.: spack + export SPACK_URL=$3 # i.e.: https://github.com/spack/spack.git + export SPACK_BRANCH=$4 # i.e.: develop + export SPACK_COMPILER=$5 # i.e.: gcc@12.2.0 export SPACK_DISABLE_LOCAL_CONFIG=$6 # i.e.: true - export SPACK_USER_CACHE_PATH=$7 # i.e.: ${SPACK_ROOT}/spack_user_cache_path + export SPACK_USER_CACHE_PATH=$7 # i.e.: ${SPACK_ROOT}/spack_user_cache_path + export SPACK_USER_CONFIG_PATH=$8 # i.e.: ${SPACK_ROOT}/spack_user_config_path echo "SPACK_INIT_CMD = $SPACK_INIT_CMD" echo "SPACK_ROOT = $SPACK_ROOT" @@ -43,11 +44,16 @@ function load_spack() { echo "SPACK_COMPILER = $SPACK_COMPILER" echo "SPACK_DISABLE_LOCAL_CONFIG = $SPACK_DISABLE_LOCAL_CONFIG" echo "SPACK_USER_CACHE_PATH = $SPACK_USER_CACHE_PATH" + echo "SPACK_USER_CONFIG_PATH = $SPACK_USER_CONFIG_PATH" if [ -z "$SPACK_USER_CACHE_PATH" ]; then unset SPACK_USER_CACHE_PATH fi + if [ -z "$SPACK_USER_CONFIG_PATH" ]; then + unset SPACK_USER_CONFIG_PATH + fi + if [ ! -e ${SPACK_ROOT} ] && [ ! -z "${SPACK_ROOT}" ]; then _install_spack; fi _init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT" diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh index 6c4e7641389cd362897ce9652c22238bbab67004..d462710e40c6afda3defaca3ce01734b29cf0974 100644 --- a/templates/common/build_icon.sh +++ b/templates/common/build_icon.sh @@ -11,8 +11,13 @@ fi # Go to the working directory cd ${WORKDIR} + +export SPACK_USER_CONFIG_PATH=${WORKDIR}/ + . ${WORKDIR}/proj/platforms/common/spack_utils.sh -load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" +load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%" + + SPACK_BUILD_ICON="%spack.build_cmd%" if [ ! -z "$SPACK_BUILD_ICON" ]; then