Skip to content
Snippets Groups Projects
Commit d1cc0720 authored by Oriol Tintó Prims's avatar Oriol Tintó Prims
Browse files

Fix build_python_environment.sh adding a new python variable in the...

Fix build_python_environment.sh adding a new python variable in the configuration file. Also loading the first occurrence of python in case of multiple matches.
parent 734bdb25
No related branches found
No related tags found
1 merge request!4Switching to the advanced configuration method and fixing spack build.
...@@ -15,6 +15,7 @@ spack: ...@@ -15,6 +15,7 @@ spack:
python_environment: python_environment:
# Name of the virtual environment in the remote platform experiment folder # Name of the virtual environment in the remote platform experiment folder
folder_name: python_environment folder_name: python_environment
python_version: "3.8:" # In spack notation use x: to indicate at least x
requirements: requirements:
# Because there's an issue with numba, for now we need to keep a specific version of numpy # Because there's an issue with numba, for now we need to keep a specific version of numpy
- numpy==1.23 - numpy==1.23
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
# TODO: What do we do to ensure that these variables are defined in the proj file? # TODO: What do we do to ensure that these variables are defined in the proj file?
WORKDIR=%HPCROOTDIR% WORKDIR=%HPCROOTDIR%
ICON_VERSION=%ICON_VERSION% ICON_VERSION=%ICON_VERSION%
SPACK_URL=%spack.url% SPACK_URL=%SPACK.URL%
SPACK_BRANCH=%spack.branch% SPACK_BRANCH=%SPACK.BRANCH%
SPACK_COMPILER=%spack.compiler% SPACK_COMPILER=%SPACK.COMPILER%
PYTHON_VERSION=%PYTHON_ENVIRONMENT.PYTHON_VERSION%
# Go to the working directory # Go to the working directory
cd ${WORKDIR} cd ${WORKDIR}
...@@ -14,16 +15,16 @@ load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack. ...@@ -14,16 +15,16 @@ load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.
# Use spack to get a recent enough version of python3 # Use spack to get a recent enough version of python3
if [ $(spack find python@3.8: &>/dev/null ) ]; then if [ $(spack find python@${PYTHON_VERSION}: &>/dev/null ) ]; then
echo "python@3.8: already installed!" echo "python@${PYTHON_VERSION} already installed!"
else else
echo "Installing a version of python3" echo "Installing a version of python3"
# Compile openmpi with schedulers=slurm # Compile openmpi with schedulers=slurm
spack install python@3.8: spack install python@${PYTHON_VERSION}
fi fi
# Load the python module # Load the python module
spack load python spack load --first python@${PYTHON_VERSION}
PYTHON_ENVIRONMENT_FOLDER=%python_environment.folder_name% PYTHON_ENVIRONMENT_FOLDER=%python_environment.folder_name%
......
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