From 2fe39f8c7abb9344abe1296e6706546b78c7cb16 Mon Sep 17 00:00:00 2001 From: liaogang Date: Mon, 5 Sep 2016 11:13:10 +0800 Subject: [PATCH] modify flags.cmake to support modern gpu arch Change-Id: Ie237127bb0f537998827ab29ffde2526c21c6dd1 --- cmake/flags.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index e05cd52f473..5c386d442e6 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -76,7 +76,7 @@ endforeach() function(specify_cuda_arch cuda_version cuda_arch) if(${cuda_version} VERSION_GREATER "8.0") - foreach(capability 60 61 62) + foreach(capability 61 62) if(${cuda_arch} STREQUAL ${capability}) list(APPEND __arch_flags " -gencode arch=compute_${cuda_arch},code=sm_${cuda_arch}") endif() @@ -90,12 +90,17 @@ function(specify_cuda_arch cuda_version cuda_arch) endif() endfunction() -# Common cuda architectures +# Common gpu architectures: Kepler, Maxwell foreach(capability 30 35 50) list(APPEND __arch_flags " -gencode arch=compute_${capability},code=sm_${capability}") endforeach() -# Custom cuda architecture +# Modern gpu architectures: Pascal +if (CUDA_VERSION VERSION_GREATER "8.0") + list(APPEND __arch_flags " -gencode arch=compute_60,code=sm_60") +endif() + +# Custom gpu architecture set(CUDA_ARCH) if(CUDA_ARCH) -- GitLab