-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cmake] CMake script for choosing CCs #75
Conversation
@simogasp Could you take a look at this attempt? It is not hooked into CMakeLists.txt yet, just to discuss the idea and link it to the bug report. |
Would it be possible to upgrade to cmake 3.11 also in PopSift (and discard the commit "replace >=")? |
f3c85d8
to
ec84e9c
Compare
I changed the destination base to |
else() | ||
set(PopSift_CUDA_CC_LIST_BASIC 30 35 50 52 ) | ||
getFlagsForCudaCCList(PopSift_CUDA_CC_LIST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I guess we want to give the possibility to the user to provide a -DPopSift_CUDA_CC_LIST=30;70
at cmake stage, am I correct?
In that case:
-
we should document it in the README in the build section
-
more importantly, we should check that those provided are good/supported. One way to go it could be something like:
# we always need to know which are all the supported CC
chooseCudaCC(PopSift_CUDA_CC_LIST_BASIC
PopSift_CUDA_GENCODE_FLAGS
MIN_CC 30
MIN_CUDA_VERSION 7.0)
# if PopSift_CUDA_CC_LIST is provided
if(DEFINED PopSift_CUDA_CC_LIST)
# check each provided element is supported
# ideally this function checks the provided cc are in the list generating an error if not
check_if_supported(PopSift_CUDA_CC_LIST PopSift_CUDA_CC_LIST_BASIC)
getFlagsForCudaCCList(PopSift_CUDA_CC_LIST PopSift_CUDA_GENCODE_FLAGS)
else()
set(PopSift_CUDA_CC_LIST ${PopSift_CUDA_CC_LIST_BASIC} CACHE STRING "CUDA CC versions to compile")
endif()
list(APPEND CUDA_NVCC_FLAGS "${PopSift_CUDA_GENCODE_FLAGS}")
and
function(check_if_supported PROVIDED_CC SUPPORTED_CC)
foreach(cc IN LISTS PROVIDED_CC)
if(NOT ${cc} IN_LIST SUPPORTED_CC)
message(FATAL_ERROR "Compute capability ${cc} not supported. Supported CC are ${SUPPORTED_CC}")
endforeach()
endfunction()
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a really good thing? Without that check, a user can configure for a brand new CC that we haven't put into the ChooseCudaCC.cmake file yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you have a point!
We can then leave it like that and assume that it is an advanced feature and the user knows what is doing.
I was thinking, since we are going to use it in all the other projects, shall we rather create a repository with these sorts of help functions and import them as git submodules? @fabiencastan |
The idea is to have a CMake function that can be re-used and extended to get an up-to-date list of default CCs for compilation as CUDA develops further.