diff --git a/conf/common/build.yml b/conf/common/build.yml index 84dd9b1ebbb8e50d1f0f810c977206cab66f2f8e..249a1af969770677fe141cad1fef77f2990e346e 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 icon: diff --git a/platforms/common/spack_utils.sh b/platforms/common/spack_utils.sh index 6627c0ec4bec7ab03e247c8ead10d312a54b0c46..f336447b7192d00fe48b523f71820baf80fb0cff 100644 --- a/platforms/common/spack_utils.sh +++ b/platforms/common/spack_utils.sh @@ -16,8 +16,8 @@ function _install_spack() { } function _init_spack() { - #SPACK_INIT_CMD=$1 - #SPACK_ROOT=$2 + SPACK_INIT_CMD=$1 + SPACK_ROOT=$2 if [ -z "$SPACK_INIT_CMD" ] && [ ! -z "${SPACK_ROOT}" ]; then echo "Empty SPACK_INIT_CMD -> trying to source config file of spack root: $SPACK_ROOT/share/spack/setup-env.sh" . $SPACK_ROOT/share/spack/setup-env.sh @@ -29,20 +29,26 @@ function _init_spack() { function load_spack() { export SPACK_INIT_CMD=$1 - export SPACK_ROOT=${2:-spack} - export SPACK_URL=${3:-https://github.com/spack/spack.git} - export SPACK_BRANCH=${4:-develop} - export SPACK_COMPILER=${5:-gcc@12.2.0} - export SPACK_DISABLE_LOCAL_CONFIG=${6:-true} - export SPACK_USER_CACHE_PATH=${7:-${SPACK_ROOT}/spack_user_cache_path} + 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 + + if [ "$SPACK_DISABLE_LOCAL_CONFIG" != "True" ]; then + unset SPACK_DISABLE_LOCAL_CONFIG + fi echo "SPACK_INIT_CMD = $SPACK_INIT_CMD" echo "SPACK_ROOT = $SPACK_ROOT" echo "SPACK_URL = $SPACK_URL" echo "SPACK_BRANCH = $SPACK_BRANCH" echo "SPACK_COMPILER = $SPACK_COMPILER" - echo "SPACK_DISABLE_LOCAL_CONFIG = $SPACK_DISABLE_LOCAL_CONFIG" + echo "SPACK_DISABLE_LOCAL_CONFIG = ${SPACK_DISABLE_LOCAL_CONFIG:-False}" 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 @@ -50,6 +56,10 @@ function load_spack() { if [ ! -z "${SPACK_ROOT}" ] ; then _install_spack; fi + if [ -z "$SPACK_USER_CONFIG_PATH" ]; then + unset SPACK_USER_CONFIG_PATH + fi + _init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT" echo "Using spack from $(which spack)" diff --git a/spack_repo/packages/dwd-icon-tools/package.py b/spack_repo/packages/dwd-icon-tools/package.py index 7614cd578e705caf49db8b17db981ae18d72bfd9..fb032c8b65c9258e325b8b9fbfdbf9c5d71acf13 100644 --- a/spack_repo/packages/dwd-icon-tools/package.py +++ b/spack_repo/packages/dwd-icon-tools/package.py @@ -28,6 +28,7 @@ class DwdIconTools(Package): """DWD Icon Tools""" homepage = "https://www.example.com" + # maintainers("oriol.tinto") git = "ssh://git@gitlab.lrz.de/dkrz-mirror/dwd_icon_tools.git" version("2.5.2", branch="icontools-2.5.2") diff --git a/spack_repo/packages/icon-nwp/package.py b/spack_repo/packages/icon-nwp/package.py index 72e9a89b51d58a6f7a591df698511459a706e5b4..11638d41932df6fefc7cd31f59bbdab9a5409b99 100644 --- a/spack_repo/packages/icon-nwp/package.py +++ b/spack_repo/packages/icon-nwp/package.py @@ -13,6 +13,7 @@ class IconNwp(Package): """ homepage = "https://code.mpimet.mpg.de/projects/iconpublic" + # maintainers("oriol.tinto") # Main repository (pointing to LMU's gitlab) git = "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git" diff --git a/spack_repo/packages/sz3/package.py b/spack_repo/packages/sz3/package.py new file mode 100644 index 0000000000000000000000000000000000000000..b2bcbd3e9b4c15a4a641e974539e08db4723daa3 --- /dev/null +++ b/spack_repo/packages/sz3/package.py @@ -0,0 +1,53 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Sz3(CMakePackage): + """SZ3 is the next generation of the SZ compressor framework""" + + homepage = "https://github.com/szcompressor/SZ3" + git = "https://github.com/szcompressor/SZ3" + + # maintainers("disheng222") + tags = ["e4s"] + + version("master") + version("3.1.7", commit="c49fd17f2d908835c41000c1286c510046c0480e") + version("3.1.5.4", commit="4c6ddf628f27d36b28d1bbda02174359cd05573d") + version("3.1.5.1", commit="5736a63b917e439dd62248b4ff6234e96726af5d") + version("3.1.3.1", commit="323cb17b412d657c4be681b52c34beaf933fe7af") + version("3.1.3", commit="695dff8dc326f3b165f6676d810f46add088a585") + + variant("hdf5", default=False, description="enable hdf5 filter support") + variant("mdz", default=True, description="build mdz executable") + + depends_on("zstd") + depends_on("gsl") + depends_on("pkgconfig") + depends_on("hdf5", when="+hdf5") + + def setup_run_environment(self, env): + if "+hdf5" in self.spec: + env.prepend_path("HDF5_PLUGIN_PATH", self.prefix.lib64) + + def cmake_args(self): + return [ + "-DSZ3_USE_BUNDLED_ZSTD=OFF", + "-DSZ3_DEBUG_TIMINGS=OFF", + self.define_from_variant("BUILD_MDZ", "mdz"), + self.define_from_variant("BUILD_H5Z_FILTER", "hdf5"), + ] + + def test(self): + if self.spec.satisfies("@:3.1.6"): + print("smoke tests are only supported on 3.1.7 and later, skipping") + return + + self.run_test(self.prefix.bin.sz3_smoke_test, purpose="sz3 works") + + if "+mdz" in self.spec: + self.run_test(self.prefix.bin.mdz_smoke_test, purpose="mdz works") diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh index 3e21f2a904ee2f11c8c08bd91735192d32719eac..6131a04c976fe61d2e579ae744e0ba49f7b3bbf3 100644 --- a/templates/common/build_icon.sh +++ b/templates/common/build_icon.sh @@ -11,15 +11,20 @@ fi # Go to the working directory 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%" +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 echo "Installing ICON with spack!" echo "cmd=$SPACK_BUILD_ICON" # In case the autosubmit repository with the icon-nwp receipt doesn't exist, add it - if [ $(spack repo list | grep autosubmit-icon-repository -q) ]; then + if [[ $(spack repo list | grep "${WORKDIR}/proj/spack_repo") ]]; then + echo "icon spack repo was already added to repo list" + else spack repo add ${WORKDIR}/proj/spack_repo fi spack install $SPACK_BUILD_ICON