Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#68837 - Temporarily recover the version.txt file in the cuda package

Attached to Project: Community Packages
Opened by Daniel Otero (canu7) - Thursday, 03 December 2020, 19:05 GMT
Last edited by Evangelos Foutras (foutrelis) - Saturday, 05 December 2020, 19:08 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Felix Yan (felixonmars)
Konstantin Gizdov (kgizdov)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The current version of CUDA (11.1.1-1) doesn't provide the "version.txt" file as it used to. This is a problem for clang, as it's currently [1] the only way it determines the installed CUDA version. Clang fallbacks to CUDA 7.0 [2] and is unable to compile .cu files because it can not find the libdevice file [3].

$ clang --cuda-device-only --cuda-path=/opt/cuda --cuda-gpu-arch=sm_35 -c test.cu
clang-11: error: cannot find libdevice for sm_35. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.

The "fix" consist on adding a "version.txt" file on the cuda package (full path: /opt/cuda/version.txt) with the following content: "CUDA Version 11.1.1". Of course, the version information could be derived from the PKGBUILD metadata. With the file, clang is able to compile cuda files:

$ clang --cuda-device-only --cuda-path=/opt/cuda --cuda-gpu-arch=sm_35 -c test.cu
clang-11: warning: Unknown CUDA version 11.1. Assuming the latest supported version 10.1 [-Wunknown-cuda-version]

This should be easily validated with `clang -v` output:

Found CUDA installation: /opt/cuda, version X.XX

Creating the file locally is trivial, but it takes a lot of time to find the real cause. If the feature it not accepted, at least I hope this information is useful for other Arch users.

Thanks.

[1]: There is already a patch merged upstream recovering the cuda version from the "cuda.h" header, making this feature unnecessary once clang 12 is released: https://github.com/llvm/llvm-project/commit/e7fe125b776bf08d95e60ff3354a5c836218a0e6

[2]: https://github.com/llvm/llvm-project/blob/llvmorg-10.0.1/clang/lib/Driver/ToolChains/Cuda.cpp#L147-L155

[3]: https://github.com/llvm/llvm-project/blob/llvmorg-11.0.0/clang/lib/Driver/ToolChains/Cuda.cpp#L165-L166
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Saturday, 05 December 2020, 19:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  clang 11.0.0-4

Loading...