-
Notifications
You must be signed in to change notification settings - Fork 1
/
cuda.cmake
50 lines (40 loc) · 1.68 KB
/
cuda.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 14)
add_library(device SHARED device.cpp
interfaces/cuda/Control.cu
interfaces/cuda/Aux.cu
interfaces/cuda/Memory.cu
interfaces/cuda/Events.cu
interfaces/cuda/Copy.cu
interfaces/cuda/Streams.cu
interfaces/cuda/Graphs.cu
interfaces/cuda/Internals.cu
algorithms/cuda/ArrayManip.cu
algorithms/cuda/BatchManip.cu
algorithms/cuda/Debugging.cu
algorithms/cuda/Reduction.cpp)
set_target_properties(device PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_source_files_properties(device.cpp
algorithms/cuda/Reduction.cpp
PROPERTIES LANGUAGE CUDA)
string(REPLACE "sm_" "" CUDA_DEVICE_ARCH "${DEVICE_ARCH}")
set_target_properties(device PROPERTIES CUDA_ARCHITECTURES "${CUDA_DEVICE_ARCH}")
target_compile_features(device PRIVATE cxx_std_14)
target_compile_definitions(device PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
-DDEVICE_${BACKEND_UPPER_CASE}_LANG;
-DREAL_SIZE=${REAL_SIZE_IN_BYTES}
>)
if (USE_GRAPH_CAPTURING)
target_compile_definitions(device PRIVATE DEVICE_USE_GRAPH_CAPTURING)
endif()
target_compile_options(device PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
-Xptxas -v;
--expt-relaxed-constexpr;
>)
if (EXTRA_DEVICE_FLAGS)
target_compile_options(device PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
${EXTRA_DEVICE_FLAGS}
>)
endif()
find_package(CUDAToolkit REQUIRED)
target_link_libraries(device PUBLIC CUDA::cudart CUDA::cuda_driver CUDA::nvToolsExt)