Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More words on the CUDA part:
There are two ways of enabling CUDA in cmake:
And, old cmake can't work with newer CUDA version very well. It's reasonable. It's like you can't expect a compiler release in 2014 has well support for c++17. CUDA is changing, therefore we should get our cmake up to date. And we will not try to support older cmake versions. Installing cmake is relatively easy. Based on that, for the two options in front of me, I would choose the newer one.
However, the second one introduced a few problems. The biggest is, if you have code like:
You must change it to:
And because of that, the most existing cmake modules are broken. If the code was written before cmake 3.8 was release, it's unlikely it can continue to work. Notably, FindThreads, googletest.
Let me talk them one by one.
On Linux, there are two compiler flags for enabling multiple threading. You can choose either of them.
If I make the story shorter, the first one is deprecated, at least in the last 20 years, glibc doesn't need it. The second one is totaly enough. CMake FindThreads module has an option for choosing among them, but, its behavior is very strange and it doesn't always work.
If the cmake variable "CMAKE_THREAD_LIBS_INIT" is evaluated to '-pthread', it will break the CUDA build. Because nvcc can't understand this arg. However, googletest explicitly says he prefer '-pthread' to '-lpthread'. Nobody was wrong, expect cmake itself. The FindThreads module is updated in cmake 3.13 and this problem is fixed.