From bb1a44b1e0bfce86f85e42a87e432688748a3a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Mon, 13 Mar 2023 09:53:03 +0100 Subject: [PATCH] Add template to build enstools with spack. --- templates/build_enstools.sh | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 templates/build_enstools.sh diff --git a/templates/build_enstools.sh b/templates/build_enstools.sh new file mode 100644 index 0000000..7c6c2bb --- /dev/null +++ b/templates/build_enstools.sh @@ -0,0 +1,40 @@ +# Get some variables provided by autosubmit. +# TODO: What do we do to ensure that these variables are defined in the proj file? +WORKDIR=%HPCROOTDIR% +ICON_VERSION=%ICON_VERSION% +SPACK_URL=%spack.url% +SPACK_BRANCH=%spack.branch% +SPACK_COMPILER=%spack.compiler% + + +# If the workdir directory does not exist create it +if [ ! -d ${WORKDIR} ] ; then + mkdir -p ${WORKDIR} +fi + +# Go to the working directory +cd ${WORKDIR} + +# Check if experiment's spack installation already exists, if it doesn't, clone it. +SPACK_ENV=spack/share/spack/setup-env.sh +if [ ! -f ${SPACK_ENV} ] ; then + git clone ${SPACK_URL} -b ${SPACK_BRANCH} + #TODO: Would be good to enable the re-utilization of existing spack packages (via packages.yaml or upstreams.yaml) +fi + +# Setup the environment +source ${SPACK_ENV} + + +if [ $( spack find py-enstools-compression &> /dev/null ; echo $? ) -ne 0 ]; then + echo "Installing enstools-compression." + # Compile openmpi with schedulers=slurm + spack install py-enstools-compression +else + echo "py-enstools-compression already installed!" +fi + +# Link the python binary into the main folder so can be easily used later: + +spack load py-enstools-compression +ln -sf $(which python3) ${WORKDIR}/python3 \ No newline at end of file -- GitLab