From 941a0607ddc8dcf90933440e71da9ed567ae711d Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Thu, 26 Jun 2025 12:44:53 +0200 Subject: [PATCH] Follow-up fixes for PR #4259 --- ci/docker/build_deps_spack.Dockerfile | 33 ++++++++++++++++------- ci/docker/build_deps_toolchain.Dockerfile | 2 +- tools/spack/cp2k_deps_all_psmp.yaml | 4 +-- tools/spack/cp2k_deps_all_ssmp.yaml | 2 +- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ci/docker/build_deps_spack.Dockerfile b/ci/docker/build_deps_spack.Dockerfile index 18476a086f..96dcf4ad89 100644 --- a/ci/docker/build_deps_spack.Dockerfile +++ b/ci/docker/build_deps_spack.Dockerfile @@ -44,15 +44,27 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ ARG NUM_PROCS ENV NUM_PROCS=${NUM_PROCS:-32} -# Install a recent Spack version +# Install Spack and Spack packages WORKDIR /root/spack ARG SPACK_VERSION -ENV SPACK_VERSION=${SPACK_VERSION:-develop-2025-05-18} -RUN git init --quiet && \ - git remote add origin https://github.com/spack/spack.git && \ - git fetch --quiet --depth 1 origin ${SPACK_VERSION} --no-tags && \ - git checkout --quiet FETCH_HEAD -ENV PATH="/root/spack/bin:${PATH}" +ENV SPACK_VERSION=${SPACK_VERSION:-2e7168b4cfe9222a94becf0c2c5b401f513181ec} +ARG SPACK_PACKAGES_VERSION +ENV SPACK_PACKAGES_VERSION=${SPACK_PACKAGES_VERSION:-c63151a5baffcd96978966cd5ed83a6b8328e026} +ARG SPACK_REPO=https://github.com/spack/spack +ENV SPACK_ROOT=/opt/spack-${SPACK_VERSION} +ARG SPACK_PACKAGES_REPO=https://github.com/spack/spack-packages +ENV SPACK_PACKAGES_ROOT=/opt/spack-packages-${SPACK_PACKAGES_VERSION} +RUN mkdir -p ${SPACK_ROOT} \ + && wget -q ${SPACK_REPO}/archive/${SPACK_VERSION}.tar.gz \ + && tar -xzf ${SPACK_VERSION}.tar.gz -C /opt && rm -f ${SPACK_VERSION}.tar.gz \ + && mkdir -p ${SPACK_PACKAGES_ROOT} \ + && wget -q ${SPACK_PACKAGES_REPO}/archive/${SPACK_PACKAGES_VERSION}.tar.gz \ + && tar -xzf ${SPACK_PACKAGES_VERSION}.tar.gz -C /opt && rm -f ${SPACK_PACKAGES_VERSION}.tar.gz + +ENV PATH="${SPACK_ROOT}/bin:${PATH}" + +# Add Spack packages builtin repository +RUN spack repo add --scope site ${SPACK_PACKAGES_ROOT}/repos/spack_repo/builtin # Find all compilers RUN spack compiler find @@ -65,8 +77,9 @@ ARG CP2K_VERSION ENV CP2K_VERSION=${CP2K_VERSION:-ssmp} ARG CP2K_BUILD_TYPE ENV CP2K_BUILD_TYPE=${CP2K_BUILD_TYPE:-minimal} -COPY ./tools/spack/repo.yaml ./tools/spack/cp2k_deps_${CP2K_BUILD_TYPE}_${CP2K_VERSION}.yaml ./ -COPY ./tools/spack/packages ./packages +COPY ./tools/spack/cp2k_deps_${CP2K_BUILD_TYPE}_${CP2K_VERSION}.yaml ./ +COPY ./tools/spack/cp2k_dev_repo ${SPACK_PACKAGES_ROOT}/repos/spack_repo/cp2k_dev_repo/ +RUN spack repo add --scope site ${SPACK_PACKAGES_ROOT}/repos/spack_repo/cp2k_dev_repo/ # Sarus containers must be dynamically linked to an MPI implementation that is ABI-compatible # with the MPI on the compute nodes at CSCS like MPICH@3 @@ -78,7 +91,7 @@ RUN spack env create myenv cp2k_deps_${CP2K_BUILD_TYPE}_${CP2K_VERSION}.yaml && # Install CP2K dependencies via Spack RUN spack -e myenv concretize -f -ENV SPACK_ENV_VIEW="/root/spack/var/spack/environments/myenv/spack-env/view" +ENV SPACK_ENV_VIEW="${SPACK_ROOT}/var/spack/environments/myenv/spack-env/view" RUN spack -e myenv env depfile -o spack_makefile && \ make -j${NUM_PROCS} --file=spack_makefile SPACK_COLOR=never --output-sync=recurse && \ cp -ar ${SPACK_ENV_VIEW}/bin ${SPACK_ENV_VIEW}/include ${SPACK_ENV_VIEW}/lib /opt/spack diff --git a/ci/docker/build_deps_toolchain.Dockerfile b/ci/docker/build_deps_toolchain.Dockerfile index 6313129be4..c47978f540 100644 --- a/ci/docker/build_deps_toolchain.Dockerfile +++ b/ci/docker/build_deps_toolchain.Dockerfile @@ -39,7 +39,7 @@ ENV NUM_PROCS=${NUM_PROCS:-32} # Retrieve the maximum number log file lines printed on error ARG LOG_LINES -ENV LOG_LINES=${LOG_LINES:-100} +ENV LOG_LINES=${LOG_LINES:-200} ARG CP2K_VERSION ENV CP2K_VERSION=${CP2K_VERSION:-psmp} diff --git a/tools/spack/cp2k_deps_all_psmp.yaml b/tools/spack/cp2k_deps_all_psmp.yaml index 1223e54024..12f289e86d 100644 --- a/tools/spack/cp2k_deps_all_psmp.yaml +++ b/tools/spack/cp2k_deps_all_psmp.yaml @@ -112,10 +112,10 @@ spack: - "libvori@220621" - "libxc@7.0.0" # - "libxsmm@main-2024-09" Use 1.17 with Spack as long as grid unit tests fail - - "libxsmm@1.17" +# - "libxsmm@1.17" - "pexsi@2.0.0" - "plumed@2.9.2" - - "py-torch@2.6" + - "py-torch@2.7" - "sirius@7.7.0" - "spglib@2.5.0" - "spla@1.6.1" diff --git a/tools/spack/cp2k_deps_all_ssmp.yaml b/tools/spack/cp2k_deps_all_ssmp.yaml index 780fd1c9c3..b7e5f8486a 100644 --- a/tools/spack/cp2k_deps_all_ssmp.yaml +++ b/tools/spack/cp2k_deps_all_ssmp.yaml @@ -74,7 +74,7 @@ spack: - "libvori@220621" - "libxc@7.0.0" # - "libxsmm@main-2024-09" Use 1.17 with Spack as long as grid unit tests fail - - "libxsmm@1.17" +# - "libxsmm@1.17" - "py-torch@2.6" - "spglib@2.5.0" - "trexio@2.5.0"