Bug#995122: Clang and /usr/lib/cuda

Raul Tambre raul at tambre.ee
Sun Sep 26 17:45:53 BST 2021


Package: nvidia-cuda-toolkit
Version: 11.3.1-4
Severity: important

Dear maintainer,

Clang recently changed its CUDA version discovery to use cuda.h since 
version.txt is no more. See the LLVM commit 
<https://github.com/llvm/llvm-project/commit/3db8e486e560183f064e31a228aada52fdeac5d6>.

It is read from <CUDA root>/include/cuda.h.
/usr/lib/cuda is used as a special case by Clang on Debian/Ubuntu and also by 
CMake 
<https://gitlab.kitware.com/cmake/cmake/-/blob/1edc9e88879d00e7015ce2ab2c6e663ae59a37fe/Modules/CMakeDetermineCUDACompiler.cmake#L224>.

On my installations /usr/lib/cuda/include is an empty directory. The CUDA 
version detection fails, Clang falls back to the latest version it knows (11.4) 
and ptxas fails to assemble due to PTX assembly being for a newer version.

Could we symlink /usr/lib/cuda/include to /usr/include?

A solution before Clang 14 makes it into the repository seems desirable.
Ideally this would also be backported as a fix so users wishing to use a newer 
self-built Clang on older versions could do so.

Discussion in the TensorFlow issues linked in bug #985798 indicate that they 
are/were moving towards assuming a similar layout as Clang (/usr/lib/cuda). It 
seems likely the breakage would also extend to that and be fixed by the proposed 
symlink.

Also see:
* CMake bug <https://gitlab.kitware.com/cmake/cmake/-/issues/22682>
* LLVM commit discussion <https://reviews.llvm.org/D108247#3023142>



More information about the pkg-nvidia-devel mailing list