summaryrefslogtreecommitdiffstats
path: root/Modules/CUDA/architectures.cmake
blob: 7d6a6e04898602a713d7c0cd620e8ed9ab046f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# See supported GPUs on Wikipedia
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported

# Initial set based on CUDA 7.0.
set(CMAKE_CUDA_ARCHITECTURES_ALL 20 21 30 35 37 50 52 53)
set(CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20 30 35 50)

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 8.0)
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 60 61 62)
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 60)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 9.0)
  if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
    list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 70 72)
    list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 70)
  endif()

  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 20 21)
  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 10.0
   AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0))
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 75)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.0)
  if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
    list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 80)
    list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 80)
  endif()

  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 30)
  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 30)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.1
   AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0))
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 86)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.4
   AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 87)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.8
   AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 89 90)
  list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 90)
endif()

if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 12.0
   AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 35 37)
  list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 35)
endif()

# only generate jit code for the newest arch for all/all-major
list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch)
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real")
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL ${_latest_arch})

list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR _latest_arch)
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR APPEND "-real")
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR ${_latest_arch})

unset(_latest_arch)