MantisBT - CMake
View Issue Details
0013084CMakeCMakepublic2012-03-31 07:252013-11-12 08:53
Vladislav 
James Bigler 
normalmajoralways
closedfixed 
Linux
CMake 2.8.7 
CMake 2.8.11 
0013084: FindCUDA is adding libcuda.so, but this is part of driver and not CUDA Runtime.
FindCUDA shan't add libcuda.so library by default as it adds dependence on the NVIDIA driver. It leads to impossibility of creation of one executable file which can be launched regardless of NVIDIA GPU existence.

For example, it is watched in heterogeneous computing clusters when only a part of nodes GPU are equipped.

See thread on NVIDIA forum: http://forums.nvidia.com/index.php?showtopic=190729 [^]

To fix this issue need remove next code from FindCUDA.cmake:

> # Add cuda library to the link line only if it is found.
> if (CUDA_CUDA_LIBRARY)
> set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
> endif(CUDA_CUDA_LIBRARY)
No tags attached.
related to 0014559closed James Bigler 0013084 fix has no backwards compatibility 
Issue History
2012-03-31 07:25VladislavNew Issue
2012-04-02 17:55James BiglerNote Added: 0029061
2012-04-03 13:41James BiglerAssigned To => James Bigler
2012-04-03 13:41James BiglerStatusnew => assigned
2012-04-04 01:04VladislavNote Added: 0029071
2013-03-14 01:54James BiglerNote Added: 0032625
2013-03-14 01:54James BiglerStatusassigned => resolved
2013-03-14 01:54James BiglerFixed in Version => CMake 2.8.11
2013-03-14 01:54James BiglerResolutionopen => fixed
2013-10-07 10:04Robert MaynardNote Added: 0034004
2013-10-07 10:04Robert MaynardStatusresolved => closed
2013-11-12 08:53Brad KingRelationship addedrelated to 0014559

Notes
(0029061)
James Bigler   
2012-04-02 17:55   
Yeah, when I wrote FindCUDA I don't think I realized that cudart didn't actually depend on the driver library (and perhaps it didn't at first - this module code has existed since before the first CUDA capable hard ware existed).

Now, I have to try and figure out how to fix this that won't break existing applications. The documentation says that CUDA_LIBRARIES are for the run time libraries, but what if users were using both the CUDA driver library and the CUDA run time libraries and relied on the exiting behavior. Would the existing behavior be considered a bug or a "feature" I would need to make sure kept working?

I'm not suggesting this should never be fixed, because it's bugged me for a while once I realized that the cuda run time stopped linking against the driver library.

You can work around this by setting CUDA_LIBRARIES to ${CUDA_CUDART_LIBRARY}.

set(CUDA_LIBRARIES "${CUDA_CUDART_LIBRARIES}")
cuda_add_library()
(0029071)
Vladislav   
2012-04-04 01:04   
It is possible to add a variable which will define to use old and new behavior. By default to use old behavior.
(0032625)
James Bigler   
2013-03-14 01:54   
This should be fixed in 2.8.11. See checkin 3497bc2.
(0034004)
Robert Maynard   
2013-10-07 10:04   
Closing resolved issues that have not been updated in more than 4 months.