mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-21 06:25:15 -04:00
[cmake] fix issues when cp2k is build with spack
Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
This commit is contained in:
parent
f45a645518
commit
25e21fa018
39 changed files with 505 additions and 552 deletions
|
|
@ -47,13 +47,16 @@ project(
|
|||
|
||||
set(cp2k_APIVERSION ${cp2k_VERSION_MAJOR}.${cp2k_VERSION_MINOR})
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||
set(CMAKE_CUDA_STANDARD 11)
|
||||
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
# set language and standard
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
|
|
@ -110,7 +113,6 @@ option(CP2K_USE_SPLA
|
|||
option(CP2K_USE_METIS "enable metis library support" OFF)
|
||||
option(CP2K_USE_LIBXSMM "Use libxsmm for small gemms (supports x86 platforms)"
|
||||
OFF)
|
||||
option(CP2K_BUILD_DBCSR "Duild dbcsr at the same time than cp2k." OFF)
|
||||
option(BUILD_SHARED_LIBS "Build cp2k shared library" ON)
|
||||
|
||||
cmake_dependent_option(CP2K_ENABLE_ELPA_OPENMP_SUPPORT
|
||||
|
|
@ -119,23 +121,8 @@ cmake_dependent_option(CP2K_ENABLE_FFTW3_OPENMP_SUPPORT
|
|||
"Enable FFTW openmp support" ON "CP2K_USE_FFTW3" OFF)
|
||||
cmake_dependent_option(CP2K_ENABLE_FFTW3_THREADS_SUPPORT
|
||||
"Enable FFTW THREADS support" OFF "CP2K_USE_FFTW3" OFF)
|
||||
cmake_dependent_option(CP2K_ENABLE_F08_MPI "Enable MPI Fortran 2008 interface"
|
||||
OFF "CP2K_USE_MPI" OFF)
|
||||
|
||||
cmake_dependent_option(
|
||||
DBCSR_USE_ACCEL
|
||||
"Enable dbcsr gpu support. It will be turned on only if cp2k gpu support is on"
|
||||
ON
|
||||
"CP2K_BUILD_DBCSR"
|
||||
OFF)
|
||||
cmake_dependent_option(DBCSR_USE_OPENMP "Enable dbcsr openmp support" OFF
|
||||
"CP2K_BUILD_DBCSR" OFF)
|
||||
cmake_dependent_option(
|
||||
DBCSR_USE_G2G
|
||||
"Enable dbcsr gpu-gpu communication support. It will be turned on only if cp2k gpu support is on"
|
||||
ON
|
||||
"CP2K_BUILD_DBCSR"
|
||||
OFF)
|
||||
cmake_dependent_option(CP2K_USE_MPI_F08 "Enable MPI Fortran 2008 interface" OFF
|
||||
"CP2K_USE_MPI" OFF)
|
||||
|
||||
cmake_dependent_option(
|
||||
CP2K_USE_CUSOLVER_MP
|
||||
|
|
@ -561,44 +548,7 @@ endif()
|
|||
# PACKAGE DISCOVERY (compiler configuration can impact package discovery)
|
||||
find_package(OpenMP REQUIRED COMPONENTS Fortran C CXX)
|
||||
|
||||
# CP2K options are prefixed with CP2K_ (namespacing) while dbcsr does not.
|
||||
if(NOT CP2K_BUILD_DBCSR)
|
||||
find_package(DBCSR 2.4 REQUIRED)
|
||||
else()
|
||||
# replace this with the block command when we update to cmake 3.25
|
||||
|
||||
set(USE_ACCEL "")
|
||||
set(BLAS_LIBRARIES "")
|
||||
set(LAPACK_LIBRARIES "")
|
||||
set(USE_MPI ${CP2K_USE_MPI})
|
||||
set(WITH_EXAMPLES OFF)
|
||||
set(BUILD_TESTING OFF)
|
||||
set(WITH_C_API OFF)
|
||||
set(USE_SMM "")
|
||||
set(USE_OPENMP ON)
|
||||
check_git_submodule(dbcsr "${CMAKE_SOURCE_DIR}/exts/dbcsr")
|
||||
if(DBCSR_USE_ACCEL AND CP2K_USE_ACCEL MATCHES "CUDA|HIP")
|
||||
if(CP2K_USE_ACCEL MATCHES "CUDA")
|
||||
set(USE_ACCEL "cuda")
|
||||
endif()
|
||||
if(CP2K_USE_ACCEL MATCHES "HIP")
|
||||
set(USE_ACCEL "hip")
|
||||
endif()
|
||||
set(WITH_GPU "${CP2K_WITH_GPU}")
|
||||
set(ACC_ARCH_NUMBER "${CP2K_GPU_ARCH_NUMBER_${CP2K_WITH_GPU}}")
|
||||
endif()
|
||||
set(BLAS_LIBRARIES "${CP2K_BLAS_LINK_LIBRARIES}")
|
||||
set(LAPACK_LIBRARIES "${CP2K_LAPACK_LINK_LIBRARIES}")
|
||||
set(USE_MPI ${CP2K_USE_MPI})
|
||||
set(WITH_C_API OFF)
|
||||
if(CP2K_USE_LIBXSMM)
|
||||
set(USE_SMM "libxsmm")
|
||||
endif()
|
||||
set(WITH_G2G ${DBCSR_WITH_G2G})
|
||||
if(DBCSR_USE_OPENMP)
|
||||
set(USE_OPENMP ON)
|
||||
endif()
|
||||
endif()
|
||||
find_package(DBCSR 2.6 REQUIRED)
|
||||
|
||||
# ==================================
|
||||
if(CP2K_USE_ELPA)
|
||||
|
|
@ -693,7 +643,7 @@ if(CP2K_USE_SUPERLU)
|
|||
find_package(SuperLU REQUIRED)
|
||||
endif()
|
||||
|
||||
if(CP2K_USE_PARMETIS)
|
||||
if(CP2K_USE_METIS)
|
||||
find_package(Metis)
|
||||
endif()
|
||||
|
||||
|
|
@ -755,7 +705,7 @@ add_subdirectory(src)
|
|||
include(GNUInstallDirs)
|
||||
|
||||
get_target_property(CP2K_LIBS cp2k_link_libs INTERFACE_LINK_LIBRARIES)
|
||||
configure_file(cmake/cp2k.pc.in cp2k.pc @ONLY)
|
||||
configure_file(cmake/libcp2k.pc.in libcp2k.pc @ONLY)
|
||||
|
||||
message(
|
||||
""
|
||||
|
|
@ -998,12 +948,16 @@ write_basic_package_version_file(
|
|||
|
||||
configure_file("${PROJECT_SOURCE_DIR}/cmake/cp2kConfig.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/cp2kConfig.cmake" @ONLY)
|
||||
|
||||
install(FILES "${PROJECT_BINARY_DIR}/cp2kConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/cp2kConfigVersion.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cp2k")
|
||||
|
||||
install(FILES "${PROJECT_BINARY_DIR}/libcp2k.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
install(
|
||||
DIRECTORY "${PROJECT_SOURCE_DIR}/cmake"
|
||||
DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cp2k"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.cmake")
|
||||
|
|
|
|||
|
|
@ -5,127 +5,106 @@
|
|||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_Fortran_FLAGS
|
||||
"${CMAKE_Fortran_FLAGS} -mtune=native -ffree-line-length-512 -ffree-form -std=f2008 -fimplicit-none -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-variable -Werror=unused-variable -Werror=conversion -Werror=zerotrip -Wuninitialized -Wno-maybe-uninitialized -Wunused-parameter"
|
||||
)
|
||||
set(CP2K_C_COMPILER_LIST "GNU;Intel;NAG;Cray;PGI;Clang;AppleClang")
|
||||
set(CP2K_Fortran_COMPILER_LIST "GNU;Intel;NAG;Cray;PGI")
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 10)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch"
|
||||
)# gcc 10+ has this automatically
|
||||
endif()
|
||||
if(NOT CMAKE_C_COMPILER_ID IN_LIST CP2K_C_COMPILER_LIST)
|
||||
message(
|
||||
WARNING
|
||||
"Unknown C compiler, trying without any additional (optimization) flags.\n"
|
||||
"You may have to specify flags for C11 support manually.\n Please open an\n"
|
||||
"issue at https://github.com/cp2k/cp2k/issues with the reported compiler \n"
|
||||
"name and the required flags.")
|
||||
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -funroll-loops")
|
||||
set(CMAKE_Fortran_FLAGS_COVERAGE
|
||||
"-O0 -g --coverage -fno-omit-frame-pointer -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace -finit-real=snan -finit-integer=-42 -finit-derived -Werror=realloc-lhs -finline-matmul-limit=0"
|
||||
message("-- CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}\n"
|
||||
"-- CMAKE_C_COMPILER full path: ${CMAKE_C_COMPILER}\n")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Fortran_COMPILER_ID IN_LIST CP2K_Fortran_COMPILER_LIST)
|
||||
message(
|
||||
WARNING
|
||||
"Unknown Fortran compiler, trying without any additional (optimization) flags.\n"
|
||||
"You will most likely have to specify extra options for free-form Fortran 2008\n"
|
||||
"for your compiler! Please open an issue at https://github.com/cp2k/cp2k/issues\n"
|
||||
"with the reported compiler name and the required flags.")
|
||||
message("-- CMAKE_Fortran_COMPILER_ID: ${CMAKE_Fortran_COMPILER_ID}\n"
|
||||
"-- CMAKE_Fortran_COMPILER full path: ${CMAKE_Fortran_COMPILER}\n")
|
||||
endif()
|
||||
|
||||
# OpenACC support with CCE is EOL: causes
|
||||
# https://github.com/cp2k/dbcsr/issues/261 eventually check compiler version
|
||||
# (similar to -h system_alloc)
|
||||
add_compile_options(
|
||||
"$<$<COMPILE_LANG_AND_ID:Fortran,GNU>:-mtune=native;-ffree-line-length-512;-ffree-form;-std=f2008;-fimplicit-none;-Werror=aliasing;-Werror=ampersand;-Werror=c-binding-type;-Werror=conversion;-Werror=intrinsic-shadow;-Werror=intrinsics-std;-Werror=line-truncation;-Werror=tabs;-Werror=target-lifetime;-Werror=underflow;-Werror=unused-but-set-variable;-Werror=unused-variable>"
|
||||
"$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<VERSION_GREATER_EQUAL:${CMAKE_Fortran_COMPILER_VERSION},11>>:-fallow-argument-mismatch>"
|
||||
"$<$<COMPILE_LANG_AND_ID:Fortran,Intel>:-free -stand=f18 -fpp -heap-arrays>"
|
||||
"$<$<COMPILE_LANG_AND_ID:Fortran,PGI>:-Mfreeform -Mextend -Mallocatable=03>"
|
||||
"$<$<COMPILE_LANG_AND_ID:Fortran,NAG>:-f2008 -free -Warn=reallocation -Warn=subnormal>"
|
||||
"$<$<COMPILE_LANG_AND_ID:C,Cray>:-hnoacc -h nomessage=1234>"
|
||||
"$<$<COMPILE_LANG_AND_ID:Fortran,Cray>:-f free -M3105 -ME7212 -hnoacc -M1234>"
|
||||
)
|
||||
|
||||
add_compile_options(
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-O3;-g;-funroll-loops>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,PGI>>:-fast>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,Intel>>:-O3;-g>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,Cray>>:-O2;-G2>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,NAG>>:-gline>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O3;-g;-funroll-loops;-Wall>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,PGI>>:-fast>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,Intel>>:-O3;-g>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,Cray>>:-O3>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,NAG>>:-gline>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,Clang>>:-O3;-funroll-loops>"
|
||||
"$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:C,AppleClang>>:-O3;-funroll-loops>"
|
||||
"$<$<NOT:$<BOOL:OpenMP_FOUND>>:$<$<AND:$<CONFIG:RELEASE>,$<COMPILE_LANG_AND_ID:Fortran,NAG>>:-gline>>"
|
||||
)
|
||||
|
||||
add_compile_options(
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-fbacktrace;-ffree-form;-fimplicit-none;-std=f2008;-fsanitize=leak;-fcheck=all,no-array-temps;-ffpe-trap=invalid,zero,overflow;-finit-derived;-finit-real=snan;-finit-integer=-42;-Werror=realloc-lhs;-finline-matmul-limit=0>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,PGI>>:-g>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,Intel>>:-O2;-debug>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,Cray>>:-G2>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O2;-ggdb;-Wall;-fsanitize=undefined;-fsanitize=address;-fsanitize-recover=all;-Wall;-Wextra;-Werror;-Wno-vla-parameter;-Wno-deprecated-declarations>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,PGI>>:-fast>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,Intel>>:-O3;-g>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,Cray>>:-G2>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,NAG>>:-g;-C>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,Clang>>:-O1;-g;-fno-omit-frame-pointer>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,AppleClang>>:-O0;-g>"
|
||||
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,NAG>>:-C=all>")
|
||||
|
||||
add_compile_options(
|
||||
"$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-O0;-g;--coverage;-fno-omit-frame-pointer;-fcheck=all;-ffpe-trap=invalid,zero,overflow;-fbacktrace;-finit-real=snan;-finit-integer=-42;-finit-derived;-Werror=realloc-lhs;-finline-matmul-limit=0>"
|
||||
"$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O0;-g;--coverage;-Wall>"
|
||||
)
|
||||
|
||||
if(NOT CP2K_USE_MPI OR NOT "${MPI_Fortran_LIBRARY_VERSION_STRING}" MATCHES "Open
|
||||
MPI")
|
||||
add_compile_options(
|
||||
"$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-fsanitize=leak>"
|
||||
"$<$<AND:$<CONFIG:COVERAGE>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O0;-g;--coverage;-Wall>"
|
||||
)
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG
|
||||
"-fbacktrace -ffree-form -fimplicit-none -std=f2008 -fsanitize=leak -fcheck=all,no-array-temps -ffpe-trap=invalid,zero,overflow -finit-derived -finit-real=snan -finit-integer=-42 -Werror=realloc-lhs -finline-matmul-limit=0"
|
||||
)
|
||||
if((NOT (USE_MPI)) OR (NOT ("${MPI_Fortran_LIBRARY_VERSION_STRING}" MATCHES
|
||||
"Open MPI")))
|
||||
set(CMAKE_Fortran_FLAGS_COVERAGE
|
||||
"${CMAKE_Fortran_FLAGS_COVERAGE} -fsanitize=leak")
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG
|
||||
"${CMAKE_Fortran_FLAGS_DEBUG} -fsanitize=leak")
|
||||
endif()
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_Fortran_FLAGS
|
||||
"${CMAKE_Fortran_FLAGS} -free -stand=f18 -fpp -heap-arrays")
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -g")
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-O2 -debug")
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
|
||||
set(CMAKE_Fortran_FLAGS
|
||||
"${CMAKE_Fortran_FLAGS} -Mfreeform -Mextend -Mallocatable=03"
|
||||
)# -Mallocatable=03: enable F2003+ assignment semantics
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-fast")
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-g")
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
|
||||
set(CMAKE_Fortran_FLAGS
|
||||
"${CMAKE_Fortran_FLAGS} -f2008 -free -Warn=reallocation -Warn=subnormal")
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-g -C")
|
||||
if(NOT OpenMP_FOUND)
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -gline"
|
||||
)# -gline is only supported without OpenMP
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C=all"
|
||||
)# some checks are not available with OpenMP
|
||||
endif()
|
||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -f free -M3105 -ME7212"
|
||||
)# -M3105: hide a
|
||||
# false-positive warning about modified loop variables due to loop fusing,
|
||||
# promote warning 7212 to an error
|
||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -G2")
|
||||
set(CMAKE_Fortran_FLAGS_DEBUG "-G2")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_Fortran_MODOUT_FLAG "-ef") # override to get lower-case module file
|
||||
# names
|
||||
else()
|
||||
message(
|
||||
WARNING
|
||||
"\
|
||||
Unknown Fortran compiler, trying without any additional (optimization) flags.\n\
|
||||
You will most likely have to specify extra options for free-form Fortran 2008 for your compiler!\n\
|
||||
Please open an issue at https://github.com/cp2k/dbcsr/issues with the reported compiler name and the required flags."
|
||||
)
|
||||
message("-- CMAKE_Fortran_COMPILER_ID: " ${CMAKE_Fortran_COMPILER_ID})
|
||||
message("-- CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER})
|
||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "-lgcov") # Apple's Clang needs an extra
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -g -funroll-loops -Wall")
|
||||
set(CMAKE_C_FLAGS_COVERAGE "-O0 -g --coverage -Wall")
|
||||
set(CMAKE_C_FLAGS_DEBUG
|
||||
"-O2 -ggdb -Wall -fsanitize=undefined -fsanitize=address -fsanitize-recover=all -Wall -Wextra -Werror -Wno-vla-parameter -Wno-deprecated-declarations"
|
||||
)
|
||||
if((NOT (USE_MPI)) OR (NOT ("${MPI_Fortran_LIBRARY_VERSION_STRING}" MATCHES
|
||||
"Open MPI")))
|
||||
set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE} -fsanitize=leak")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fsanitize=leak")
|
||||
endif()
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops")
|
||||
set(CMAKE_C_FLAGS_COVERAGE "-O0 -g --coverage")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O1 -g -fno-omit-frame-pointer")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops")
|
||||
set(CMAKE_C_FLAGS_COVERAGE "-O0 -g --coverage")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "-lgcov") # Apple's Clang needs an extra
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -g")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -debug")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "PGI")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-fast")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Cray")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-G2")
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 9)
|
||||
# prevent deallocation failures due to tcmalloc's free with glibc's
|
||||
# aligned_alloc, see https://bugzilla.redhat.com/show_bug.cgi?id=1569391
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -h system_alloc")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -h system_alloc")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -h system_alloc")
|
||||
# since the detection of the implicitly linked libraries occurs before we
|
||||
# can intervene, filter them out again
|
||||
list(FILTER CMAKE_C_IMPLICIT_LINK_LIBRARIES EXCLUDE REGEX "tcmalloc")
|
||||
list(FILTER CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES EXCLUDE REGEX "tcmalloc")
|
||||
endif()
|
||||
# OpenACC support with CCE is EOL: causes
|
||||
# https://github.com/cp2k/dbcsr/issues/261 eventually check compiler version
|
||||
# (similar to -h system_alloc)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -hnoacc -h nomessage=1234")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -hnoacc -h nomessage=1234")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -hnoacc -M1234")
|
||||
else()
|
||||
message(
|
||||
WARNING
|
||||
"\
|
||||
Unknown C++ compiler, trying without any additional (optimization) flags.\n\
|
||||
You may have to specify flags for C++11/14 support manually.\n\
|
||||
Please open an issue at https://github.com/cp2k/dbcsr/issues with the reported compiler name and the required flags."
|
||||
)
|
||||
message("-- CMAKE_C_COMPILER_ID: " ${CMAKE_C_COMPILER_ID})
|
||||
message("-- CMAKE_C_COMPILER full path: " ${CMAKE_C_COMPILER})
|
||||
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
|
||||
set(CMAKE_Fortran_MODOUT_FLAG "-ef") # override to get lower-case module file
|
||||
# names
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Cray" AND CMAKE_C_COMPILER_VERSION
|
||||
VERSION_LESS 9)
|
||||
# prevent deallocation failures due to tcmalloc's free with glibc's
|
||||
# aligned_alloc, see https://bugzilla.redhat.com/show_bug.cgi?id=1569391
|
||||
add_compile_options("$<$<LANGUAGE:C>:-h;system_alloc>"
|
||||
"$<$<LANGUAGE:Fortran>:-h;system_alloc>")
|
||||
# since the detection of the implicitly linked libraries occurs before we can
|
||||
# intervene, filter them out again
|
||||
list(FILTER CMAKE_C_IMPLICIT_LINK_LIBRARIES EXCLUDE REGEX "tcmalloc")
|
||||
list(FILTER CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES EXCLUDE REGEX "tcmalloc")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,139 +0,0 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
# Copyright (c) 2022- ETH Zurich
|
||||
#
|
||||
# authors : Mathieu Taillefumier
|
||||
|
||||
if(NOT
|
||||
(CMAKE_C_COMPILER_LOADED
|
||||
OR CMAKE_CXX_COMPILER_LOADED
|
||||
OR CMAKE_Fortran_COMPILER_LOADED))
|
||||
message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_VENDOR_LIST
|
||||
"auto"
|
||||
"MKL"
|
||||
"OpenBLAS"
|
||||
"SCI"
|
||||
"GenericBLAS"
|
||||
"Armpl"
|
||||
"FlexiBLAS"
|
||||
"Atlas"
|
||||
"NVHPCBlas"
|
||||
"CUSTOM")
|
||||
|
||||
set(__BLAS_VENDOR_LIST ${CP2K_BLAS_VENDOR_LIST})
|
||||
list(REMOVE_ITEM __BLAS_VENDOR_LIST "auto")
|
||||
list(REMOVE_ITEM __BLAS_VENDOR_LIST "CUSTOM")
|
||||
|
||||
# set(CP2K_BLAS_VENDOR "auto" CACHE STRING "Blas library for computations on
|
||||
# host")
|
||||
set_property(CACHE CP2K_BLAS_VENDOR PROPERTY STRINGS ${CP2K_BLAS_VENDOR_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_VENDOR} IN_LIST CP2K_BLAS_VENDOR_LIST)
|
||||
message(FATAL_ERROR "Invalid Host BLAS backend")
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_THREAD_LIST "sequential" "thread" "gnu-thread" "intel-thread"
|
||||
"tbb-thread" "openmp")
|
||||
|
||||
set(CP2K_BLAS_THREADING
|
||||
"sequential"
|
||||
CACHE STRING "threaded blas library")
|
||||
set_property(CACHE CP2K_BLAS_THREADING PROPERTY STRINGS
|
||||
${CP2K_BLAS_THREAD_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_THREADING} IN_LIST CP2K_BLAS_THREAD_LIST)
|
||||
message(FATAL_ERROR "Invalid threaded BLAS backend")
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_INTERFACE_BITS_LIST "32bits" "64bits")
|
||||
set(CP2K_BLAS_INTERFACE
|
||||
"32bits"
|
||||
CACHE STRING
|
||||
"32 bits integers are used for indices, matrices and vectors sizes")
|
||||
set_property(CACHE CP2K_BLAS_INTERFACE
|
||||
PROPERTY STRINGS ${CP2K_BLAS_INTERFACE_BITS_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_INTERFACE} IN_LIST CP2K_BLAS_INTERFACE_BITS_LIST)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Invalid parameters. Blas and lapack can exist in two flavors 32 or 64 bits interfaces (relevant mostly for mkl)"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_FOUND FALSE)
|
||||
|
||||
# first check for a specific implementation if requested
|
||||
|
||||
if(NOT CP2K_BLAS_VENDOR MATCHES "auto|CUSTOM")
|
||||
find_package(${CP2K_BLAS_VENDOR} REQUIRED)
|
||||
if(TARGET cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas)
|
||||
get_target_property(
|
||||
CP2K_BLAS_INCLUDE_DIRS cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(
|
||||
CP2K_BLAS_LINK_LIBRARIES cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
endif()
|
||||
else()
|
||||
if(CP2K_BLAS_VENDOR MATCHES "CUSTOM" AND NOT DEFINED CP2K_BLAS_LINK_LIBRARIES)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Setting CP2K_BLAS_VENDOR=CUSTOM imply setting CP2K_BLAS_LINK_LIBRARIES\n and CP2K_LAPACK_LINK_LIBRARIES to the right libraries. See the README_cmake.md for more details"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DEFINED CP2K_BLAS_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
else()
|
||||
# search for any blas implementation and exit immediately if one is found.
|
||||
# we could also give a full list of found implementation and let the user
|
||||
# choose which implementation to use
|
||||
foreach(_libs ${__BLAS_VENDOR_LIST})
|
||||
# I exclude the first item of the list
|
||||
find_package(${_libs})
|
||||
if(TARGET cp2k::BLAS::${_libs}::blas)
|
||||
get_target_property(CP2K_BLAS_INCLUDE_DIRS cp2k::BLAS::${_libs}::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(CP2K_BLAS_LINK_LIBRARIES cp2k::BLAS::${_libs}::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_VENDOR "${_libs}")
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# we exclude the CP2K_BLAS_INCLUDE_DIRS from the list of mandatory variables as
|
||||
# having the fortran interface is usually enough. C, C++ and others languages
|
||||
# might require this information though
|
||||
|
||||
find_package_handle_standard_args(
|
||||
Blas REQUIRED_VARS CP2K_BLAS_LINK_LIBRARIES CP2K_BLAS_VENDOR CP2K_BLAS_FOUND)
|
||||
|
||||
if(NOT TARGET cp2k::BLAS::blas)
|
||||
add_library(cp2k::BLAS::blas INTERFACE IMPORTED)
|
||||
endif()
|
||||
|
||||
set_target_properties(cp2k::BLAS::blas PROPERTIES INTERFACE_LINK_LIBRARIES
|
||||
"${CP2K_BLAS_LINK_LIBRARIES}")
|
||||
|
||||
if(CP2K_BLAS_INCLUDE_DIRS)
|
||||
set_target_properties(
|
||||
cp2k::BLAS::blas PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${CP2K_BLAS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_BLAS_INCLUDE_DIRS)
|
||||
mark_as_advanced(CP2K_BLAS_LINK_LIBRARIES)
|
||||
mark_as_advanced(CP2K_BLAS_VENDOR)
|
||||
mark_as_advanced(CP2K_BLAS_FOUND)
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
# Copyright (c) 2022- ETH Zurich
|
||||
#
|
||||
# authors : Mathieu Taillefumier
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(cp2k_utils)
|
||||
|
||||
cp2k_set_default_paths(SCALAPACK "SCALAPACK")
|
||||
|
||||
# check if we have mkl as blas library or not and pick the scalapack from mkl
|
||||
# distro if found
|
||||
|
||||
if(CP2K_SCALAPACK_VENDOR STREQUAL "GENERIC")
|
||||
if(TARGET cp2k::BLAS::MKL::scalapack_link)
|
||||
message("-----------------------------------------------------------------")
|
||||
message("- FindScalapack warning -")
|
||||
message("-----------------------------------------------------------------")
|
||||
message(" ")
|
||||
message(
|
||||
WARNING
|
||||
"You may want to use mkl implementation of scalapack. To do this add -DCP2K_SCALAPACK_VENDOR=MKL to the cmake command line"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TARGET cp2k::BLAS::SCI::scalapack_link)
|
||||
message("-----------------------------------------------------------------")
|
||||
message("- FindScalapack warning -")
|
||||
message("-----------------------------------------------------------------")
|
||||
message(" ")
|
||||
message(
|
||||
WARNING
|
||||
"You may want to use Cray implementation of scalapack. To do this add -DCP2K_SCALAPACK_VENDOR=SCI to the cmake command line"
|
||||
)
|
||||
message(" ")
|
||||
message(" ")
|
||||
endif()
|
||||
|
||||
# try to detect location with pkgconfig
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(CP2K_SCALAPACK IMPORTED_TARGET GLOBAL "scalapack")
|
||||
endif()
|
||||
|
||||
# this should be enough for detecting scalapack compiled by hand. If scalapack
|
||||
# is vendor specific then we sahould have a target blas::scalapack available.
|
||||
# it removes the problem of modifying too many files when we add a vendor
|
||||
# specific blas/lapack/scalapack implementation
|
||||
|
||||
if(NOT CP2K_SCALAPACK_FOUND)
|
||||
cp2k_find_libraries(SCALAPACK "scalapack")
|
||||
endif()
|
||||
elseif(TARGET cp2k::BLAS::MKL::scalapack_link)
|
||||
# we have mkl check for the different mkl target
|
||||
get_target_property(CP2K_SCALAPACK_LINK_LIBRARIES
|
||||
cp2k::BLAS::MKL::scalapack_link INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_SCALAPACK_FOUND yes)
|
||||
elseif(TARGET cp2k::BLAS::SCI::scalapack_link)
|
||||
# we have mkl check for the different mkl target
|
||||
get_target_property(CP2K_SCALAPACK_LINK_LIBRARIES
|
||||
cp2k::BLAS::SCI::scalapack_link INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_SCALAPACK_FOUND yes)
|
||||
endif()
|
||||
|
||||
# check if found
|
||||
find_package_handle_standard_args(SCALAPACK
|
||||
REQUIRED_VARS CP2K_SCALAPACK_LINK_LIBRARIES)
|
||||
# prevent clutter in cache
|
||||
|
||||
# add target to link against
|
||||
if(CP2K_SCALAPACK_FOUND)
|
||||
|
||||
if(NOT TARGET cp2k::SCALAPACK::scalapack)
|
||||
add_library(cp2k::SCALAPACK::scalapack INTERFACE IMPORTED)
|
||||
endif()
|
||||
|
||||
set_property(
|
||||
TARGET cp2k::SCALAPACK::scalapack PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
${CP2K_SCALAPACK_LINK_LIBRARIES})
|
||||
endif()
|
||||
mark_as_advanced(CP2K_SCALAPACK_FOUND CP2K_SCALAPACK_LINK_LIBRARIES)
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# this template is filled-in by CMake `configure_file(... @ONLY)`
|
||||
# the `@....@` are filled in by CMake configure_file(),
|
||||
# from variables set in your CMakeLists.txt or by CMake itself
|
||||
#
|
||||
# Good tutoral for understanding .pc files:
|
||||
# https://people.freedesktop.org/~dbn/pkg-config-guide.html
|
||||
|
||||
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||
exec_prefix="${prefix}"
|
||||
libdir="${prefix}/lib"
|
||||
includedir="${prefix}/include"
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: @CMAKE_PROJECT_DESCRIPTION@
|
||||
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Cflags: -I"${includedir}"
|
||||
Libs: -L"${libdir}" -lcp2k -lcp2k_dbm -lcp2k_grid -lcp2k_offload
|
||||
#Libs.private: -L"${libdir}" @CP2K_LIBS@
|
||||
|
|
@ -5,113 +5,120 @@
|
|||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
# store CXX compiler id. Used in MKL package.
|
||||
set(SIRIUS_CXX_COMPILER_ID @CMAKE_CXX_COMPILER_ID@)
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID})
|
||||
set(CMAKE_CXX_COMPILER_ID ${SIRIUS_CXX_COMPILER_ID})
|
||||
endif()
|
||||
if(NOT TARGET cp2k::cp2k)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules"
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
set(CP2K_BLAS_VENDOR @CP2K_BLAS_VENDOR@)
|
||||
set(CP2K_SCALAPACK_VENDOR @CP2K_SCALAPACK_VENDOR@)
|
||||
# store CXX compiler id. Used in MKL package.
|
||||
set(CP2K_CXX_COMPILER_ID @CMAKE_CXX_COMPILER_ID@)
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID})
|
||||
set(CMAKE_CXX_COMPILER_ID ${CP2K_CXX_COMPILER_ID})
|
||||
endif()
|
||||
|
||||
if (@CP2K_BLAS_VENDOR@ MATCHES "CUSTOM")
|
||||
set(CP2K_BLAS_LINK_LIBRARIES @CP2K_BLAS_LINK_LIBRARIES@)
|
||||
set(CP2K_LAPACK_LINK_LIBRARIES @CP2K_LAPACK_LINK_LIBRARIES@)
|
||||
endif()
|
||||
set(CP2K_BLAS_VENDOR @CP2K_BLAS_VENDOR@)
|
||||
set(CP2K_SCALAPACK_VENDOR @CP2K_SCALAPACK_VENDOR@)
|
||||
set(CP2K_BLAS_LINK_LIBRARIES @CP2K_BLAS_LINK_LIBRARIES@)
|
||||
set(CP2K_LAPACK_LINK_LIBRARIES @CP2K_LAPACK_LINK_LIBRARIES@)
|
||||
set(CP2K_SCALAPACK_LINK_LIBRARIES @CP2K_SCALAPACK_LINK_LIBRARIES@)
|
||||
|
||||
if (@CP2K_SCALAPACK_VENDOR@ MATCHES "CUSTOM")
|
||||
set(CP2K_SCALAPACK_LINK_LIBRARIES @CP2K_SCALAPACK_LINK_LIBRARIES@)
|
||||
endif()
|
||||
set(CP2K_CONFIG_PACKAGE ON)
|
||||
find_dependency(Lapack REQUIRED)
|
||||
|
||||
set(cp2k_VERSION @cp2k_VERSION@)
|
||||
# define lapack and blas TARGETS
|
||||
|
||||
find_package(Lapack REQUIRED)
|
||||
find_package(DBCSR 2.4 REQUIRED)
|
||||
if(@CP2K_USE_MPI@)
|
||||
find_dependency(SCALAPACK REQUIRED)
|
||||
endif()
|
||||
unset(CP2K_CONFIG_PACKAGE)
|
||||
|
||||
if(@CP2K_USE_LIBXSMM@
|
||||
find_package(LibXSMM REQUIRED)
|
||||
endif()
|
||||
set(cp2k_VERSION @cp2k_VERSION@)
|
||||
|
||||
if (@@CP2K_USE_HIP@)
|
||||
# Find hip
|
||||
find_package(hipfft REQUIRED IMPORTED CONFIG)
|
||||
find_package(hipblas REQUIRED IMPORTED CONFIG)
|
||||
endif()
|
||||
find_dependency(DBCSR 2.5 REQUIRED)
|
||||
|
||||
if (@@CP2K_USE_CUDA@)
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_ELPA@)
|
||||
find_package(Elpa REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_LIBXSMM@)
|
||||
find_dependency(LibXSMM REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBXC@)
|
||||
find_package(LibXC 6 REQUIRED EXACT)
|
||||
endif()
|
||||
if(@CP2K_USE_HIP@)
|
||||
# Find hip
|
||||
find_dependency(hipfft REQUIRED IMPORTED CONFIG)
|
||||
find_dependency(hipblas REQUIRED IMPORTED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_COSMA@)
|
||||
find_package(cosma REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_CUDA@)
|
||||
find_dependency(CUDAToolkit REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_ELPA@)
|
||||
find_dependency(Elpa REQUIRED)
|
||||
endif()
|
||||
|
||||
if (@@CP2K_USE_MPI@)
|
||||
find_package(MPI REQUIRED)
|
||||
find_package(SCALAPACK REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_LIBXC@)
|
||||
find_dependency(LibXC 6 REQUIRED EXACT)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_FFTW3@)
|
||||
find_package(Fftw REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_COSMA@)
|
||||
find_dependency(cosma REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_MPI@)
|
||||
find_dependency(MPI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_FFTW3@)
|
||||
find_dependency(Fftw REQUIRED)
|
||||
endif()
|
||||
# QUIP
|
||||
if(@CP2K_USE_QUIP@)
|
||||
find_package(Quip REQUIRED)
|
||||
if(@CP2K_USE_QUIP@)
|
||||
find_dependency(Quip REQUIRED)
|
||||
endif()
|
||||
|
||||
# libint
|
||||
|
||||
if(@CP2K_USE_LIBINT2@)
|
||||
find_dependency(Libint2 REQUIRED)
|
||||
endif()
|
||||
|
||||
# spglib
|
||||
|
||||
if(@CP2K_USE_SPGLIB@)
|
||||
find_dependency(LibSPG REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SPLA@)
|
||||
find_dependency(SPLA REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SIRIUS@)
|
||||
find_dependency(sirius REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SUPERLU@)
|
||||
find_dependency(SuperLU REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_METIS@)
|
||||
find_dependency(Metis)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PEXSI@)
|
||||
# PEXSI 1.2 uses cmake as build system
|
||||
find_dependency(PEXSI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PLUMED@)
|
||||
find_dependency(Plumed REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBTORCH@)
|
||||
find_dependency(Torch REQUIRED)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cp2kTargets.cmake")
|
||||
|
||||
# Clean-up module path.
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
|
||||
|
||||
endif()
|
||||
|
||||
# libint
|
||||
|
||||
if(@CP2K_USE_LIBINT2@)
|
||||
find_package(Libint2 REQUIRED)
|
||||
endif()
|
||||
|
||||
# spglib
|
||||
|
||||
if(@CP2K_USE_SPGLIB@)
|
||||
find_package(LibSPG REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SPLA@)
|
||||
find_package(SPLA REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SIRIUS@)
|
||||
find_package(sirius REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SUPERLU@)
|
||||
find_package(SuperLU REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PARMETIS@)
|
||||
find_package(Metis)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PTSCOTCH@)
|
||||
find_package(Ptscotch REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PEXSI@)
|
||||
# PEXSI 1.2 uses cmake as build system
|
||||
find_package(PEXSI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PLUMED@)
|
||||
find_package(Plumed REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBTORCH@)
|
||||
find_package(Torch REQUIRED)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cp2kTargets.cmake")
|
||||
|
|
|
|||
11
cmake/libcp2k.pc.in
Normal file
11
cmake/libcp2k.pc.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||
exec_prefix="${prefix}"
|
||||
libdir="${prefix}/@CMAKE_INSTALL_LIBDIR@"
|
||||
includedir="${prefix}/@CMAKE_INSTALL_INCLUDEDIR@"
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: @CMAKE_PROJECT_DESCRIPTION@
|
||||
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Cflags: -I"${includedir}/cp2k" -I"${includedir}/cp2k/@CMAKE_Fortran_COMPILER_ID@-@CMAKE_Fortran_COMPILER_VERSION@"
|
||||
Libs: -L"${libdir}" -lcp2k
|
||||
151
cmake/modules/FindBlas.cmake
Normal file
151
cmake/modules/FindBlas.cmake
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
# Copyright (c) 2022- ETH Zurich
|
||||
#
|
||||
# authors : Mathieu Taillefumier
|
||||
|
||||
if(NOT
|
||||
(CMAKE_C_COMPILER_LOADED
|
||||
OR CMAKE_CXX_COMPILER_LOADED
|
||||
OR CMAKE_Fortran_COMPILER_LOADED))
|
||||
message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_CONFIG_PACKAGE)
|
||||
set(CP2K_BLAS_VENDOR_LIST
|
||||
# cmake-format: sortable
|
||||
"auto"
|
||||
"MKL"
|
||||
"OpenBLAS"
|
||||
"SCI"
|
||||
"GenericBLAS"
|
||||
"Armpl"
|
||||
"FlexiBLAS"
|
||||
"Atlas"
|
||||
"NVHPCBlas"
|
||||
"CUSTOM")
|
||||
|
||||
set(__BLAS_VENDOR_LIST ${CP2K_BLAS_VENDOR_LIST})
|
||||
list(REMOVE_ITEM __BLAS_VENDOR_LIST "auto")
|
||||
list(REMOVE_ITEM __BLAS_VENDOR_LIST "CUSTOM")
|
||||
|
||||
# set(CP2K_BLAS_VENDOR "auto" CACHE STRING "Blas library for computations on
|
||||
# host")
|
||||
set_property(CACHE CP2K_BLAS_VENDOR PROPERTY STRINGS ${CP2K_BLAS_VENDOR_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_VENDOR} IN_LIST CP2K_BLAS_VENDOR_LIST)
|
||||
message(FATAL_ERROR "Invalid Host BLAS backend")
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_THREAD_LIST
|
||||
# cmake-format: sortable
|
||||
"sequential" "thread" "gnu-thread" "intel-thread" "tbb-thread" "openmp")
|
||||
|
||||
set(CP2K_BLAS_THREADING
|
||||
"sequential"
|
||||
CACHE STRING "threaded blas library")
|
||||
set_property(CACHE CP2K_BLAS_THREADING PROPERTY STRINGS
|
||||
${CP2K_BLAS_THREAD_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_THREADING} IN_LIST CP2K_BLAS_THREAD_LIST)
|
||||
message(FATAL_ERROR "Invalid threaded BLAS backend")
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_INTERFACE_BITS_LIST "32bits" "64bits")
|
||||
set(CP2K_BLAS_INTERFACE
|
||||
"32bits"
|
||||
CACHE STRING
|
||||
"32 bits integers are used for indices, matrices and vectors sizes")
|
||||
set_property(CACHE CP2K_BLAS_INTERFACE
|
||||
PROPERTY STRINGS ${CP2K_BLAS_INTERFACE_BITS_LIST})
|
||||
|
||||
if(NOT ${CP2K_BLAS_INTERFACE} IN_LIST CP2K_BLAS_INTERFACE_BITS_LIST)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Invalid parameters. Blas and lapack can exist in two flavors 32 or 64 bits interfaces (relevant mostly for mkl)"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CP2K_BLAS_FOUND FALSE)
|
||||
|
||||
# first check for a specific implementation if requested
|
||||
|
||||
if(NOT CP2K_BLAS_VENDOR MATCHES "auto|CUSTOM")
|
||||
if(DEFINED CP2K_BLAS_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
else()
|
||||
find_package(${CP2K_BLAS_VENDOR} REQUIRED)
|
||||
if(TARGET cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas)
|
||||
get_target_property(
|
||||
CP2K_BLAS_INCLUDE_DIRS cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(
|
||||
CP2K_BLAS_LINK_LIBRARIES cp2k::BLAS::${CP2K_BLAS_VENDOR}::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(CP2K_BLAS_VENDOR MATCHES "CUSTOM" AND NOT DEFINED
|
||||
CP2K_BLAS_LINK_LIBRARIES)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Setting CP2K_BLAS_VENDOR=CUSTOM imply setting CP2K_BLAS_LINK_LIBRARIES\n and CP2K_LAPACK_LINK_LIBRARIES to the right libraries. See the README_cmake.md for more details"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DEFINED CP2K_BLAS_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
else()
|
||||
# search for any blas implementation and exit immediately if one is found.
|
||||
# we could also give a full list of found implementation and let the user
|
||||
# choose which implementation to use
|
||||
foreach(_libs ${__BLAS_VENDOR_LIST})
|
||||
# I exclude the first item of the list
|
||||
find_package(${_libs})
|
||||
if(TARGET cp2k::BLAS::${_libs}::blas)
|
||||
get_target_property(CP2K_BLAS_INCLUDE_DIRS cp2k::BLAS::${_libs}::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(
|
||||
CP2K_BLAS_LINK_LIBRARIES cp2k::BLAS::${_libs}::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_BLAS_VENDOR "${_libs}")
|
||||
set(CP2K_BLAS_FOUND TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(CP2K_BLAS_FOUND ON)
|
||||
endif()
|
||||
|
||||
# we exclude the CP2K_BLAS_INCLUDE_DIRS from the list of mandatory variables as
|
||||
# having the fortran interface is usually enough. C, C++ and others languages
|
||||
# might require this information though
|
||||
|
||||
find_package_handle_standard_args(
|
||||
Blas REQUIRED_VARS CP2K_BLAS_LINK_LIBRARIES CP2K_BLAS_VENDOR CP2K_BLAS_FOUND)
|
||||
|
||||
if(NOT TARGET cp2k::BLAS::blas)
|
||||
add_library(cp2k::BLAS::blas INTERFACE IMPORTED)
|
||||
endif()
|
||||
|
||||
set_target_properties(cp2k::BLAS::blas PROPERTIES INTERFACE_LINK_LIBRARIES
|
||||
"${CP2K_BLAS_LINK_LIBRARIES}")
|
||||
|
||||
if(CP2K_BLAS_INCLUDE_DIRS)
|
||||
set_target_properties(
|
||||
cp2k::BLAS::blas PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${CP2K_BLAS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_BLAS_INCLUDE_DIRS)
|
||||
mark_as_advanced(CP2K_BLAS_LINK_LIBRARIES)
|
||||
mark_as_advanced(CP2K_BLAS_VENDOR)
|
||||
mark_as_advanced(CP2K_BLAS_FOUND)
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
# authors : Mathieu Taillefumier
|
||||
|
||||
find_package(PkgConfig)
|
||||
include(cp2k_utils)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(cp2k_utils)
|
||||
|
||||
cp2k_set_default_paths(BLIS "BLIS")
|
||||
|
||||
|
|
@ -20,33 +20,34 @@ include(FindPackageHandleStandardArgs)
|
|||
find_package(PkgConfig)
|
||||
find_package(Blas REQUIRED)
|
||||
|
||||
if(CP2K_BLAS_FOUND)
|
||||
# LAPACK in the Intel MKL 10+ library?
|
||||
if(CP2K_BLAS_VENDOR MATCHES "MKL|OpenBLAS|Armpl|SCI|FlexiBLAS|NVHPC")
|
||||
# we just need to create the interface that's all
|
||||
set(CP2K_LAPACK_FOUND TRUE)
|
||||
get_target_property(CP2K_LAPACK_INCLUDE_DIRS cp2k::BLAS::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(CP2K_LAPACK_LINK_LIBRARIES cp2k::BLAS::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
else()
|
||||
# we might get lucky to find a pkgconfig package for lapack (fedora provides
|
||||
# one for instance)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(CP2K_LAPACK lapack)
|
||||
endif()
|
||||
if(NOT CP2K_CONFIG_PACKAGE)
|
||||
|
||||
if(NOT CP2K_LAPACK_FOUND)
|
||||
find_library(
|
||||
CP2K_LAPACK_LINK_LIBRARIES
|
||||
NAMES "lapack" "lapack64"
|
||||
PATH_SUFFIXES "openblas" "openblas64" "openblas-pthread"
|
||||
"openblas-openmp" "lib" "lib64"
|
||||
NO_DEFAULT_PATH)
|
||||
if(CP2K_BLAS_FOUND)
|
||||
# LAPACK in the Intel MKL 10+ library?
|
||||
if(CP2K_BLAS_VENDOR MATCHES "MKL|OpenBLAS|Armpl|SCI|FlexiBLAS|NVHPC")
|
||||
# we just need to create the interface that's all
|
||||
get_target_property(CP2K_LAPACK_INCLUDE_DIRS cp2k::BLAS::blas
|
||||
INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(CP2K_LAPACK_LINK_LIBRARIES cp2k::BLAS::blas
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
else()
|
||||
# we might get lucky to find a pkgconfig package for lapack (fedora
|
||||
# provides one for instance)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(CP2K_LAPACK lapack)
|
||||
endif()
|
||||
|
||||
if(NOT CP2K_LAPACK_FOUND)
|
||||
find_library(
|
||||
CP2K_LAPACK_LINK_LIBRARIES
|
||||
NAMES "lapack" "lapack64"
|
||||
PATH_SUFFIXES "openblas" "openblas64" "openblas-pthread"
|
||||
"openblas-openmp" "lib" "lib64"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check if found
|
||||
find_package_handle_standard_args(Lapack
|
||||
REQUIRED_VARS CP2K_LAPACK_LINK_LIBRARIES)
|
||||
|
|
@ -55,6 +56,7 @@ if(NOT TARGET cp2k::LAPACK::lapack)
|
|||
add_library(cp2k::LAPACK::lapack INTERFACE IMPORTED)
|
||||
add_library(cp2k::LAPACK::LAPACK ALIAS cp2k::LAPACK::lapack)
|
||||
endif()
|
||||
|
||||
set_property(TARGET cp2k::LAPACK::lapack PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
${CP2K_LAPACK_LINK_LIBRARIES})
|
||||
if(CP2K_LAPACK_INCLUDE_DIRS)
|
||||
|
|
@ -64,5 +66,4 @@ if(CP2K_LAPACK_INCLUDE_DIRS)
|
|||
endif()
|
||||
|
||||
# prevent clutter in cache
|
||||
mark_as_advanced(CP2K_LAPACK_FOUND CP2K_LAPACK_LIBRARIES
|
||||
CP2K_LAPACK_INCLUDE_DIRS)
|
||||
mark_as_advanced(CP2K_LAPACK_LIBRARIES CP2K_LAPACK_INCLUDE_DIRS)
|
||||
82
cmake/modules/FindSCALAPACK.cmake
Normal file
82
cmake/modules/FindSCALAPACK.cmake
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! CP2K: A general program to perform molecular dynamics simulations !
|
||||
#! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
|
||||
#! !
|
||||
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
||||
#!-------------------------------------------------------------------------------------------------!
|
||||
|
||||
# Copyright (c) 2022- ETH Zurich
|
||||
#
|
||||
# authors : Mathieu Taillefumier
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(cp2k_utils)
|
||||
|
||||
cp2k_set_default_paths(SCALAPACK "SCALAPACK")
|
||||
|
||||
# check if we have mkl as blas library or not and pick the scalapack from mkl
|
||||
# distro if found
|
||||
if(NOT CP2K_CONFIG_PACKAGE)
|
||||
if(CP2K_SCALAPACK_VENDOR STREQUAL "GENERIC")
|
||||
if(TARGET cp2k::BLAS::MKL::scalapack_link)
|
||||
message(
|
||||
WARNING
|
||||
"-----------------------------------------------------------------"
|
||||
"- FindScalapack warning -"
|
||||
"-----------------------------------------------------------------"
|
||||
"\n"
|
||||
"You may want to use mkl implementation of scalapack. To do this\n"
|
||||
"add -DCP2K_SCALAPACK_VENDOR=MKL to the cmake command line. \n")
|
||||
endif()
|
||||
|
||||
if(TARGET cp2k::BLAS::SCI::scalapack_link)
|
||||
message(
|
||||
WARNING
|
||||
"-----------------------------------------------------------------\n"
|
||||
"- FindScalapack warning -\n"
|
||||
"-----------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"You may want to use Cray implementation of scalapack. To do this \n"
|
||||
"add -DCP2K_SCALAPACK_VENDOR=SCI to the cmake command line\n\n")
|
||||
endif()
|
||||
|
||||
# try to detect location with pkgconfig
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(CP2K_SCALAPACK IMPORTED_TARGET GLOBAL "scalapack")
|
||||
endif()
|
||||
|
||||
# this should be enough for detecting scalapack compiled by hand. If
|
||||
# scalapack is vendor specific then we sahould have a target blas::scalapack
|
||||
# available. it removes the problem of modifying too many files when we add
|
||||
# a vendor specific blas/lapack/scalapack implementation
|
||||
|
||||
if(NOT CP2K_SCALAPACK_FOUND)
|
||||
cp2k_find_libraries(SCALAPACK "scalapack")
|
||||
endif()
|
||||
elseif(TARGET cp2k::BLAS::MKL::scalapack_link)
|
||||
# we have mkl check for the different mkl target
|
||||
get_target_property(
|
||||
CP2K_SCALAPACK_LINK_LIBRARIES cp2k::BLAS::MKL::scalapack_link
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
set(CP2K_SCALAPACK_FOUND yes)
|
||||
elseif(TARGET cp2k::BLAS::SCI::scalapack_link)
|
||||
# we have mkl check for the different mkl target
|
||||
get_target_property(
|
||||
CP2K_SCALAPACK_LINK_LIBRARIES cp2k::BLAS::SCI::scalapack_link
|
||||
INTERFACE_LINK_LIBRARIES)
|
||||
endif()
|
||||
endif()
|
||||
# check if found
|
||||
find_package_handle_standard_args(SCALAPACK
|
||||
REQUIRED_VARS CP2K_SCALAPACK_LINK_LIBRARIES)
|
||||
# prevent clutter in cache
|
||||
|
||||
# add target to link against
|
||||
if(NOT TARGET cp2k::SCALAPACK::scalapack)
|
||||
add_library(cp2k::SCALAPACK::scalapack INTERFACE IMPORTED)
|
||||
endif()
|
||||
|
||||
set_property(TARGET cp2k::SCALAPACK::scalapack
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES ${CP2K_SCALAPACK_LINK_LIBRARIES})
|
||||
mark_as_advanced(CP2K_SCALAPACK_LINK_LIBRARIES)
|
||||
|
|
@ -1495,8 +1495,6 @@ else()
|
|||
add_library(cp2k "${CP2K_SRCS};${CP2K_SRCS_C};${CP2K_SRCS_GPU}")
|
||||
endif()
|
||||
|
||||
target_compile_features(cp2k PUBLIC cxx_std_14)
|
||||
target_compile_features(cp2k PUBLIC c_std_99)
|
||||
target_compile_features(cp2k PUBLIC cuda_std_11)
|
||||
target_include_directories(cp2k PUBLIC $<INSTALL_INTERFACE:include/cp2k>)
|
||||
|
||||
|
|
@ -1571,7 +1569,7 @@ target_compile_definitions(
|
|||
cp2k
|
||||
PUBLIC $<$<BOOL:${CP2K_USE_MPI}>:__parallel>
|
||||
$<$<BOOL:${CP2K_USE_MPI}>:__SCALAPACK>
|
||||
$<$<BOOL:${CP2K_ENABLE_F08_MPI}>:__MPI_08>
|
||||
$<$<BOOL:${CP2K_USE_F08_MPI}>:__MPI_08>
|
||||
__COMPILE_DATE=\"${CP2K_TIMESTAMP}\"
|
||||
__COMPILE_HOST=\"${CP2K_HOST_NAME}\"
|
||||
__COMPILE_REVISION=\"${CP2K_GIT_HASH}\"
|
||||
|
|
@ -1657,8 +1655,7 @@ add_executable(dbt_tas_unittest dbt/tas/dbt_tas_unittest.F)
|
|||
|
||||
set_target_properties(
|
||||
cp2k-bin
|
||||
PROPERTIES CXX_STANDARD 14
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
LINKER_LANGUAGE "CXX"
|
||||
OUTPUT_NAME "cp2k.${__cp2k_ext}")
|
||||
|
|
@ -1668,13 +1665,11 @@ target_link_libraries(cp2k-bin PUBLIC cp2k)
|
|||
foreach(_app ${__CP2K_APPS})
|
||||
set_target_properties(
|
||||
${_app}
|
||||
PROPERTIES CXX_STANDARD 14
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
LINKER_LANGUAGE "CXX"
|
||||
OUTPUT_NAME "${_app}.${__cp2k_ext}")
|
||||
|
||||
target_compile_features(${_app} PUBLIC c_std_99)
|
||||
if(CP2K_USE_ACCEL MATCHES HIP)
|
||||
set_property(TARGET ${_app} PROPERTY HIP_ARCHITECTURES
|
||||
${CMAKE_HIP_ARCHITECTURES})
|
||||
|
|
@ -1801,7 +1796,7 @@ install(FILES start/libcp2k.h
|
|||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
|
||||
|
||||
install(
|
||||
DIRECTORY "${PROJECT_BINARY_DIR}/src/"
|
||||
DIRECTORY "${PROJECT_BINARY_DIR}/src/mod_files"
|
||||
DESTINATION
|
||||
"${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}"
|
||||
FILES_MATCHING
|
||||
|
|
|
|||
|
|
@ -5,10 +5,27 @@ source /opt/cp2k-toolchain/install/setup
|
|||
|
||||
ln -s /opt/cp2k/tools/build_utils/fypp /bin/fypp
|
||||
|
||||
DBCSR_ver="2.6.0"
|
||||
|
||||
if [ -f dbcsr-${DBCSR_ver}.tar.gz ]; then
|
||||
echo "dbcsr-${DBCSR_ver}.tar.gz is found"
|
||||
else
|
||||
wget -q "https://github.com/cp2k/dbcsr/archive/refs/tags/v${DBCSR_ver}.tar.gz" -O "dbcsr-${DBCSR_ver}.tar.gz"
|
||||
fi
|
||||
|
||||
[ -d dbcsr-${DBCSR_ver} ] && rm -rf dbcsr-${DBCSR_ver}
|
||||
tar xzf dbcsr-${DBCSR_ver}.tar.gz > dbcsr-build.log 2>&1
|
||||
cd dbcsr-${DBCSR_ver}
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/opt/cp2k -DUSE_MPI=ON -DUSE_OPENMP=ON -DUSE_SMM=blas .. > dbcsr-build.log 2>&1
|
||||
make > dbcsr-build.log 2>&1 && make install > dbcsr-build.log 2>&1
|
||||
cd ../..
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
if ! cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/cp2k \
|
||||
-Werror=dev \
|
||||
-DCP2K_USE_VORI=ON \
|
||||
-DCP2K_USE_COSMA=NO \
|
||||
|
|
@ -17,7 +34,8 @@ if ! cmake \
|
|||
-DCP2K_USE_LIBINT2=ON \
|
||||
-DCP2K_USE_LIBXC=ON \
|
||||
-DCP2K_USE_LIBTORCH=OFF \
|
||||
-DCP2K_BUILD_DBCSR=ON \
|
||||
-DCP2K_USE_MPI=ON \
|
||||
-DCP2K_USE_MPI_F08=ON \
|
||||
-DCP2K_ENABLE_REGTESTS=ON \
|
||||
.. |& tee ./cmake.log; then
|
||||
echo -e "\nSummary: CMake failed."
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ else
|
|||
FC_arch+=" IF_MPI(-fc=${I_MPI_FC}|)"
|
||||
LD_arch+=" IF_MPI(-fc=${I_MPI_FC}|)"
|
||||
CFLAGS="${G_CFLAGS} -std=c11 -Wall \$(DFLAGS)"
|
||||
CXXFLAGS="${G_CFLAGS} -std=c11 -Wall \$(DFLAGS)"
|
||||
CXXFLAGS="${G_CFLAGS} -std=c++14 -Wall \$(DFLAGS)"
|
||||
FCFLAGS="${FCFLAGS} -diag-disable=8291 -diag-disable=8293 -fpp -fpscomp logicals -free"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue