mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-04 14:50:23 +00:00
ci: Fix CUDA tests on GPUs newer than the toolkit supports
Extend commit ff8c0e9c10 (ci: Clamp CUDA 'native' architecture to values
supported by its toolkit, 2022-03-14, v3.24.0-rc1~468^2) to avoid
failures due to `nvcc -arch=native`.
This commit is contained in:
@@ -61,7 +61,14 @@ try_compile(native_archs_compiles
|
|||||||
COMPILE_DEFINITIONS ${try_compile_flags}
|
COMPILE_DEFINITIONS ${try_compile_flags}
|
||||||
OUTPUT_VARIABLE output
|
OUTPUT_VARIABLE output
|
||||||
)
|
)
|
||||||
verify_output(native)
|
if(native_archs_compiles)
|
||||||
|
verify_output(native)
|
||||||
|
elseif("$ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}"
|
||||||
|
AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA"
|
||||||
|
AND output MATCHES "Unsupported gpu architecture")
|
||||||
|
# nvcc -arch=native is not affected by the clamp
|
||||||
|
set(native_archs_compiles 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(all_archs_compiles AND all_major_archs_compiles AND native_archs_compiles)
|
if(all_archs_compiles AND all_major_archs_compiles AND native_archs_compiles)
|
||||||
set(CMAKE_CUDA_ARCHITECTURES all)
|
set(CMAKE_CUDA_ARCHITECTURES all)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.7.0")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(TARGET CudaOptix PROPERTY CUDA_SEPARABLE_COMPILATION ON)
|
set_property(TARGET CudaOptix PROPERTY CUDA_SEPARABLE_COMPILATION ON)
|
||||||
set_property(TARGET CudaOptix PROPERTY CUDA_ARCHITECTURES native)
|
set_property(TARGET CudaOptix PROPERTY CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_NATIVE}")
|
||||||
|
|
||||||
add_executable(CudaOnlyOptixIR main.cu)
|
add_executable(CudaOnlyOptixIR main.cu)
|
||||||
target_compile_features(CudaOnlyOptixIR PRIVATE cuda_std_11)
|
target_compile_features(CudaOnlyOptixIR PRIVATE cuda_std_11)
|
||||||
|
|||||||
Reference in New Issue
Block a user