Skip to content

Commit

Permalink
Merge pull request #531 from carterbox/cuda-archs
Browse files Browse the repository at this point in the history
BLD: Target all CUDA architectures >= 3.0 by default
  • Loading branch information
carterbox committed Mar 22, 2021
2 parents e216588 + 9d50025 commit 04c2b33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0053 NEW)
cmake_policy(SET CMP0104 OLD) # ignore CMAKE_CUDA_ARCHITECTURES

project(tomopy LANGUAGES C CXX)

Expand Down
12 changes: 10 additions & 2 deletions cmake/Modules/Packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ if(TOMOPY_USE_CUDA)
# 70, 72 + Volta support
# 75 + Turing support
if(NOT DEFINED CUDA_ARCH)
set(CUDA_ARCH "35")
if(CUDA_VERSION_MAJOR VERSION_LESS 11)
set(CUDA_ARCH "30;32;35;37;50;52;53;60;61;62;70;72;75")
else()
set(CUDA_ARCH "35;37;50;52;53;60;61;62;70;72;75;80;86")
endif()
endif()

if(TOMOPY_USE_NVTX)
Expand All @@ -231,8 +235,12 @@ if(TOMOPY_USE_CUDA)
endif()
endif()

foreach(ARCH IN ITEMS ${CUDA_ARCH})
list(APPEND ${PROJECT_NAME}_CUDA_FLAGS
-gencode=arch=compute_${ARCH},code=sm_${ARCH})
endforeach(ARCH)

list(APPEND ${PROJECT_NAME}_CUDA_FLAGS
-arch=sm_${CUDA_ARCH}
--default-stream per-thread)

if(NOT WIN32)
Expand Down

0 comments on commit 04c2b33

Please sign in to comment.