|
1 | 1 | IF(NOT CUDAToolkit_FOUND AND NOT CUDA_FOUND) |
2 | | - IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18) |
3 | | - set(CMAKE_CXX_STANDARD ${MR_CXX_STANDARD}) |
4 | | - set(CMAKE_CXX_STANDARD_REQUIRED ON) |
5 | | - |
6 | 2 | IF(WIN32) |
7 | 3 | # For some reason setting C++20 on Windows appears to be ignored, so that even |
8 | 4 | # the single-argument version of `static_assert` doesn't compile (which is a C++17 feature). |
@@ -42,44 +38,4 @@ IF(NOT CUDAToolkit_FOUND AND NOT CUDA_FOUND) |
42 | 38 | ENDIF() |
43 | 39 |
|
44 | 40 | set(CUDART_LIBRARY CUDA::cudart_static) |
45 | | - ELSE() |
46 | | - # nvcc supports only c++20 and Cmake 3.16 from Ubuntu 20 does not support set(CMAKE_CUDA_STANDARD 20) |
47 | | - set(CMAKE_CXX_STANDARD 20) |
48 | | - set(CMAKE_CXX_STANDARD_REQUIRED ON) |
49 | | - |
50 | | - # more info: https://gitlab.kitware.com/cmake/cmake/-/issues/23079 |
51 | | - IF(NOT DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION) |
52 | | - set(CMAKE_CUDA20_STANDARD_COMPILE_OPTION "-std=c++20") |
53 | | - set(CMAKE_CUDA20_EXTENSION_COMPILE_OPTION "-std=c++20") |
54 | | - ENDIF() |
55 | | - |
56 | | - set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda/") |
57 | | - set(CMAKE_CUDA_PATH /usr/local/cuda/) |
58 | | - set(CUDA_NVCC_EXECUTABLE ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc) |
59 | | - set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc) |
60 | | - |
61 | | - # without it we get "nvcc warning : The -std=c++20 flag is not supported with the configured host compiler. Flag will be ignored." |
62 | | - # https://stackoverflow.com/q/77170793/7325599 |
63 | | - set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER}) |
64 | | - message("CMAKE_CXX_COMPILER=CMAKE_CUDA_HOST_COMPILER=${CMAKE_CUDA_HOST_COMPILER}") |
65 | | - |
66 | | - # If the following line gives you this error: Could NOT find CUDA (missing: CUDA_NVCC_EXECUTABLE) (found suitable version "12.1", minimum required is "12") |
67 | | - # That's because you ran this file twice. Make sure it runs at most once. |
68 | | - find_package(CUDA 12 REQUIRED) |
69 | | - |
70 | | - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} \ |
71 | | - --std c++20 \ |
72 | | - -use_fast_math \ |
73 | | - -arch=sm_52 \ |
74 | | - -gencode=arch=compute_52,code=sm_52 \ |
75 | | - -gencode=arch=compute_60,code=sm_60 \ |
76 | | - -gencode=arch=compute_61,code=sm_61 \ |
77 | | - -gencode=arch=compute_70,code=sm_70 \ |
78 | | - -gencode=arch=compute_75,code=sm_75 \ |
79 | | - -gencode=arch=compute_75,code=compute_75" |
80 | | - ) |
81 | | - set(CUDA_VERBOSE_BUILD ON) |
82 | | - |
83 | | - set(CUDART_LIBRARY ${CUDA_LIBRARIES}) |
84 | | - ENDIF() |
85 | 41 | ENDIF() |
0 commit comments