mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
[cmake] Add cmake module for finding the cusolver library
This commit is contained in:
parent
26828f2f1c
commit
6aa93c4aec
4 changed files with 77 additions and 2 deletions
|
|
@ -527,6 +527,10 @@ if(CP2K_USE_ACCEL MATCHES "CUDA")
|
|||
endif()
|
||||
|
||||
set(CP2K_USE_CUDA ON)
|
||||
|
||||
if(CP2K_USE_CUSOLVER_MP)
|
||||
find_package(CuSolverMP REQUIRED)
|
||||
endif()
|
||||
message(STATUS ``"-- CUDA compiler and libraries found")
|
||||
elseif(CP2K_USE_ACCEL MATCHES "HIP")
|
||||
enable_language(HIP)
|
||||
|
|
|
|||
33
cmake/FindCal.cmake
Normal file
33
cmake/FindCal.cmake
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! 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(LIBCAL "Cal")
|
||||
|
||||
cp2k_find_libraries(LIBCAL "cal")
|
||||
cp2k_include_dirs(LIBCAL "cal.h")
|
||||
|
||||
find_package_handle_standard_args(Cal DEFAULT_MSG CP2K_CAL_LINK_LIBRARIES
|
||||
CP2K_CAL_INCLUDE_DIRS)
|
||||
|
||||
if(CP2K_LIBCAL_FOUND AND not TARGET CP2K::CAL::cal)
|
||||
add_library(CP2K::CAL INTERFACE IMPORTED)
|
||||
set_target_properties(CP2K::CAL::cal PROPERTIES INTERFACE_LINK_LIBRARIES
|
||||
"${CP2K_CAL_LINK_LIBRARIES}")
|
||||
set_target_properties(CP2K::CAL::cal PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${CP2K_CAL_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_CAL_LINK_LIBRARIES)
|
||||
mark_as_advanced(CP2K_CAL_INCLUDE_DIRS)
|
||||
mark_as_advanced(CP2K_CAL_FOUND)
|
||||
37
cmake/FindCuSolverMP.cmake
Normal file
37
cmake/FindCuSolverMP.cmake
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!-------------------------------------------------------------------------------------------------!
|
||||
#! 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)
|
||||
|
||||
find_package(Cal Required)
|
||||
cp2k_set_default_paths(CUSOLVER_MP "CUSOLVER_MP")
|
||||
cp2k_find_libraries(CUSOLVER_MP "cusolverMp")
|
||||
cp2k_include_dirs(CUSOLVER_MP "cusolverMp.h")
|
||||
|
||||
find_package_handle_standard_args(
|
||||
CuSolverMP DEFAULT_MSG CP2K_CUSOLVER_MP_LINK_LIBRARIES
|
||||
CP2K_CUSOLVER_MP_INCLUDE_DIRS)
|
||||
|
||||
if(CP2K_CUSOLVER_MP_FOUND AND NOT TARGET CP2K::CUSOLVER_MP::cusolver_mp)
|
||||
add_library(CP2K::CUSOLVER_MP::cusolver_mp INTERFACE IMPORTED)
|
||||
set_target_properties(
|
||||
CP2K::CUSOLVER_MP::cusolver_mp
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES
|
||||
"${CP2K_CUSOLVER_MP_LINK_LIBRARIES};CP2K::CAL::cal")
|
||||
set_target_properties(
|
||||
CP2K::CUSOLVER_MP::cusolver_mp
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CP2K_CUSOLVER_MP_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CP2K_CUSOLVER_MP_LINK_LIBRARIES)
|
||||
mark_as_advanced(CP2K_CUSOLVER_MP_INCLUDE_DIRS)
|
||||
mark_as_advanced(CP2K_CUSOLVER_MP_FOUND)
|
||||
|
|
@ -1433,8 +1433,9 @@ if(CP2K_USE_CUDA)
|
|||
else()
|
||||
target_link_libraries(
|
||||
cp2k_cuda_libs
|
||||
INTERFACE $<$<BOOL:${CP2K_USE_CUSOLVER_MP}>:CUDA::cusolver> CUDA::cufft
|
||||
CUDA::cufftw CUDA::cublas CUDA::cudart CUDA::cuda_driver)
|
||||
INTERFACE $<$<BOOL:${CP2K_USE_CUSOLVER_MP}>:CP2K::CUSOLVER_MP::cusolvermp>
|
||||
CUDA::cufft CUDA::cufftw CUDA::cublas CUDA::cudart
|
||||
CUDA::cuda_driver)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue