Skip to content
Snippets Groups Projects
Commit 2026f625 authored by Fabian.Jakub's avatar Fabian.Jakub
Browse files

add spack config var to allow to search for externals

parent 8ced39fc
No related branches found
No related tags found
1 merge request!4Switching to the advanced configuration method and fixing spack build.
......@@ -5,6 +5,7 @@ spack:
init: "" # command to load spack environment, e.g. module load spack, use spack/setup-env.sh if empty
url: https://github.com/spack/spack.git # url to download spack if necessary
branch: develop # if downloaded, branch name to use
externals: "" # list of packages we try to find with spack external find
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
......
......@@ -6,6 +6,12 @@ function _install_spack() {
_init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT"
if [ ! -z "${SPACK_EXTERNALS}" ] ; then
for ext in ${SPACK_EXTERNALS}; do
spack external find $ext
done
fi
if [[ $(spack compiler info ${SPACK_COMPILER}) ]]; then
echo "Found Compiler $(spack compiler info ${SPACK_COMPILER})"
else
......@@ -32,10 +38,11 @@ function load_spack() {
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_CONFIG_PATH=$8 # i.e.: ${SPACK_ROOT}/spack_user_config_path
export SPACK_EXTERNALS=$5 # i.e.: slurm
export SPACK_COMPILER=$6 # i.e.: gcc@12.2.0
export SPACK_DISABLE_LOCAL_CONFIG=$7 # i.e.: true
export SPACK_USER_CACHE_PATH=$8 # i.e.: ${SPACK_ROOT}/spack_user_cache_path
export SPACK_USER_CONFIG_PATH=$9 # i.e.: ${SPACK_ROOT}/spack_user_config_path
if [ "$SPACK_DISABLE_LOCAL_CONFIG" != "True" ]; then
unset SPACK_DISABLE_LOCAL_CONFIG
......@@ -45,6 +52,7 @@ function load_spack() {
echo "SPACK_ROOT = $SPACK_ROOT"
echo "SPACK_URL = $SPACK_URL"
echo "SPACK_BRANCH = $SPACK_BRANCH"
echo "SPACK_EXTERNALS = $SPACK_EXTERNALS"
echo "SPACK_COMPILER = $SPACK_COMPILER"
echo "SPACK_DISABLE_LOCAL_CONFIG = ${SPACK_DISABLE_LOCAL_CONFIG:-False}"
echo "SPACK_USER_CACHE_PATH = $SPACK_USER_CACHE_PATH"
......
......@@ -14,7 +14,7 @@ cd ${WORKDIR} || exit
. ${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%" "%spack.user_config_path%"
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%"
if [ ! $(rpm -qa | grep bzip2) ]; then
spack install bzip2
......
......@@ -11,7 +11,7 @@ PYTHON_VERSION=%PYTHON_ENVIRONMENT.PYTHON_VERSION%
cd ${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%" "%spack.user_config_path%"
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%"
# Use spack to get a recent enough version of python3
......
......@@ -13,7 +13,7 @@ cd ${RUNDIR}
# Activate spack
. ${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%" "%spack.user_config_path%"
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%"
# Load icon module
spack load icon-nwp@%ICON_VERSION%
......
......@@ -9,7 +9,7 @@ EXTERNAL_PARAMETERS_FILE=%simulation.external_parameters_filename%
# Activate spack
. ${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%" "%spack.user_config_path%"
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%"
# Load icon module needed to retrieve some data
spack load icon-nwp@%ICON_VERSION%
......
......@@ -7,7 +7,7 @@ RADIATION_GRID_FILE=%simulation.radiation_grid_filename%
# Activate spack
. ${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%" "%spack.user_config_path%"
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%"
# Load icon module needed to retrieve some data
spack load icon-nwp@%ICON_VERSION%
......
......@@ -12,7 +12,7 @@ cd ${RUNDIR}
# Activate spack
. ${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%" "%spack.user_config_path%"
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%"
# Load icon module
spack load icon-nwp@%ICON_VERSION%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment