Skip to content

Commit

Permalink
Fix CUDA arch selection for older CMake versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojnnes committed Aug 5, 2020
1 parent d60a4ae commit 179aaa3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmake/SelectCudaComputeArch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endif()
# This list is used to filter CUDA archs when autodetecting
set(CUDA_ALL_GPU_ARCHITECTURES "3.0" "3.2" "3.5" "5.0")

if(CUDA_VERSION VERSION_GREATER_EQUAL "7.0")
if(CUDA_VERSION VERSION_EQUAL "7.0" OR CUDA_VERSION VERSION_GREATER "7.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2")

Expand All @@ -85,7 +85,7 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "7.0")
endif()
endif()

if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
if(CUDA_VERSION VERSION_EQUAL "8.0" OR CUDA_VERSION VERSION_GREATER "8.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Pascal")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.0" "6.1")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "6.0" "6.1" "6.2")
Expand All @@ -96,7 +96,7 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
endif()
endif ()

if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
if(CUDA_VERSION VERSION_EQUAL "9.0" OR CUDA_VERSION VERSION_GREATER "9.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Volta")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.0")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.0" "7.2")
Expand All @@ -107,7 +107,7 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
endif()
endif()

if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
if(CUDA_VERSION VERSION_EQUAL "10.0" OR CUDA_VERSION VERSION_GREATER "10.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Turing")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.5")
Expand All @@ -118,7 +118,7 @@ if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
endif()
endif()

if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
if(CUDA_VERSION VERSION_EQUAL "11.0" OR CUDA_VERSION VERSION_GREATER "11.0")
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Ampere")
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "8.0" "8.0+PTX")
list(APPEND CUDA_ALL_GPU_ARCHITECTURES "8.0")
Expand Down Expand Up @@ -186,7 +186,7 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
set(CUDA_GPU_DETECT_OUTPUT_FILTERED "")
separate_arguments(CUDA_GPU_DETECT_OUTPUT)
foreach(ITEM IN ITEMS ${CUDA_GPU_DETECT_OUTPUT})
if(CUDA_LIMIT_GPU_ARCHITECTURE AND ITEM VERSION_GREATER_EQUAL CUDA_LIMIT_GPU_ARCHITECTURE)
if(CUDA_LIMIT_GPU_ARCHITECTURE AND (ITEM VERSION_EQUAL CUDA_LIMIT_GPU_ARCHITECTURE OR ITEM VERSION_GREATER CUDA_LIMIT_GPU_ARCHITECTURE))
list(GET CUDA_COMMON_GPU_ARCHITECTURES -1 NEWITEM)
string(APPEND CUDA_GPU_DETECT_OUTPUT_FILTERED " ${NEWITEM}")
else()
Expand Down

0 comments on commit 179aaa3

Please sign in to comment.