Skip to content

Commit af77e93

Browse files
author
Carsten Griwodz
committed
[cmake] fix usage for ChooseCudaCC
1 parent dd3949b commit af77e93

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ include(ChooseCudaCC)
9292
if(NOT DEFINED PopSift_CUDA_CC_LIST)
9393
chooseCudaCC(PopSift_CUDA_CC_LIST_BASIC
9494
PopSift_CUDA_GENCODE_FLAGS
95-
MIN_CC 30
96-
MIN_CUDA_VERSION 7.0)
95+
MIN_CC 30
96+
MIN_CUDA_VERSION 7.0)
9797
set(PopSift_CUDA_CC_LIST ${PopSift_CUDA_CC_LIST_BASIC} CACHE STRING "CUDA CC versions to compile")
9898
else()
9999
getFlagsForCudaCCList(PopSift_CUDA_CC_LIST

cmake/ChooseCudaCC.cmake

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
#
2+
# This file contains two functions:
3+
# chooseCudaCC
4+
# getFlagsForCudaCCList
5+
#
6+
# Motivation:
27
# CUDA hardware and SDKs are developing over time, different SDK support different
38
# 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
716
#
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)
1026
#
1127
# This function does not edit cache entries or variables in the parent scope
1228
# except for the variables whose names are supplied for SUPPORTED_CC and
@@ -19,11 +35,6 @@
1935
# end
2036
# set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};${MY_GENCODE_FLAGS}")
2137
#
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-
#
2738
function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS)
2839
set(options "")
2940
set(oneValueArgs MIN_CUDA_VERSION MIN_CC)
@@ -88,7 +99,7 @@ function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS)
8899
set(CC_LIST "")
89100
foreach(CC ${CC_LIST_BY_SYSTEM_PROCESSOR})
90101
if( (${CC} GREATER_EQUAL ${CUDA_MIN_CC}) AND
91-
(${CC} LESS_EQUAL ${CUDA_MAX_CC}) )
102+
(${CC} LESS_EQUAL ${CUDA_MAX_CC}) )
92103
list(APPEND CC_LIST ${CC})
93104
endif()
94105
endforeach()
@@ -119,12 +130,13 @@ function(chooseCudaCC SUPPORTED_CC SUPPORTED_GENCODE_FLAGS)
119130
endfunction()
120131

121132
#
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)
126137
#
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
128140
#
129141
function(getFlagsForCudaCCList INPUT_CC_LIST SUPPORTED_GENCODE_FLAGS)
130142
set(CC_LIST "${${INPUT_CC_LIST}}")

0 commit comments

Comments
 (0)