From 343e2d28e92b02cf05d1a0de4585fbdf6582095e Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Fri, 17 Jan 2025 16:44:50 +0100 Subject: [PATCH] Enable COSMA, ELPA, libVORI, PLUMED, SIRIUS, SPLA in CMake + Spack CI build --- CMakeLists.txt | 41 +++++++++++++----------- cmake/modules/FindLibVORI.cmake | 1 - tools/docker/Dockerfile.test_spack | 4 +-- tools/docker/generate_dockerfiles.py | 8 ++--- tools/docker/scripts/build_cp2k_cmake.sh | 26 ++++++++++----- tools/spack/cp2k-dependencies.yaml | 30 ++++++++--------- 6 files changed, 60 insertions(+), 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77dba2e757..02fb96085b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -623,6 +623,11 @@ endif() if(CP2K_USE_COSMA) find_package(cosma REQUIRED) + get_target_property(CP2K_COSMA_INCLUDE_DIRS cosma::cosma + INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(CP2K_COSMA_LINK_LIBRARIES cosma::cosma + INTERFACE_LINK_LIBRARIES) + # check that cosma::cosma_pxgemm and cosma::cosma_prefixed_pxgemm exist if(NOT TARGET cosma::cosma_pxgemm OR NOT TARGET cosma::cosma_prefixed_pxgemm) message( @@ -638,6 +643,12 @@ endif() if(CP2K_USE_DLAF) find_package(DLAFFortran REQUIRED) + + get_target_property(CP2K_DLAF_INCLUDE_DIRS DLAF::DLAF + INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(CP2K_DLAF_LINK_LIBRARIES DLAF::dlaf.prop + INTERFACE_LINK_LIBRARIES) + message("${CP2K_DLAF_INCLUDE_DIRS} ${CP2K_DLAF_LINK_LIBRARIES}") endif() # FFTW3 @@ -890,27 +901,13 @@ if(CP2K_USE_DFTD4) endif() if(CP2K_USE_SIRIUS) - message( - " - SIRIUS :\n" - " - include directories : ${SIRIUS_INCLUDE_DIRS}\n" - " - libraries : ${SIRIUS_LIBRARIES}\n" - " - dependencies :\n" - " - spla\n" - " - SpFFT\n" - " - SPGLIB\n" - " - LibXC\n" - " - fftw3\n" - " - hdf5\n" - " - GSL\n\n") - - if(CP2K_USE_VDWXC) - message(" - VDWXC\n") - endif() + message(" - SIRIUS") endif() if(CP2K_USE_COSMA) - message(" - COSMA\n" " - include directories : ${COSMA_INCLUDE_DIRS}\n" - " - libraries : ${COSMA_LIBRARIES}\n\n") + message(" - COSMA\n" + " - include directories : ${CP2K_COSMA_INCLUDE_DIRS}\n" + " - libraries : ${CP2K_COSMA_LINK_LIBRARIES}\n\n") endif() if(CP2K_USE_QUIP) @@ -940,6 +937,12 @@ if(CP2K_USE_ELPA) " - libraries : ${CP2K_ELPA_LINK_LIBRARIES}\n\n") endif() +if(CP2K_USE_DLAF) + message(" - DLA-Future\n" + " - include directories : ${CP2K_DLAF_INCLUDE_DIRS}\n" + " - libraries : ${CP2K_DLAF_LINK_LIBRARIES}\n\n") +endif() + if(CP2K_USE_SUPERLU) message(" - superlu\n" " - include directories : ${CP2K_SUPERLU_INCLUDE_DIRS}\n" @@ -986,7 +989,7 @@ if(NOT CP2K_USE_ELPA) endif() if(NOT CP2K_USE_DLAF) - message(" - DLAF") + message(" - DLA-Future") endif() if(NOT CP2K_USE_PLUMED) diff --git a/cmake/modules/FindLibVORI.cmake b/cmake/modules/FindLibVORI.cmake index 468e906e6b..e6b6f3620c 100644 --- a/cmake/modules/FindLibVORI.cmake +++ b/cmake/modules/FindLibVORI.cmake @@ -14,7 +14,6 @@ include(cp2k_utils) cp2k_set_default_paths(LIBVORI "LibVORI") cp2k_find_libraries(LIBVORI vori) -# cp2k_include_dirs(LIBVORI ) if(CP2K_LIBVORI_INCLUDE_DIRS) find_package_handle_standard_args( diff --git a/tools/docker/Dockerfile.test_spack b/tools/docker/Dockerfile.test_spack index fcd231fae5..b3b92abf38 100644 --- a/tools/docker/Dockerfile.test_spack +++ b/tools/docker/Dockerfile.test_spack @@ -42,7 +42,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ # Install a recent developer version of Spack. WORKDIR /opt/spack -ARG SPACK_VERSION=501ee68606405ea2ac26d369a5139d75be88dac8 +ARG SPACK_VERSION=847f560a6eff23f2177f3e8a2c143d309bb06acf RUN git init --quiet && \ git remote add origin https://github.com/spack/spack.git && \ git fetch --quiet --depth 1 origin ${SPACK_VERSION} --no-tags && \ @@ -54,7 +54,7 @@ RUN spack compiler find RUN spack external find --all --not-buildable # Enable Spack build cache -ARG SPACK_BUILD_CACHE=develop-2024-12-15 +ARG SPACK_BUILD_CACHE=develop-2025-01-12 RUN spack mirror add ${SPACK_BUILD_CACHE} https://binaries.spack.io/${SPACK_BUILD_CACHE} && \ spack mirror add develop https://binaries.spack.io/develop && \ spack buildcache keys --install --trust --force && \ diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index b8b3ca0158..2da5616744 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -2,10 +2,10 @@ # author: Ole Schuett -from pathlib import Path -from typing import Any import argparse import io +from pathlib import Path +from typing import Any # ====================================================================================== @@ -841,7 +841,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ # Install a recent developer version of Spack. WORKDIR /opt/spack -ARG SPACK_VERSION=501ee68606405ea2ac26d369a5139d75be88dac8 +ARG SPACK_VERSION=847f560a6eff23f2177f3e8a2c143d309bb06acf RUN git init --quiet && \ git remote add origin https://github.com/spack/spack.git && \ git fetch --quiet --depth 1 origin ${{SPACK_VERSION}} --no-tags && \ @@ -853,7 +853,7 @@ RUN spack compiler find RUN spack external find --all --not-buildable # Enable Spack build cache -ARG SPACK_BUILD_CACHE=develop-2024-12-15 +ARG SPACK_BUILD_CACHE=develop-2025-01-12 RUN spack mirror add ${{SPACK_BUILD_CACHE}} https://binaries.spack.io/${{SPACK_BUILD_CACHE}} && \ spack mirror add develop https://binaries.spack.io/develop && \ spack buildcache keys --install --trust --force && \ diff --git a/tools/docker/scripts/build_cp2k_cmake.sh b/tools/docker/scripts/build_cp2k_cmake.sh index e783e3d429..bceb1bbadb 100755 --- a/tools/docker/scripts/build_cp2k_cmake.sh +++ b/tools/docker/scripts/build_cp2k_cmake.sh @@ -27,23 +27,32 @@ fi # TODO: Reconcile PROFILE/VERSION with CP2K_BUILD_OPTIONS in CMakeLists.txt. if [[ "${PROFILE}" == "spack" ]] && [[ "${VERSION}" == "psmp" ]]; then + # NOTE: pexsi and quip are deprecated in #3600 cmake \ -GNinja \ -DCMAKE_C_FLAGS="-fno-lto" \ -DCMAKE_Fortran_FLAGS="-fno-lto" \ -DCMAKE_INSTALL_PREFIX=/opt/cp2k \ -Werror=dev \ - -DCP2K_USE_VORI=OFF \ - -DCP2K_USE_COSMA=OFF \ - -DCP2K_USE_DLAF=ON \ - -DCP2K_BLAS_VENDOR=OpenBLAS \ - -DCP2K_USE_SPGLIB=ON \ -DCP2K_USE_LIBINT2=ON \ -DCP2K_USE_LIBXC=ON \ - -DCP2K_USE_LIBXSMM=ON \ - -DCP2K_USE_LIBTORCH=OFF \ + -DCP2K_USE_FFTW3=ON \ + -DCP2K_USE_SPGLIB=ON \ + -DCP2K_USE_VORI=ON \ -DCP2K_USE_MPI=ON \ -DCP2K_USE_MPI_F08=ON \ + -DCP2K_USE_LIBXSMM=ON \ + -DCP2K_USE_SUPERLU=OFF \ + -DCP2K_USE_PLUMED=ON \ + -DCP2K_USE_SPLA=ON \ + -DCP2K_USE_METIS=OFF \ + -DCP2K_USE_ELPA=ON \ + -DCP2K_USE_COSMA=ON \ + -DCP2K_USE_SIRIUS=ON \ + -DCP2K_USE_QUIP=OFF \ + -DCP2K_USE_PEXSI=OFF \ + -DCP2K_USE_LIBTORCH=OFF \ + -DCP2K_USE_DLAF=ON \ .. |& tee ./cmake.log CMAKE_EXIT_CODE=$? @@ -88,8 +97,9 @@ elif [[ "${PROFILE}" == "toolchain" ]] && [[ "${VERSION}" == "sdbg" ]]; then CMAKE_EXIT_CODE=$? elif [[ "${PROFILE}" == "toolchain" ]] && [[ "${VERSION}" == "psmp" ]]; then - # TODO Fix ELPA, COSMA, SIRIUS, QUIP, PEXSI, and Torch. + # TODO Fix ELPA, COSMA, SIRIUS, and Torch. # https://github.com/cp2k/cp2k/issues/3416 + # NOTE: pexsi and quip are deprecated in #3600 cmake \ -GNinja \ -DCMAKE_INSTALL_PREFIX=/opt/cp2k \ diff --git a/tools/spack/cp2k-dependencies.yaml b/tools/spack/cp2k-dependencies.yaml index f7976f6847..09e955777b 100644 --- a/tools/spack/cp2k-dependencies.yaml +++ b/tools/spack/cp2k-dependencies.yaml @@ -1,35 +1,33 @@ # This is a Spack Environment file for developing CP2K. spack: specs: - - mpich@4.1.2 device=ch3 netmod=tcp - - "openblas @0.3.24 +fortran threads=openmp" + - "mpich@4.1.2 device=ch3 netmod=tcp" + - "openblas@0.3.24 +fortran threads=openmp" - "dbcsr@2.8.0 +openmp +mpi" - - "netlib-scalapack @2.2.0" - - "libxsmm @1.17" - - "fftw @3.3.10 +openmp" - - "libxc @6.2.2" - - "spglib @2.3.0" + - "netlib-scalapack@2.2.0" + - "libxsmm@1.17" + - "fftw@3.3.10 +openmp" + - "libxc@6.2.2" + - "spglib@2.3.0" + - "dla-future@0.7.3 +scalapack" - "dla-future-fortran@0.2.0" - "libint@2.9.0 +fortran tune=cp2k-lmax-5" + - "cosma@2.6.6 +scalapack" + - "plumed@2.9.2" + - "elpa@2024.03.001 +openmp" + - "sirius @7.6.1 +fortran +pugixml ~apps" + - "libvori@220621" + - "spla@1.6.1 +fortran" # Unfortunately, ScaLAPACK 2.2.1 has not yet been packaged by Spack. # https://github.com/Reference-ScaLAPACK/scalapack/tree/v2.2.1 # which contains https://github.com/Reference-ScaLAPACK/scalapack/pull/26 # TODO: - # - "sirius @7.4.3 +fortran +shared +openmp" # build fails - # - "plumed @2.9.0 +shared +mpi optional_modules=all" # requires cython - # - "libvori @220621" # is not recompile with -fPIC - # - "cosma @2.6.6" - # - "elpa @2023.05.001 +openmp" - # # scotch_6.0.0.tar.gz # superlu_dist_6.1.0.tar.gz: OK - # pexsi_v1.2.0.tar.gz: OK - # QUIP-0.9.10.tar.gz # hdf5-1.14.2.tar.bz2: OK # libvdwxc-0.4.0.tar.gz: OK # libtorch-cxx11-abi-shared-with-deps-1.12.1+cpu.zip: OK - # SpLA-1.5.5.tar.gz: OK view: default: root: ./spack-env/view