[PATCH] D114326: Update the list of CUDA versions up to 11.5

Mojca Miklavec via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 29 11:59:55 PST 2021

mojca added a comment.

@tra: this is not yet 100% ready since the unit tests are now failing (expecting to find CUDA 8.0).
I can fix the unit test, but I suppose that someone needs to install additional SDK somewhere into the infrastructure as well?

In D114326#3158913 <https://reviews.llvm.org/D114326#3158913>, @tra wrote:

> So, yes, you could automatically add linking flags in your example, but it's not feasible to do so for the linking phase in general. It would also introduce inconsistency in clang's linking phase behavior and would lead to questions -- why things work with `clang hello.co`, but not with `clang -c hello.cu; clang hello.o` ?

Please note that I'm a complete newbie to compilers.
Te flag `--cuda-path=` slightly reminds me of the `--framework` keyword on macOS. I'm not behind a mac right now, so please forgive me any typo or wrong paths (it's also not exact since the frameworks are searched for in different folders etc.), below is just a general idea.

  # this one effectively adds -I/System/Library/Frameworks/OpenGL.framework/Headers
  clang++ -c hello.cpp --framework OpenGL
  # this one effectively adds -L/System/Library/Frameworks/OpenGL.framework/lib as well as the library itself (-l<name>)
  clang++ hello.o --framework OpenGL
  # this one adds both include (-I) and linker directory (-L) flags
  clang++ hello.cpp --framework OpenGL

What would be cool to me was if `--cuda-path` was also implicitly adding the `-L` flag, so that the following would work:

  clang++ --cuda-path=/usr/local/cuda-11.5 -l cudart hello.cu
  clang++ --cuda-path=/usr/local/cuda-11.5 -l cudart hello.o

I don't know whether it would be acceptable to add (the default) cuda library path to the linker though.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list