Skip to content

Commit

Permalink
Build only compute_ for the newest arch in CMAKE_CUDA_ARCHITECTURES
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Feb 17, 2021
1 parent aabe0d4 commit 468a8e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/Modules/SetGPUArchs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ if(CMAKE_CUDA_ARCHITECTURES STREQUAL "")
evaluate_gpu_archs(CMAKE_CUDA_ARCHITECTURES)
endif(CMAKE_CUDA_ARCHITECTURES STREQUAL "")

# CMake architecture list entry of "80" means to build compute and sm. What we want is for the
# newest arch only to build that way while the rest built only for sm.
list(SORT CMAKE_CUDA_ARCHITECTURES ORDER ASCENDING)
list(POP_BACK CMAKE_CUDA_ARCHITECTURES latest_arch)
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES APPEND "-real")
list(APPEND CMAKE_CUDA_ARCHITECTURES ${latest_arch})

set(CMAKE_CUDA_ARCHITECTURES
${CMAKE_CUDA_ARCHITECTURES}
PARENT_SCOPE)

0 comments on commit 468a8e5

Please sign in to comment.