From 3a22a2691016db12eba4d85ea0db39c868212a54 Mon Sep 17 00:00:00 2001 From: SY Wang Date: Mon, 27 Apr 2026 04:07:14 +0800 Subject: [PATCH] Toolchain SIRIUS (#5098) --- CMakeLists.txt | 11 +- cmake/cmake_cp2k.sh | 3 - docs/technologies/libraries.md | 12 +- src/CMakeLists.txt | 6 +- src/cp2k_info.F | 3 + src/input_cp2k_pwdft.F | 15 +- src/sirius_interface.F | 19 ++- tests/SIRIUS/regtest-1/TEST_FILES.toml | 20 +-- tools/docker/Dockerfile.test_fedora-psmp | 4 +- tools/docker/generate_dockerfiles.py | 2 +- tools/toolchain/install_cp2k_toolchain.sh | 9 +- tools/toolchain/scripts/stage7/install_fmt.sh | 83 +++++++++++ .../scripts/stage7/install_libvdwxc.sh | 5 +- .../scripts/stage7/install_stage7.sh | 1 + .../scripts/stage8/install_sirius.sh | 133 +++--------------- .../toolchain/scripts/stage8/install_spfft.sh | 2 +- .../scripts/stage8/install_stage8.sh | 4 +- .../scripts/stage8/sirius_memory.patch | 11 -- 18 files changed, 163 insertions(+), 180 deletions(-) create mode 100755 tools/toolchain/scripts/stage7/install_fmt.sh delete mode 100644 tools/toolchain/scripts/stage8/sirius_memory.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 889be27f73..ea1373267b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,19 +174,16 @@ cmake_dependent_option(CP2K_USE_LIBVDWXC "Enable libvdwxc support with SIRIUS" ${CP2K_USE_EVERYTHING} "CP2K_USE_SIRIUS" OFF) # do not turn it on if sirius is built with the toolchain -cmake_dependent_option( - CP2K_USE_SIRIUS_DFTD4 "Enable dftd3 and dftd4 sirius support" OFF - "CP2K_USE_SIRIUS" OFF) +cmake_dependent_option(CP2K_USE_SIRIUS_DFTD3 "Enable dftd3 sirius support" OFF + "CP2K_USE_SIRIUS" OFF) +cmake_dependent_option(CP2K_USE_SIRIUS_DFTD4 "Enable dftd4 sirius support" OFF + "CP2K_USE_SIRIUS" OFF) cmake_dependent_option( CP2K_USE_SIRIUS_VCSQNM "Enable variable cell shape relaxation in SIRIUS" OFF "CP2K_USE_SIRIUS" OFF) - cmake_dependent_option(CP2K_USE_SIRIUS_NLCG "Enable nlcg method in SIRIUS" OFF "CP2K_USE_SIRIUS" OFF) -cmake_dependent_option(CP2K_USE_SpFFT "Enable spare FFT in SIRIUS" OFF - "CP2K_USE_SIRIUS" OFF) - cmake_dependent_option( CP2K_DBCSR_USE_CPU_ONLY "Disable the DBCSR accelerated backend" OFF "NOT CP2K_USE_ACCEL MATCHES \"OPENCL|HIP|CUDA\"" OFF) diff --git a/cmake/cmake_cp2k.sh b/cmake/cmake_cp2k.sh index 9e0a383b90..f27e56294a 100644 --- a/cmake/cmake_cp2k.sh +++ b/cmake/cmake_cp2k.sh @@ -90,15 +90,12 @@ elif [[ "${PROFILE}" == "toolchain" ]] && [[ "${VERSION}" == "sdbg" ]]; then CMAKE_EXIT_CODE=$? elif [[ "${PROFILE}" == "toolchain" ]] && [[ "${VERSION}" == "psmp" ]]; then - # TODO Re-enable SIRIUS once performance regression of COSMA is fixed: - # https://github.com/cp2k/cp2k/issues/4663 cmake \ -GNinja \ -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \ -DCP2K_USE_EVERYTHING=ON \ -DCP2K_USE_DLAF=OFF \ -DCP2K_USE_PEXSI=OFF \ - -DCP2K_USE_SIRIUS=OFF \ -Werror=dev \ .. |& tee ./cmake.log CMAKE_EXIT_CODE=$? diff --git a/docs/technologies/libraries.md b/docs/technologies/libraries.md index ff6c96d3ed..352bd36c91 100644 --- a/docs/technologies/libraries.md +++ b/docs/technologies/libraries.md @@ -128,12 +128,13 @@ A library for finding and handling crystal symmetries ## SIRIUS (plane wave calculations) -SIRIUS is a domain specific library for electronic structure calculations. +SIRIUS is a domain specific library for electronic structure calculations with plane wave method. - The code is available at - For building CP2K with SIRIUS pass `-DCP2K_USE_SIRIUS=ON` to CMake. - Pass `-DCP2K_USE_LIBVDWXC=ON` if support is activated in SIRIUS. -- Pass `-DCP2K_USE_SIRIUS_DFTD4=ON` when sirius is compiled with dftd3 and dftd4 support. +- Pass `-DCP2K_USE_SIRIUS_DFTD3=ON` when sirius is compiled with dftd3 support. +- Pass `-DCP2K_USE_SIRIUS_DFTD4=ON` when sirius is compiled with dftd4 support. - Pass `-DCP2K_USE_SIRIUS_NLCG=ON` when sirius is compiled with nlcg support. - Pass `-DCP2K_USE_SIRIUS_VCSQNM=ON` when sirius is compiled with variable cell relaxation support. - See for more information. @@ -156,13 +157,6 @@ SIRIUS is a domain specific library for electronic structure calculations. for more information as well as the `bqbtool` to inspect BQB files. -## SpFFT (Sparse 3D FFT) - -- SpFFT is a 3D FFT library for sparse frequency domain data written in C++ with support for MPI, - OpenMP, CUDA and ROCm. -- Pass `-DCP2K_USE_SpFFT=ON` to CMake to enable support for SpFFT. -- See for more information. - ## Torch (Machine Learning Framework needed for NequIP) - The C++ API of PyTorch can be downloaded from https://pytorch.org/get-started/locally/. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ba488ec02..a56a637fd5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1797,7 +1797,6 @@ target_compile_definitions( $<$:__SIRIUS> $<$:__LIBVDWXC> $<$:__SPLA> - $<$:__SPFFT> $<$:__OFFLOAD_GEMM> $<$:__ELPA> $<$:__DLAF> @@ -1811,8 +1810,9 @@ target_compile_definitions( $<$:__LIBTORCH> $<$:__COSMA> $<$:__LIBXSMM> - $<$:__SIRIUS_DFTD4> - $<$:__SIRIUS_NLCG> + $<$:__SIRIUS_DFTD3> + $<$:__SIRIUS_DFTD4> + $<$:__SIRIUS_NLCG> $<$:__SIRIUS_VCSQNM> $<$:__MIMIC> $<$:__MKL> diff --git a/src/cp2k_info.F b/src/cp2k_info.F index 744119e878..4fba957b4d 100644 --- a/src/cp2k_info.F +++ b/src/cp2k_info.F @@ -206,6 +206,9 @@ CONTAINS #if defined(__SIRIUS_NLCG) flags = TRIM(flags)//" sirius_nlcg" #endif +#if defined(__SIRIUS_DFTD3) + flags = TRIM(flags)//" sirius_dftd3" +#endif #if defined(__SIRIUS_DFTD4) flags = TRIM(flags)//" sirius_dftd4" #endif diff --git a/src/input_cp2k_pwdft.F b/src/input_cp2k_pwdft.F index ca514e5c89..4a1c2e3cb0 100644 --- a/src/input_cp2k_pwdft.F +++ b/src/input_cp2k_pwdft.F @@ -135,12 +135,14 @@ CONTAINS CALL section_release(subsection) #endif -#if defined(__SIRIUS_DFTD4) - CALL create_sirius_section(subsection, "dftd4") +#if defined(__SIRIUS_DFTD3) + CALL create_sirius_section(subsection, "dftd3") CALL section_add_subsection(section, subsection) CALL section_release(subsection) +#endif - CALL create_sirius_section(subsection, "dftd3") +#if defined(__SIRIUS_DFTD4) + CALL create_sirius_section(subsection, "dftd4") CALL section_add_subsection(section, subsection) CALL section_release(subsection) #endif @@ -244,9 +246,14 @@ CONTAINS ! it is a minor inconvenience from the api. name = TRIM(ADJUSTL(name)) +#if defined(__SIRIUS_DFTD3) + IF ((section_name == 'dftd3') .AND. (name == 'parameters')) THEN + CYCLE + END IF +#endif #if defined(__SIRIUS_DFTD4) ! need to implement the object case within a section - IF (((section_name == 'dftd3') .OR. (section_name == 'dftd4')) .AND. (name == 'parameters')) THEN + IF ((section_name == 'dftd4') .AND. (name == 'parameters')) THEN CYCLE END IF #endif diff --git a/src/sirius_interface.F b/src/sirius_interface.F index 844742e1d6..c278a27ee1 100644 --- a/src/sirius_interface.F +++ b/src/sirius_interface.F @@ -264,22 +264,21 @@ CONTAINS CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "iterative_solver") END IF -#if defined(__SIRIUS_DFTD4) - ! import dftd3 and dftd4 section - pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "dftd4") - IF (ASSOCIATED(pwdft_sub_section)) THEN - CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "dftd4") - END IF - +#if defined(__SIRIUS_DFTD3) + ! import dftd3 section pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "dftd3") IF (ASSOCIATED(pwdft_sub_section)) THEN CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "dftd3") END IF #endif +#if defined(__SIRIUS_DFTD4) + ! import dftd4 section + pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "dftd4") + IF (ASSOCIATED(pwdft_sub_section)) THEN + CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "dftd4") + END IF +#endif - ! - ! uncomment these lines when nlcg is officially supported - ! #if defined(__SIRIUS_NLCG) ! import nlcg section pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "nlcg") diff --git a/tests/SIRIUS/regtest-1/TEST_FILES.toml b/tests/SIRIUS/regtest-1/TEST_FILES.toml index 0abc9b368b..69a2f465cc 100644 --- a/tests/SIRIUS/regtest-1/TEST_FILES.toml +++ b/tests/SIRIUS/regtest-1/TEST_FILES.toml @@ -9,14 +9,14 @@ # testing global tree creation using single exact potential, the deterministic random number generator # with the standard move types, check i # fully test non colinear magnetism with spin orbit coupling -"Au.inp" = [{matcher="M085", tol=1.0E-5, ref=-147.225566702788200}] -"Fe.inp" = [{matcher="M085", tol=1.0E-5, ref=-253.637351928254105}] -"Fe_dos.inp" = [{matcher="M085", tol=1.0E-5, ref=-253.637351928254105}] -"He-full-potential.inp" = [{matcher="M085", tol=2.0E-5, ref=-2.835107805775919}] -"SrVO.inp" = [{matcher="M085", tol=1.0E-5, ref=-156.376729575050433}] -"LiF.inp" = [{matcher="M085", tol=1.0E-5, ref=-36.658529490345153}] -"N2.inp" = [{matcher="M085", tol=1.0E-9, ref=-16.572137677057988}] -"Fe-upf.inp" = [{matcher="M085", tol=1.0E-5, ref=-322.37407840130044}] -"Au_GTH.inp" = [{matcher="M085", tol=1.0E-5, ref=-33.157343398225969}] -"Au_GTH_SOC.inp" = [{matcher="M085", tol=1.0E-5, ref=-135.58863815223782}] +"Au.inp" = [{matcher="M085", tol=5.0E-8, ref=-147.225566702788200}] +"Fe.inp" = [{matcher="M085", tol=5.0E-8, ref=-253.637351928254105}] +"Fe_dos.inp" = [{matcher="M085", tol=5.0E-8, ref=-253.637351928254105}] +"He-full-potential.inp" = [{matcher="M085", tol=5.0E-8, ref=-2.835107805775919}] +"SrVO.inp" = [{matcher="M085", tol=5.0E-8, ref=-156.376729575050433}] +"LiF.inp" = [{matcher="M085", tol=5.0E-8, ref=-36.658529490345153}] +"N2.inp" = [{matcher="M085", tol=5.0E-8, ref=-16.572137677057988}] +"Fe-upf.inp" = [{matcher="M085", tol=5.0E-8, ref=-322.37407840130044}] +"Au_GTH.inp" = [{matcher="M085", tol=5.0E-8, ref=-33.157343398225969}] +"Au_GTH_SOC.inp" = [{matcher="M085", tol=5.0E-8, ref=-135.58863815223782}] #EOF diff --git a/tools/docker/Dockerfile.test_fedora-psmp b/tools/docker/Dockerfile.test_fedora-psmp index 2a326c7bbe..c47d8c2ed0 100644 --- a/tools/docker/Dockerfile.test_fedora-psmp +++ b/tools/docker/Dockerfile.test_fedora-psmp @@ -3,12 +3,12 @@ # Usage: podman build --shm-size=1g -f ./Dockerfile.test_fedora-psmp ../../ # -FROM fedora:41 +FROM fedora:44 # Install requirements for the toolchain. WORKDIR /opt/cp2k-toolchain COPY ./tools/toolchain/install_requirements*.sh ./ -RUN ./install_requirements.sh fedora:41 +RUN ./install_requirements.sh fedora:44 # Install the toolchain. RUN mkdir scripts diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index 4923b03600..23511e7f56 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -34,7 +34,7 @@ def main() -> None: f.write(regtest("toolchain", "psmp")) with OutputFile(f"Dockerfile.test_fedora-psmp", args.check) as f: - f.write(install_deps_toolchain(base_image="fedora:41")) + f.write(install_deps_toolchain(base_image="fedora:44")) f.write(regtest("toolchain", "psmp")) for version in "ssmp", "psmp": diff --git a/tools/toolchain/install_cp2k_toolchain.sh b/tools/toolchain/install_cp2k_toolchain.sh index 375cd4ea9a..83047cafde 100755 --- a/tools/toolchain/install_cp2k_toolchain.sh +++ b/tools/toolchain/install_cp2k_toolchain.sh @@ -287,6 +287,8 @@ Specific options of --with-PKG: --with-gsl Enable the GNU scientific library (GSL). This package is required for PLUMED and SIRIUS. Default = install + --with-fmt Enable the formatting C/C++ library. + This package is required for SIRIUS. --with-libtorch Enable libtorch as a machine learning framework. This package is required for NequIP and Allegro, and also for installing DeePMD-kit. @@ -464,7 +466,7 @@ math_list="mkl acml openblas" lib_list="fftw libint libxc libxsmm cosma scalapack elpa dbcsr cusolvermp plumed spfft spla gsl spglib hdf5 libvdwxc sirius libvori libtorch deepmd ace dftd4 tblite pugixml libsmeagol - trexio greenx gmp mcl" + fmt trexio greenx gmp mcl" package_list="${tool_list} ${mpi_list} ${math_list} ${lib_list}" # ------------------------------------------------------------------------ @@ -489,6 +491,7 @@ with_libxc="__INSTALL__" with_scalapack="__INSTALL__" with_sirius="__INSTALL__" with_gsl="__DONTUSE__" +with_fmt="__DONTUSE__" with_spglib="__INSTALL__" with_hdf5="__DONTUSE__" with_trexio="__DONTUSE__" @@ -866,6 +869,9 @@ Otherwise use option no." --with-gsl*) with_gsl=$(read_with "${1}") ;; + --with-fmt*) + with_fmt=$(read_with "${1}") + ;; --with-spglib*) with_spglib=$(read_with "${1}") ;; @@ -1103,6 +1109,7 @@ if [ "${with_sirius}" = "__INSTALL__" ]; then [ "${with_spfft}" = "__DONTUSE__" ] && with_spfft="__INSTALL__" [ "${with_spla}" = "__DONTUSE__" ] && with_spla="__INSTALL__" [ "${with_gsl}" = "__DONTUSE__" ] && with_gsl="__INSTALL__" + [ "${with_fmt}" = "__DONTUSE__" ] && with_fmt="__INSTALL__" [ "${with_libxc}" = "__DONTUSE__" ] && with_libxc="__INSTALL__" [ "${with_fftw}" = "__DONTUSE__" ] && with_fftw="__INSTALL__" [ "${with_spglib}" = "__DONTUSE__" ] && with_spglib="__INSTALL__" diff --git a/tools/toolchain/scripts/stage7/install_fmt.sh b/tools/toolchain/scripts/stage7/install_fmt.sh new file mode 100755 index 0000000000..6ffde7b19a --- /dev/null +++ b/tools/toolchain/scripts/stage7/install_fmt.sh @@ -0,0 +1,83 @@ +#!/bin/bash -e + +# TODO: Review and if possible fix shellcheck errors. +# shellcheck disable=all + +[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 +SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" + +fmt_ver="12.1.0" +fmt_sha256="695fd197fa5aff8fc67b5f2bbc110490a875cdf7a41686ac8512fb480fa8ada7" + +source "${SCRIPT_DIR}"/common_vars.sh +source "${SCRIPT_DIR}"/tool_kit.sh +source "${SCRIPT_DIR}"/signal_trap.sh +source "${INSTALLDIR}"/toolchain.conf +source "${INSTALLDIR}"/toolchain.env + +[ -f "${BUILDDIR}/setup_fmt" ] && rm "${BUILDDIR}/setup_fmt" + +! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}" +cd "${BUILDDIR}" + +case "$with_fmt" in + __INSTALL__) + echo "==================== Installing fmt ====================" + pkg_install_dir="${INSTALLDIR}/fmt-${fmt_ver}" + install_lock_file="$pkg_install_dir/install_successful" + if verify_checksums "${install_lock_file}"; then + echo "fmt-${fmt_ver} is already installed, skipping it." + else + retrieve_package "${fmt_sha256}" "fmt-${fmt_ver}.zip" + echo "Installing from scratch into ${pkg_install_dir}" + [ -d fmt-${fmt_ver} ] && rm -rf fmt-${fmt_ver} + unzip -q fmt-${fmt_ver}.zip + cd fmt-${fmt_ver} + mkdir build + cd build + cmake .. \ + -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + > configure.log 2>&1 || tail_excerpt configure.log + make install -j $(get_nprocs) > make.log 2>&1 || tail_excerpt make.log + cd .. + write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})" + fi + ;; + __SYSTEM__) + echo "==================== Finding fmt from system paths ====================" + check_lib -lfmt "fmt" + ;; + __DONTUSE__) + # Nothing to do + ;; + *) + echo "==================== Linking fmt to user paths ====================" + pkg_install_dir="${with_fmt}" + check_dir "${pkg_install_dir}/lib" + check_dir "${pkg_install_dir}/include" + ;; +esac +if [ "${with_fmt}" != "__DONTUSE__" ]; then + if [ "${with_fmt}" != "__SYSTEM__" ]; then + cat << EOF > "${BUILDDIR}/setup_fmt" +prepend_path LD_LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path LD_RUN_PATH "${pkg_install_dir}/lib" +prepend_path LIBRARY_PATH "${pkg_install_dir}/lib" +prepend_path PKG_CONFIG_PATH "${pkg_install_dir}/lib/pkgconfig" +prepend_path CMAKE_PREFIX_PATH "${pkg_install_dir}" +EOF + fi + cat << EOF >> "${BUILDDIR}/setup_fmt" +export fmt_VER="${fmt_ver}" +export fmt_ROOT="${pkg_install_dir}" +EOF + filter_setup "${BUILDDIR}/setup_fmt" "${SETUPFILE}" +fi + +load "${BUILDDIR}/setup_fmt" +write_toolchain_env "${INSTALLDIR}" + +cd "${ROOTDIR}" +report_timing "fmt" diff --git a/tools/toolchain/scripts/stage7/install_libvdwxc.sh b/tools/toolchain/scripts/stage7/install_libvdwxc.sh index db2e281745..4c91da60eb 100755 --- a/tools/toolchain/scripts/stage7/install_libvdwxc.sh +++ b/tools/toolchain/scripts/stage7/install_libvdwxc.sh @@ -5,8 +5,9 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -libvdwxc_ver="0.4.0" -libvdwxc_sha256="3524feb5bb2be86b4688f71653502146b181e66f3f75b8bdaf23dd1ae4a56b33" + +libvdwxc_ver="0.5.0" +libvdwxc_sha256="29fb70efd58aff51524d2172a87e8f88e760b696b0ddb9aa5878432bdffa3c2f" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh diff --git a/tools/toolchain/scripts/stage7/install_stage7.sh b/tools/toolchain/scripts/stage7/install_stage7.sh index e187f3e46b..7f99280adf 100755 --- a/tools/toolchain/scripts/stage7/install_stage7.sh +++ b/tools/toolchain/scripts/stage7/install_stage7.sh @@ -8,5 +8,6 @@ ./scripts/stage7/install_spglib.sh ./scripts/stage7/install_libvori.sh ./scripts/stage7/install_libsmeagol.sh +./scripts/stage7/install_fmt.sh #EOF diff --git a/tools/toolchain/scripts/stage8/install_sirius.sh b/tools/toolchain/scripts/stage8/install_sirius.sh index 2892e57fb0..2a6ebeaa9b 100755 --- a/tools/toolchain/scripts/stage8/install_sirius.sh +++ b/tools/toolchain/scripts/stage8/install_sirius.sh @@ -6,8 +6,8 @@ [ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0 SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" -sirius_ver="7.7.1" -sirius_sha256="6039c84197d9e719e826f98b840cff19bc513887b443f97c0099d3c8b908efed" +sirius_ver="7.11.1" +sirius_sha256="ce77dd168b2c3ef4a89cc2d6b163cb00b3d8b9d4b0652bc9de187dc7e0e74d77" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh @@ -31,48 +31,6 @@ case "$with_sirius" in __INSTALL__) echo "==================== Installing SIRIUS ====================" - require_env FFTW_LDFLAGS - require_env FFTW_LIBS - require_env FFTW_CFLAGS - require_env ELPA_ROOT - require_env ELPA_LDFLAGS - require_env ELPA_LIBS - require_env ELPA_CFLAGS - require_env GSL_ROOT - require_env GSL_LDFLAGS - require_env GSL_CFLAGS - require_env GSL_LIBS - require_env GSL_INCLUDE_DIR - require_env GSL_LIBRARY - require_env MATH_LIBS - require_env MPI_LDFLAGS - require_env MPI_LIBS - require_env SCALAPACK_ROOT - require_env SCALAPACK_LDFLAGS - require_env SCALAPACK_CFLAGS - require_env SCALAPACK_LIBS - require_env LIBXC_LIBS - require_env LIBXC_CFLAGS - require_env LIBXC_LDFLAGS - require_env SPGLIB_LIBS - require_env SPGLIB_CFLAGS - require_env SPGLIB_LDFLAGS - require_env HDF5_LIBS - require_env HDF5_CFLAGS - require_env HDF5_LDFLAGS - require_env LIBVDWXC_CFLAGS - require_env LIBVDWXC_LIBS - require_env LIBVDWXC_LDFLAGS - require_env SPFFT_ROOT - require_env SPFFT_CFLAGS - require_env SPFFT_LDFLAGS - require_env SPFFT_LIBS - require_env SPLA_ROOT - require_env PUGIXML_ROOT - require_env SPLA_CFLAGS - require_env SPLA_LDFLAGS - require_env SPLA_LIBS - require_env COSMA_ROOT ARCH=$(uname -m) SIRIUS_OPT="-O3 -DNDEBUG -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}" if [ "$ARCH" = "ppc64le" ]; then @@ -99,7 +57,7 @@ case "$with_sirius" in pkg_install_dir="${INSTALLDIR}/sirius-${sirius_ver}" install_lock_file="${pkg_install_dir}/install_successful" if verify_checksums "${install_lock_file}"; then - echo "sirius_dist-${sirius_ver} is already installed, skipping it." + echo "sirius-${sirius_ver} is already installed, skipping it." else retrieve_package "${sirius_sha256}" "SIRIUS-${sirius_ver}.tar.gz" echo "Installing from scratch into ${pkg_install_dir}" @@ -110,32 +68,19 @@ case "$with_sirius" in rm -Rf build mkdir build cd build - # if [ -n "$ELPA_LIBS" ] ; then - # if [ -s "$ELPA_ROOT" ] ; then - # export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ELPA_ROOT/lib/pkgconfig:$ELPA_ROOT/lib64/pkgconfig - # fi - # EXTRA_CMAKE_FLAGS="-DUSE_ELPA=ON -DELPA_INCLUDE_DIR=${ELPA_ROOT}/include/elpa-${ELPA_VER} ${EXTRA_CMAKE_FLAGS}" - # fi - - if [ -n "${SCALAPACK_LIBS}" ]; then - export SCALAPACK_LIB="${SCALAPACK_LIBS}" + if [ "${with_elpa}" != "__DONTUSE__" ]; then + EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_ELPA=ON ${EXTRA_CMAKE_FLAGS}" fi - if [ -n "${HDF5_LIBS}" ]; then - CMAKE_PREFIX_PATH="${HDF5_ROOT} ${CMAKE_PREFIX_PATH}" + if [ "${MATH_MODE}" == "mkl" ]; then + EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_MKL=ON -DSIRIUS_USE_SCALAPACK=ON ${EXTRA_CMAKE_FLAGS}" fi - if [ -n "${LIBVDWXC_LIBS}" ]; then - CMAKE_PREFIX_PATH="${LIBVDWXC_ROOT} ${CMAKE_PREFIX_PATH}" - EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_VDWXC=ON ${EXTRA_CMAKE_FLAGS}" - else - EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_VDWXC=OFF ${EXTRA_CMAKE_FLAGS}" + if [ "${with_tblite}" != "__DONTUSE__" ]; then + # tblite includes s-dftd3 + EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_DFTD3=ON -DSIRIUS_USE_DFTD4=ON ${EXTRA_CMAKE_FLAGS}" + elif [ "${with_dftd4}" != "__DONTUSE__" ]; then + EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_DFTD4=ON ${EXTRA_CMAKE_FLAGS}" fi - if [ -n "${MKL_LIBS}" ]; then - EXTRA_CMAKE_FLAGS="-DSIRIUS_USE_MKL=ON ${EXTRA_CMAKE_FLAGS}" - fi - SpFFT_DIR="${SpFFT_ROOT}/lib/cmake/SpFFT" - SpLA_DIR="${SpLA_ROOT}/lib/cmake/SPLA" - COSTA_DIR="${COSMA_ROOT}/lib/cmake/costa" - CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${GSL_ROOT}:${SPGLIB_ROOT}:${LIBXC_ROOT}:${SpFFT_DIR}:${SpLA_DIR}:${COSTA_DIR}:${PUGIXML_ROOT}" cmake \ + cmake \ -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \ -DCMAKE_INSTALL_LIBDIR="lib" \ -DCMAKE_CXX_FLAGS_RELEASE="${SIRIUS_OPT}" \ @@ -146,14 +91,13 @@ case "$with_sirius" in -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DSIRIUS_USE_VDWXC=ON \ -DSIRIUS_USE_PUGIXML=ON \ -DSIRIUS_USE_MEMORY_POOL=OFF \ - -DSIRIUS_USE_ELPA=OFF \ ${EXTRA_CMAKE_FLAGS} .. \ > cmake.log 2>&1 || tail_excerpt cmake.log - make -j $(get_nprocs) -C src >> make.log 2>&1 || tail_excerpt make.log - make install >> make.log 2>&1 || tail_excerpt make.log + make -j $(get_nprocs) install > make.log 2>&1 || tail_excerpt make.log cd .. # now do we have cuda as well @@ -162,26 +106,25 @@ case "$with_sirius" in [ -d build-cuda ] && rm -rf "build-cuda" mkdir build-cuda cd build-cuda - CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${GSL_ROOT}:${SPGLIB_ROOT}:${LIBXC_ROOT}:${SpFFT_DIR}:${SpLA_DIR}:${COSTA_DIR}" cmake \ + cmake \ -DCMAKE_INSTALL_PREFIX=${pkg_install_dir}/cuda \ -DCMAKE_INSTALL_LIBDIR="lib" \ -DCMAKE_CXX_FLAGS_RELEASE="${SIRIUS_OPT}" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${SIRIUS_DBG}" \ -DCMAKE_CUDA_FLAGS="-std=c++14 -allow-unsupported-compiler" \ -DSIRIUS_USE_CUDA=ON \ - -DSIRIUS_USE_ELPA=OFF \ -DGPU_MODEL=P100 \ -DSIRIUS_USE_MEMORY_POOL=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DSIRIUS_USE_PUGIXML=ON \ + -DSIRIUS_USE_VDWXC=ON \ -DCMAKE_CXX_COMPILER="${MPICXX}" \ -DCMAKE_C_COMPILER="${MPICC}" \ -DCMAKE_Fortran_COMPILER="${MPIFC}" \ ${EXTRA_CMAKE_FLAGS} .. \ >> cmake.log 2>&1 || tail_excerpt cmake.log - make -j $(get_nprocs) -C src >> make.log 2>&1 || tail_excerpt make.log - make install >> make.log 2>&1 || tail_excerpt make.log + make -j $(get_nprocs) install >> make.log 2>&1 || tail_excerpt make.log SIRIUS_CUDA_LDFLAGS="-L'${pkg_install_dir}/cuda/lib' -Wl,-rpath,'${pkg_install_dir}/cuda/lib'" cd .. fi @@ -191,44 +134,6 @@ case "$with_sirius" in fi ;; __SYSTEM__) - require_env FFTW_LDFLAGS - require_env FFTW_LIBS - require_env FFTW_CFLAGS - require_env ELPA_ROOT - require_env ELPA_LDFLAGS - require_env ELPA_LIBS - require_env ELPA_CFLAGS - require_env GSL_LDFLAGS - require_env GSL_CFLAGS - require_env GSL_LIBS - require_env MATH_LIBS - require_env MPI_LDFLAGS - require_env MPI_LIBS - require_env SCALAPACK_ROOT - require_env SCALAPACK_LDFLAGS - require_env SCALAPACK_CFLAGS - require_env SCALAPACK_LIBS - require_env LIBXC_LIBS - require_env LIBXC_CFLAGS - require_env LIBXC_LDFLAGS - require_env SPGLIB_LIBS - require_env SPGLIB_CFLAGS - require_env SPGLIB_LDFLAGS - require_env HDF5_LIBS - require_env HDF5_CFLAGS - require_env HDF5_LDFLAGS - require_env LIBVDWXC_CFLAGS - require_env LIBVDWXC_LDFLAGS - require_env LIBVDWXC_LIBS - require_env SPFFT_ROOT - require_env SPFFT_CFLAGS - require_env SPFFT_LDFLAGS - require_env SPFFT_LIBS - require_env SPLA_ROOT - require_env PUGIXML_ROOT - require_env SPLA_CFLAGS - require_env SPLA_LDFLAGS - require_env SPLA_LIBS check_lib -lsirius "sirius" check_lib -lsirius_cxx "sirius_cxx" add_include_from_paths SIRIUS_CFLAGS "sirius*" $INCLUDE_PATHS @@ -236,7 +141,7 @@ case "$with_sirius" in add_lib_from_paths SIRIUS_LDFLAGS "libsirius_cxx.*" $LIB_PATHS ;; *) - echo "==================== Linking SIRIUS_Dist to user paths ====================" + echo "==================== Linking SIRIUS to user paths ====================" pkg_install_dir="$with_sirius" check_dir "${pkg_install_dir}/lib" check_dir "${pkg_install_dir}/lib64" diff --git a/tools/toolchain/scripts/stage8/install_spfft.sh b/tools/toolchain/scripts/stage8/install_spfft.sh index 0db08681e6..423611148f 100755 --- a/tools/toolchain/scripts/stage8/install_spfft.sh +++ b/tools/toolchain/scripts/stage8/install_spfft.sh @@ -32,7 +32,7 @@ case "${with_spfft}" in if [ "${MATH_MODE}" = "mkl" ]; then EXTRA_CMAKE_FLAGS="-DSPFFT_MKL=ON -DSPFFT_FFTW_LIB=MKL" else - EXTRA_CMAKE_FLAGS="" + EXTRA_CMAKE_FLAGS="-DSPFFT_MKL=OFF -DSPFFT_FFTW_LIB=FFTW" fi [ -d SpFFT-${spfft_ver} ] && rm -rf SpFFT-${spfft_ver} diff --git a/tools/toolchain/scripts/stage8/install_stage8.sh b/tools/toolchain/scripts/stage8/install_stage8.sh index bd705ab220..8ac738f4ed 100755 --- a/tools/toolchain/scripts/stage8/install_stage8.sh +++ b/tools/toolchain/scripts/stage8/install_stage8.sh @@ -3,12 +3,12 @@ # TODO: Review and if possible fix shellcheck errors. # shellcheck disable=all +./scripts/stage8/install_dftd4.sh +./scripts/stage8/install_tblite.sh ./scripts/stage8/install_pugixml.sh ./scripts/stage8/install_spfft.sh ./scripts/stage8/install_spla.sh ./scripts/stage8/install_sirius.sh -./scripts/stage8/install_dftd4.sh ./scripts/stage8/install_trexio.sh -./scripts/stage8/install_tblite.sh ./scripts/stage8/install_mcl.sh #EOF diff --git a/tools/toolchain/scripts/stage8/sirius_memory.patch b/tools/toolchain/scripts/stage8/sirius_memory.patch deleted file mode 100644 index 3b7b617414..0000000000 --- a/tools/toolchain/scripts/stage8/sirius_memory.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/core/memory.hpp -+++ b/src/core/memory.hpp -@@ -256,7 +256,7 @@ - - /// Allocate n elements and return a unique pointer. - template --static inline auto -+inline auto - get_unique_ptr(size_t n__, memory_t M__) - { - return std::unique_ptr>(allocate(n__, M__),