|
@@ -249,7 +249,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
|
|
|
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION "${CMAKE_MATCH_1}")
|
|
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION "${CMAKE_MATCH_1}")
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
- # Make the all and all-major architecture information available.
|
|
|
|
|
|
|
+ # Make the all, all-major, and native architecture information available.
|
|
|
# FIXME(#23161): Defer architecture detection until compiler testing.
|
|
# FIXME(#23161): Defer architecture detection until compiler testing.
|
|
|
include(${CMAKE_ROOT}/Modules/CUDA/architectures.cmake)
|
|
include(${CMAKE_ROOT}/Modules/CUDA/architectures.cmake)
|
|
|
endif()
|
|
endif()
|
|
@@ -291,6 +291,17 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
|
|
|
set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR})
|
|
set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR})
|
|
|
endif()
|
|
endif()
|
|
|
endif()
|
|
endif()
|
|
|
|
|
+ elseif(CMAKE_CUDA_ARCHITECTURES STREQUAL "native")
|
|
|
|
|
+ # For sufficiently new NVCC we can just use the 'native' value directly.
|
|
|
|
|
+ # For VS we don't test since we can't find nvcc this early (see #23161).
|
|
|
|
|
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.6)
|
|
|
|
|
+ string(APPEND nvcc_test_flags " -arch=${CMAKE_CUDA_ARCHITECTURES}")
|
|
|
|
|
+ set(architectures_tested "${CMAKE_CUDA_ARCHITECTURES}")
|
|
|
|
|
+ elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
|
|
|
+ set(architectures_tested "${CMAKE_CUDA_ARCHITECTURES}")
|
|
|
|
|
+ else()
|
|
|
|
|
+ set(architectures_test ${_CUDA_ARCHITECTURES_NATIVE})
|
|
|
|
|
+ endif()
|
|
|
elseif(CMAKE_CUDA_ARCHITECTURES OR "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
|
|
elseif(CMAKE_CUDA_ARCHITECTURES OR "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
|
|
|
# Explicit architectures. Test them during detection.
|
|
# Explicit architectures. Test them during detection.
|
|
|
set(architectures_explicit TRUE)
|
|
set(architectures_explicit TRUE)
|
|
@@ -636,7 +647,7 @@ if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
|
|
|
message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
|
endif()
|
|
endif()
|
|
|
endif()
|
|
endif()
|
|
|
-elseif(CMAKE_CUDA_ARCHITECTURES AND NOT "${architectures_tested}" MATCHES "^(all|all-major)$")
|
|
|
|
|
|
|
+elseif(CMAKE_CUDA_ARCHITECTURES AND NOT "${architectures_tested}" MATCHES "^(all|all-major|native)$")
|
|
|
# Sort since order mustn't matter.
|
|
# Sort since order mustn't matter.
|
|
|
list(SORT architectures_detected)
|
|
list(SORT architectures_detected)
|
|
|
list(SORT architectures_tested)
|
|
list(SORT architectures_tested)
|