Bug#882505: llvm-toolchain-4.0: add /usr/lib/cuda to the CUDA toolkit search paths

Andreas Beckmann anbe at debian.org
Thu Nov 23 14:55:43 UTC 2017


Source: llvm-toolchain-4.0
Version: 1:4.0.1-8
Severity: wishlist
Tags: patch

Hi,

I just updated nvidia-cuda-toolkit in non-free to provide a shim
monolithic cuda tree that is sufficient for
  clang++ --cuda-path=/usr/lib/cuda
addressing LP: #1706326
https://bugs.launchpad.net/ubuntu/+source/nvidia-cuda-toolkit/+bug/1706326
The corresponding upstream llvm bug is
https://bugs.llvm.org/show_bug.cgi?id=26966
"RFE: Scattered --cuda-path in Linux Distributions"
where is was suggested to provide such a shim tree.

It would be nice to add this new search path to clang s.t. cuda support
in packaged clang works out-of-the-box with nvidia-cuda-toolkit/non-free
installed.

Please also propagate this patch to 5.0, 6.0, ...

I'm not sure whether this should be upstreamed ...


Thanks

Andreas

PS: I haven't tried to build and test clang with this patch, but it
looks pretty straight forward :-)
-------------- next part --------------
Author: Andreas Beckmann <anbe at debian.org>
Description: add /usr/lib/cuda to CUDA search paths
 nvidia-cuda-toolkit/non-free now provides a shim monolitic cuda install
 tree in /usr/lib/cuda (LP: #1706326) that could be used for
   clang++ --cuda-path=/usr/lib/cuda

 let clang try that path by default, too, s.t. an explicit --cuda-path is
 not needed for the nvidia-cuda-toolkit/non-free packages
 
 try the new path *after* the default paths /usr/local/cuda{,-X.Y}
 to not interfere with cuda installations from nvidia's installer

--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1825,6 +1825,7 @@ CudaInstallationDetector::CudaInstallati
     CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda");
     for (const char *Ver : Versions)
       CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-" + Ver);
+    CudaPathCandidates.push_back(D.SysRoot + "/usr/lib/cuda");
   }
 
   for (const auto &CudaPath : CudaPathCandidates) {


More information about the Pkg-llvm-team mailing list