|
1 | 1 | # |
| 2 | +# This file contains two functions: |
| 3 | +# chooseCudaCC |
| 4 | +# getFlagsForCudaCCList |
| 5 | +# |
| 6 | +# Motivation: |
2 | 7 | # CUDA hardware and SDKs are developing over time, different SDK support different |
3 | 8 | # hardware, and supported hardware differs depending on platform even for the same |
4 | | -# SDK version. |
5 | | -# This file attempts to provide a function that returns a valid selection of hardware |
6 | | -# for the current SDK and platform. |
| 9 | +# SDK version. This file attempts to provide a function that returns a valid selection |
| 10 | +# of hardware for the current SDK and platform. It will require updates as CUDA develops, |
| 11 | +# and it is currently not complete in terms of existing platforms that support CUDA. |
| 12 | +# |
| 13 | + |
| 14 | +# |
| 15 | +# Return the minimal set of supported Cuda CC |
7 | 16 | # |
8 | | -# It will require updates as CUDA develops, and it is currently not complete in terms |
9 | | -# of existing platforms that support CUDA. |
| 17 | +# Usage: |
| 18 | +# chooseCudaCC(SUPPORTED_CC SUPPORTED_GENCODE_FLAGS |
| 19 | +# [MIN_CUDA_VERSION X.Y] |
| 20 | +# [MIN_CC XX ]) |
| 21 | +# |
| 22 | +# SUPPORTED_CC out variable. Stores the list of supported CC. |
| 23 | +# SUPPORTED_GENCODE_FLAGS out variable. List of gencode flags to append to, e.g., CUDA_NVCC_FLAGS |
| 24 | +# MIN_CUDA_VERSION the minimal supported version of cuda (e.g. 7.5, default 7.0). |
| 25 | +# MIN_CC minimal supported Cuda CC by the project (e.g. 35, default 20) |
10 | 26 | # |
11 | 27 | # This function does not edit cache entries or variables in the parent scope |
12 | 28 | # except for the variables whose names are supplied for SUPPORTED_CC and |
|
19 | 35 | # end |
20 | 36 | # set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};${MY_GENCODE_FLAGS}") |
21 | 37 | # |
22 | | -# We assume that ${SUPPORTED_CC} can be overwritten. |
23 | | -# We assume that ${SUPPORTED_GENCODE_FLAGS} can be overwritten. |
24 | | -# We assume that MIN_CC default to 20 |
25 | | -# We assume that MIN_CUDA_VERSION defaults to 7.0 |
26 | | -# |
27 | 38 | function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS) |
28 | 39 | set(options "") |
29 | 40 | set(oneValueArgs MIN_CUDA_VERSION MIN_CC) |
@@ -88,7 +99,7 @@ function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS) |
88 | 99 | set(CC_LIST "") |
89 | 100 | foreach(CC ${CC_LIST_BY_SYSTEM_PROCESSOR}) |
90 | 101 | if( (${CC} GREATER_EQUAL ${CUDA_MIN_CC}) AND |
91 | | - (${CC} LESS_EQUAL ${CUDA_MAX_CC}) ) |
| 102 | + (${CC} LESS_EQUAL ${CUDA_MAX_CC}) ) |
92 | 103 | list(APPEND CC_LIST ${CC}) |
93 | 104 | endif() |
94 | 105 | endforeach() |
@@ -119,12 +130,13 @@ function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS) |
119 | 130 | endfunction() |
120 | 131 |
|
121 | 132 | # |
122 | | -# This function is used to create a list of gencode instructions for a given list |
123 | | -# of CCs. |
124 | | -# It takes as arguments is list of CCs and a list variable that can be filled with |
125 | | -# gencode strings. |
| 133 | +# Return the gencode parameters for a given list of CCs. |
| 134 | +# |
| 135 | +# Usage: |
| 136 | +# getFlagsForCudaCCList(INPUT_CC_LIST SUPPORTED_GENCODE_FLAGS) |
126 | 137 | # |
127 | | -# We assume that ${SUPPORTED_GENCODE_FLAGS} can be overwritten. |
| 138 | +# INPUT_CC_LIST in variable. Contains a list of supported CCs. |
| 139 | +# SUPPORTED_GENCODE_FLAGS out variable. List of gencode flags to append to, e.g., CUDA_NVCC_FLAGS |
128 | 140 | # |
129 | 141 | function(getFlagsForCudaCCList INPUT_CC_LIST SUPPORTED_GENCODE_FLAGS) |
130 | 142 | set(CC_LIST "${${INPUT_CC_LIST}}") |
|
0 commit comments