From 468a8e5a8744cd5bc21b13a010e99b57c2dc4e92 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 16 Feb 2021 16:32:17 -0500 Subject: [PATCH] Build only compute_ for the newest arch in CMAKE_CUDA_ARCHITECTURES --- cmake/Modules/SetGPUArchs.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/Modules/SetGPUArchs.cmake b/cmake/Modules/SetGPUArchs.cmake index fd961e411..193b3842f 100644 --- a/cmake/Modules/SetGPUArchs.cmake +++ b/cmake/Modules/SetGPUArchs.cmake @@ -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)