From fe07ba5a00bef36afcbcd33afc2309a2fd291759 Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Fri, 20 Feb 2026 15:50:32 +0100 Subject: [PATCH] Replace the unreliable ldd by ldconfig to detect all library paths needed by the CP2K binary - Pin ninja version after removing the package from the base image installation - Update Rocky Linux version from 9.3 to 10 (latest) - Remove CMake cleaning step, because it causes that CP2K is always recompiled from scratch which is a feature already covered by the --rebuild_cp2k flag on user request - Move back from lscpu to nproc, because lscpu provides always a host view also within containers whereas nproc shows the container-visible CPUs (cgroup limits) --- make_cp2k.sh | 105 ++++++++++-------- .../docker/Dockerfile.test_spack_openmpi-psmp | 4 + tools/docker/Dockerfile.test_spack_psmp | 4 + tools/docker/Dockerfile.test_spack_psmp-4x2 | 4 + tools/docker/Dockerfile.test_spack_psmp-P100 | 4 + .../docker/Dockerfile.test_spack_psmp-fedora | 4 + tools/docker/Dockerfile.test_spack_psmp-gcc10 | 4 + tools/docker/Dockerfile.test_spack_psmp-gcc11 | 4 + tools/docker/Dockerfile.test_spack_psmp-gcc12 | 4 + tools/docker/Dockerfile.test_spack_psmp-gcc14 | 4 + tools/docker/Dockerfile.test_spack_psmp-gcc15 | 4 + .../Dockerfile.test_spack_psmp-opensuse | 4 + .../docker/Dockerfile.test_spack_psmp-rawhide | 4 + .../Dockerfile.test_spack_psmp-rockylinux | 24 ++-- tools/docker/Dockerfile.test_spack_ssmp | 4 + tools/docker/Dockerfile.test_spack_ssmp-P100 | 4 + .../docker/Dockerfile.test_spack_ssmp-rawhide | 4 + .../docker/Dockerfile.test_spack_ssmp-static | 4 + tools/docker/generate_dockerfiles.py | 23 ++-- tools/spack/cp2k_deps_psmp.yaml | 2 +- tools/spack/cp2k_deps_ssmp-static.yaml | 2 +- tools/spack/cp2k_deps_ssmp.yaml | 2 +- 22 files changed, 150 insertions(+), 72 deletions(-) diff --git a/make_cp2k.sh b/make_cp2k.sh index 797690a688..db68caf69e 100755 --- a/make_cp2k.sh +++ b/make_cp2k.sh @@ -144,8 +144,8 @@ HAS_PODMAN="no" HELP="no" INSTALL_MESSAGE="NEVER" MPI_MODE="mpich" -if command -v lscpu &> /dev/null; then - MAX_PROCS="$(lscpu -p=Core,Socket | grep -v '#' | sort -u | wc -l)" +if command -v nproc &> /dev/null; then + MAX_PROCS=$(nproc) NUM_PROCS=${NUM_PROCS:-${MAX_PROCS}} else MAX_PROCS=-1 @@ -242,6 +242,8 @@ while [[ $# -gt 0 ]]; do SED_PATTERN_LIST+=" -e '/\s*-\s+\"${2,,}@/ ${SUBST}" ;; deepmd | libtorch) + CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_DEEPMD=${ON_OFF}" + CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_LIBTORCH=${ON_OFF}" SED_PATTERN_LIST+=" -e '/\s*-\s+\"${2,,}kit@/ ${SUBST}" SED_PATTERN_LIST+=" -e '/\s*-\s+\"py-torch@/ ${SUBST}" ;; @@ -264,6 +266,8 @@ while [[ $# -gt 0 ]]; do SED_PATTERN_LIST+=" -e '/\s*-\s+\"mimic-mcl@/ ${SUBST}" ;; openpmd | adios2) + CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_ADIOS2=${ON_OFF}" + CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_OPENPMD=${ON_OFF}" SED_PATTERN_LIST+=" -e '/\s*-\s+\"adios2@/ ${SUBST}" SED_PATTERN_LIST+=" -e '/\s*-\s+\"openpmd-api@/ ${SUBST}" ;; @@ -273,8 +277,8 @@ while [[ $# -gt 0 ]]; do esac ;; libvdwxc | spfft | spla | sirius) - echo "WARNING: You've enabled or disabled one of libvdwxc/spfft/spla/sirius, so" - echo " the rest packages of them will also be enabled or disabled!" + echo "WARNING: You have enabled or disabled one of the packages libvdwxc, spfft, spla, sirius" + echo " which means that the other packages will also be enabled or disabled" CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_LIBVDWXC=${ON_OFF} -DCP2K_USE_SpFFT=${ON_OFF}" CMAKE_FEATURE_FLAGS+=" -DCP2K_USE_SPLA=${ON_OFF} -DCP2K_USE_SIRIUS=${ON_OFF}" SED_PATTERN_LIST+=" -e '/\s*-\s+\"libvdwxc@/ ${SUBST}" @@ -775,14 +779,14 @@ if [[ ! -d "${SPACK_BUILD_PATH}" ]]; then if [[ "${DISABLE_LOCAL_CACHE}" == "no" ]]; then export SPACK_CACHE=${SPACK_CACHE:-"s3://spack-cache --s3-endpoint-url=http://localhost:9000"} echo "SPACK_CACHE = \"${SPACK_CACHE}\"" - fi - spack mirror list - if ! spack mirror list | grep -q "local-cache"; then - echo "Setting up local spack cache" - if ((VERBOSE > 0)); then - "${CP2K_ROOT}"/tools/docker/scripts/setup_spack_cache.sh - else - "${CP2K_ROOT}"/tools/docker/scripts/setup_spack_cache.sh &> /dev/null + spack mirror list + if ! spack mirror list | grep -q "local-cache"; then + echo "Setting up local spack cache" + if ((VERBOSE > 0)); then + "${CP2K_ROOT}"/tools/docker/scripts/setup_spack_cache.sh + else + "${CP2K_ROOT}"/tools/docker/scripts/setup_spack_cache.sh &> /dev/null + fi fi else echo "INFO: A local Spack cache is NOT used" @@ -824,10 +828,12 @@ if [[ ! -d "${SPACK_BUILD_PATH}" ]]; then fi # Find all compilers + echo "Searching for GCC compilers" if ! spack compiler find &> /dev/null; then echo "ERROR: The compiler detection of spack failed" ${EXIT_CMD} 1 fi + spack compiler list # Retrieve the newest compiler version found by spack GCC_VERSION_NEWEST="$(spack compilers | awk '/gcc/ {print $2}' | sort -V | tail -n 1)" @@ -1133,10 +1139,6 @@ if ((EXIT_CODE != 0)); then ${EXIT_CMD} "${EXIT_CODE}" fi -# Clean cached files in build directory after installation -echo -e '\n*** Cleaning cached files in build directory after installation ***\n' -cmake --build "${CMAKE_BUILD_PATH}" --target clean > /dev/null 2>&1 - # Collect and compress all log files when building within a container if [[ "${IN_CONTAINER}" == "yes" ]]; then if ! cat "${CMAKE_BUILD_PATH}"/cmake.log \ @@ -1151,43 +1153,51 @@ fi # Cut extension from the CP2K version (e.g. ssmp-static -> ssmp) export VERSION=${CP2K_VERSION%%-*} -# Add CP2K lib folder to library search path -LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}" +# Add CP2K lib folder to the LD_LIBRARY_PATH +export LD_LIBRARY_PATH="${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}" -# Retrieve paths to "hidden" libraries -echo -e "\nLD_LIBRARY_PATH = \"${LD_LIBRARY_PATH}\"" -if ldd -- "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" 2>&1 | grep -qE '\s=>\snot found'; then - echo -e "\n*** Some libraries referenced by the CP2K binary are NOT found:" - ldd -- "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" 2>&1 | grep -E '\s=>\snot found' | sort | uniq - echo -e "\n*** Trying to update the LD_LIBRARY_PATH\n" - # Assemble all search paths for libraries - SEARCH_PATHS="${SPACK_ROOT}/opt/spack/view ${INSTALL_PREFIX}/lib" - # Search for missing libraries - for libname in $(ldd -- "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" 2>&1 | grep -E '\s=>\snot found' | awk '{print $1}' | sort | uniq); do +# Assemble search paths for libraries +search_paths="${SPACK_ROOT}/opt/spack/view ${INSTALL_PREFIX}/lib" + +# Retrieve paths to all libraries needed by the CP2k binary +for library in $(readelf -d "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" | awk '/NEEDED/{print $5}' | tr -d '[]'); do + # Search for missing library path + if ! ldconfig -p | grep -qE "/${library}$"; then # shellcheck disable=SC2086 - library=$(find -L ${SEARCH_PATHS} -name "${libname}" | tail -n 1) - library_path="$(dirname "${library}")" - if [[ -n "${library_path}" ]]; then + library_with_path=$(find -L ${search_paths} -name "${library}" | tail -n 1) + if [[ -n "${library_with_path}" ]]; then + library_path="$(dirname "${library_with_path}")" case ":${LD_LIBRARY_PATH}:" in *":${library_path}:"*) - echo "The library path ${library_path} is already present ... skipping" + ((VERBOSE > 1)) && echo "The library path ${library_path} is already present ... skipping" ;; *) LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${library_path}" - echo "The library path ${library_path} was appended to LD_LIBRARY_PATH" + ((VERBOSE > 0)) && echo "The library path ${library_path} was appended to LD_LIBRARY_PATH" ;; esac fi - done - if ! ldd -- "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" 2>&1 | grep -qE '\s=>\snot found'; then - echo -e "\n*** The update of the LD_LIBRARY_PATH was successful" - echo -e "\nLD_LIBRARY_PATH = \"${LD_LIBRARY_PATH}\"" - else - echo -e "\n*** WARNING: The update of the LD_LIBRARY_PATH was NOT successful" - echo -e "\n*** The following libraries were NOT found:" - ldd -- "${INSTALL_PREFIX}/bin/cp2k.${VERSION}" 2>&1 | grep -E '\s=>\snot found' | sort | uniq fi +done +export LD_LIBRARY_PATH +echo -e "\nLD_LIBRARY_PATH = \"${LD_LIBRARY_PATH}\"" + +# Create an ld configuration file for CP2K because LD_LIBRARY_PATH is fragile +if [[ "${IN_CONTAINER}" == "yes" ]]; then + CP2K_LD_CONF_FILE="/etc/ld.so.conf.d/cp2k.conf" +else + CP2K_LD_CONF_FILE="${INSTALL_PREFIX}/bin/cp2k.conf" fi + +# Either read LD_LIBRARY_PATH from an existing configuration file or write a new one +if [[ -f "${CP2K_LD_CONF_FILE}" ]]; then + # Load LD_LIBRARY_PATH from an existing configuration file + LD_LIBRARY_PATH="$(grep -E '^/' "${CP2K_LD_CONF_FILE}" | paste -sd ':' -)" +else + # Write LD_LIBRARY_PATH to a new configuration file + echo "${LD_LIBRARY_PATH}" | tr ':' '\n' | grep '^/' > "${CP2K_LD_CONF_FILE}" +fi + export LD_LIBRARY_PATH # Create links to CP2K binaries @@ -1231,7 +1241,7 @@ ulimit -c 0 -s unlimited export PATH=${INSTALL_PREFIX}/bin:${PATH} export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} export OMP_NUM_THREADS=\${OMP_NUM_THREADS:-8} -export OMP_STACKSIZE=64M +export OMP_STACKSIZE=256M ${OMPI_VARS} exec "\$@" *** @@ -1255,16 +1265,21 @@ if [[ "${RUN_TEST}" == "yes" ]]; then fi else if [[ "${IN_CONTAINER}" == "yes" ]]; then + if ((CUDA_ARCH > 0)); then + DEVICE_FLAG=" --device nvidia.com/gpu=all" + else + DEVICE_FLAG="" + fi echo "" echo "*** A regression test run can be launched with" - echo " podman run -it --rm run_tests" + echo " podman run -it${DEVICE_FLAG} --rm run_tests" echo "" if [[ "${VERSION}" == "ssmp" ]]; then echo "*** A CP2K run using 8 OpenMP threads (default) can be launched with" - echo " podman run -it --rm cp2k ${CP2K_ROOT}/benchmarks/CI/H2O-32_md.inp" + echo " podman run -it${DEVICE_FLAG} --rm cp2k ${CP2K_ROOT}/benchmarks/CI/H2O-32_md.inp" else echo "*** An MPI-parallel CP2K run using 2 OpenMP threads for each of the 4 MPI ranks can be launched with" - echo " podman run -it --rm mpiexec -n 4 ${ENV_VAR_FLAG} OMP_NUM_THREADS=2 cp2k ${CP2K_ROOT}/benchmarks/CI/H2O-32_md.inp" + echo " podman run -it${DEVICE_FLAG} --rm mpiexec -n 4 ${ENV_VAR_FLAG} OMP_NUM_THREADS=2 cp2k ${CP2K_ROOT}/benchmarks/CI/H2O-32_md.inp" fi echo "" else diff --git a/tools/docker/Dockerfile.test_spack_openmpi-psmp b/tools/docker/Dockerfile.test_spack_openmpi-psmp index 596ae9e696..d7a0b876d1 100644 --- a/tools/docker/Dockerfile.test_spack_openmpi-psmp +++ b/tools/docker/Dockerfile.test_spack_openmpi-psmp @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp b/tools/docker/Dockerfile.test_spack_psmp index dc7166fe19..fc67298b1d 100644 --- a/tools/docker/Dockerfile.test_spack_psmp +++ b/tools/docker/Dockerfile.test_spack_psmp @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-4x2 b/tools/docker/Dockerfile.test_spack_psmp-4x2 index f35731fde3..07796ca0f9 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-4x2 +++ b/tools/docker/Dockerfile.test_spack_psmp-4x2 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests --mpiranks=4 --ompthreads=2 diff --git a/tools/docker/Dockerfile.test_spack_psmp-P100 b/tools/docker/Dockerfile.test_spack_psmp-P100 index 43ee76f95d..ee27b78c4a 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-P100 +++ b/tools/docker/Dockerfile.test_spack_psmp-P100 @@ -86,6 +86,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests --keepalive diff --git a/tools/docker/Dockerfile.test_spack_psmp-fedora b/tools/docker/Dockerfile.test_spack_psmp-fedora index e918142b97..57ebb4b7eb 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-fedora +++ b/tools/docker/Dockerfile.test_spack_psmp-fedora @@ -63,6 +63,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-gcc10 b/tools/docker/Dockerfile.test_spack_psmp-gcc10 index 97128cda74..71049914e9 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-gcc10 +++ b/tools/docker/Dockerfile.test_spack_psmp-gcc10 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-gcc11 b/tools/docker/Dockerfile.test_spack_psmp-gcc11 index cd71b79f5f..ade6869220 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-gcc11 +++ b/tools/docker/Dockerfile.test_spack_psmp-gcc11 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-gcc12 b/tools/docker/Dockerfile.test_spack_psmp-gcc12 index 479ed3e1ca..9783fde3ee 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-gcc12 +++ b/tools/docker/Dockerfile.test_spack_psmp-gcc12 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-gcc14 b/tools/docker/Dockerfile.test_spack_psmp-gcc14 index d86cbd7fcf..740dcad3f1 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-gcc14 +++ b/tools/docker/Dockerfile.test_spack_psmp-gcc14 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-gcc15 b/tools/docker/Dockerfile.test_spack_psmp-gcc15 index 85897eed97..0eb2e52f31 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-gcc15 +++ b/tools/docker/Dockerfile.test_spack_psmp-gcc15 @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-opensuse b/tools/docker/Dockerfile.test_spack_psmp-opensuse index 9cb7bd57c4..c5bd85bab7 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-opensuse +++ b/tools/docker/Dockerfile.test_spack_psmp-opensuse @@ -75,6 +75,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-rawhide b/tools/docker/Dockerfile.test_spack_psmp-rawhide index a4027b3e07..1de1e142ca 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-rawhide +++ b/tools/docker/Dockerfile.test_spack_psmp-rawhide @@ -63,6 +63,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_psmp-rockylinux b/tools/docker/Dockerfile.test_spack_psmp-rockylinux index 6ff1c3aa0a..507546aeba 100644 --- a/tools/docker/Dockerfile.test_spack_psmp-rockylinux +++ b/tools/docker/Dockerfile.test_spack_psmp-rockylinux @@ -3,7 +3,7 @@ # Usage: ./spack_cache_start.sh; podman build --network=host --shm-size=1g -f ./Dockerfile.test_spack_psmp-rockylinux ../../ # -ARG BASE_IMAGE="rockylinux:9.3" +ARG BASE_IMAGE="docker.io/rockylinux/rockylinux:10" ###### Stage 1: Build CP2K ###### @@ -18,9 +18,9 @@ RUN dnf -y install dnf-plugins-core && \ libtool \ openssl-devel \ patch \ - python3.11 \ - python3.11-devel \ - python3.11-pip \ + python3 \ + python3-devel \ + python3-pip \ unzip \ wget \ xz \ @@ -28,8 +28,6 @@ RUN dnf -y install dnf-plugins-core && \ zlib-static \ && dnf clean -q all -RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 - ARG SPACK_CACHE="s3://spack-cache --s3-endpoint-url=http://localhost:9000" # Copy CP2K repository into container @@ -38,10 +36,10 @@ COPY . cp2k/ # Build CP2K dependencies WORKDIR /opt/cp2k -RUN ./make_cp2k.sh -bd_only -cv psmp -gpu none -gv 11 -mpi mpich -ue -df libxsmm -ef openpmd +RUN ./make_cp2k.sh -bd_only -cv psmp -gpu none -gv 14 -mpi mpich -ue -df libxsmm -ef openpmd # Build and install CP2K -RUN ./make_cp2k.sh -cv psmp -gv 11 -gpu none -mpi mpich -df libxsmm -ef openpmd +RUN ./make_cp2k.sh -cv psmp -gv 14 -gpu none -mpi mpich -df libxsmm -ef openpmd ###### Stage 2: Install CP2K ###### @@ -50,12 +48,10 @@ FROM "${BASE_IMAGE}" AS install_cp2k RUN dnf -y install dnf-plugins-core && \ dnf --enablerepo=crb -qy install \ gcc gcc-c++ gcc-fortran \ - python3.11 \ - python3.11-pip \ + python3 \ + python3-pip \ && dnf clean -q all -RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 - WORKDIR /opt/cp2k # Install CP2K dependencies built with spack @@ -71,6 +67,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_ssmp b/tools/docker/Dockerfile.test_spack_ssmp index 89d6758b2a..bcebf39907 100644 --- a/tools/docker/Dockerfile.test_spack_ssmp +++ b/tools/docker/Dockerfile.test_spack_ssmp @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_ssmp-P100 b/tools/docker/Dockerfile.test_spack_ssmp-P100 index 24cc45da62..074c5de34f 100644 --- a/tools/docker/Dockerfile.test_spack_ssmp-P100 +++ b/tools/docker/Dockerfile.test_spack_ssmp-P100 @@ -86,6 +86,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests --keepalive diff --git a/tools/docker/Dockerfile.test_spack_ssmp-rawhide b/tools/docker/Dockerfile.test_spack_ssmp-rawhide index 8e6248cca4..d4d864a6d7 100644 --- a/tools/docker/Dockerfile.test_spack_ssmp-rawhide +++ b/tools/docker/Dockerfile.test_spack_ssmp-rawhide @@ -63,6 +63,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/Dockerfile.test_spack_ssmp-static b/tools/docker/Dockerfile.test_spack_ssmp-static index 3a8a40716b..48eb5a6c26 100644 --- a/tools/docker/Dockerfile.test_spack_ssmp-static +++ b/tools/docker/Dockerfile.test_spack_ssmp-static @@ -72,6 +72,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index 4fe7073561..2de6494747 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -121,8 +121,8 @@ def main() -> None: install_cp2k_spack( "psmp", mpi_mode="mpich", - base_image="rockylinux:9.3", - gcc_version=11, + base_image="docker.io/rockylinux/rockylinux:10", + gcc_version=14, feature_flags="-df libxsmm -ef openpmd", ) ) @@ -673,7 +673,6 @@ def install_cp2k_spack( elif "opensuse/leap" in base_image: gcc_compilers = f"gcc gcc{gcc_version} gcc-c++ gcc{gcc_version}-c++ gcc-fortran gcc{gcc_version}-fortran" elif "rockylinux" in base_image: - # Rockylinux provides only GCC 11 gcc_compilers = f"gcc gcc-c++ gcc-fortran" else: gcc_compilers = f"g++ g++-{gcc_version} gcc gcc-{gcc_version} gfortran gfortran-{gcc_version}" @@ -727,6 +726,10 @@ COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY --from=build_cp2k /opt/cp2k/benchmarks/CI ./benchmarks/CI +# Do not rely only on LD_LIBRARY_PATH because it is fragile +COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf +RUN ldconfig + # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests {testopts} @@ -810,17 +813,15 @@ RUN dnf -y install dnf-plugins-core && \ libtool \ openssl-devel \ patch \ - python3.11 \ - python3.11-devel \ - python3.11-pip \ + python3 \ + python3-devel \ + python3-pip \ unzip \ wget \ xz \ zlib-devel \ zlib-static \ && dnf clean -q all - -RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 """ elif "ubuntu" in base_image: output += rf""" @@ -890,11 +891,9 @@ RUN ln -sf /usr/bin/python3.11 /usr/local/bin/python3 && \ RUN dnf -y install dnf-plugins-core && \ dnf --enablerepo=crb -qy install \ {gcc_compilers} \ - python3.11 \ - python3.11-pip \ + python3 \ + python3-pip \ && dnf clean -q all - -RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 """ elif "ubuntu" in base_image: output += rf""" diff --git a/tools/spack/cp2k_deps_psmp.yaml b/tools/spack/cp2k_deps_psmp.yaml index 594bb93cbf..d102587eb5 100644 --- a/tools/spack/cp2k_deps_psmp.yaml +++ b/tools/spack/cp2k_deps_psmp.yaml @@ -168,7 +168,7 @@ spack: - "gcc@10:" - "gmake@4.2:" - "mpich@4.3.2" - - "ninja@1.10:" + - "ninja@1.13" # - "openmpi@5.0.9" - "python@3.11:" # CP2K diff --git a/tools/spack/cp2k_deps_ssmp-static.yaml b/tools/spack/cp2k_deps_ssmp-static.yaml index 59e584ee25..4fce63ea3f 100644 --- a/tools/spack/cp2k_deps_ssmp-static.yaml +++ b/tools/spack/cp2k_deps_ssmp-static.yaml @@ -95,7 +95,7 @@ spack: - "cmake@3.27:" - "gcc@10:" - "gmake@4.2:" - - "ninja@1.10:" + - "ninja@1.13" - "python@3.11:" # CP2K - "dbcsr@2.9.1" diff --git a/tools/spack/cp2k_deps_ssmp.yaml b/tools/spack/cp2k_deps_ssmp.yaml index c0574c1b70..66fdd4656e 100644 --- a/tools/spack/cp2k_deps_ssmp.yaml +++ b/tools/spack/cp2k_deps_ssmp.yaml @@ -108,7 +108,7 @@ spack: - "cmake@3.27:" - "gcc@10:" - "gmake@4.2:" - - "ninja@1.10:" + - "ninja@1.13" - "python@3.11:" # CP2K - "dbcsr@2.9.1"