Skip to content

Commit bdb7321

Browse files
committed
CMake: replace FindCUDA with FindCUDAToolkit and use CMAKE_CUDA_ARCHITECTURES
1 parent ee6963b commit bdb7321

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
######### CMake Version ############################################
2-
cmake_minimum_required( VERSION 3.15 )
2+
cmake_minimum_required( VERSION 3.18 )
33
### Distinguish between Clang and AppleClang
44
cmake_policy( SET CMP0025 NEW )
55
### Allow finding python virtual-environments

core/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MESSAGE( STATUS ">> --------------------- Spirit -------------------------------
33

44

55
######### CMake Version ############################################
6-
cmake_minimum_required( VERSION 3.15 FATAL_ERROR )
6+
cmake_minimum_required( VERSION 3.18 FATAL_ERROR )
77
####################################################################
88

99

@@ -68,6 +68,7 @@ if( SPIRIT_USE_CUDA )
6868
set( SPIRIT_USE_FFTW OFF )
6969
### Enable CUDA language support
7070
enable_language( CUDA )
71+
set( CMAKE_CUDA_ARCHITECTURES "${SPIRIT_CUDA_ARCH}" )
7172
endif()
7273
#-----
7374
if( SPIRIT_USE_STDPAR )
@@ -146,17 +147,17 @@ include(CompilerFlags)
146147
######### CUDA decisions ###########################################
147148
if( SPIRIT_USE_CUDA )
148149
# set( CUDA_TOOLKIT_ROOT_DIR /opt/cuda )
149-
find_package( CUDA 8 REQUIRED )
150+
find_package( CUDAToolkit 12 REQUIRED )
150151

151152
# set( CUDA_PROPAGATE_HOST_FLAGS ON )
152153
# --std=c++17 flag may be necessary, but it is propagated from global flags...
153154
# if it appears twice, for some reason the compilation breaks
154155

155-
set( SPIRIT_CUDA_LIBS "${CUDA_LIBRARIES};${CUDA_CUFFT_LIBRARIES};${CUDA_curand_LIBRARY}" )
156-
set( FFT_LIB ${CUDA_CUFFT_LIBRARIES} )
156+
set( SPIRIT_CUDA_LIBS "CUDA::cudart;CUDA::cufft;CUDA::curand" )
157+
set( FFT_LIB CUDA::cufft )
157158

158159
if( "${CMAKE_CUDA_COMPILER_ID}" MATCHES "NVIDIA" )
159-
set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -arch=sm_${SPIRIT_CUDA_ARCH} --expt-relaxed-constexpr --expt-extended-lambda" )
160+
set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo --expt-relaxed-constexpr --expt-extended-lambda" )
160161
### Deactivate CUDA warning inside Eigen such as "warning: __host__ annotation is ignored on a function("Quaternion") that is explicitly defaulted on its first declaration"
161162
set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --diag-suppress=20011 --diag-suppress=20012 --diag-suppress=20014 --diag-suppress=1675")
162163
### Display warning number when writing a warning

0 commit comments

Comments
 (0)