[PATCH] D55269: [CUDA][OpenMP] Fix nvidia-cuda-toolkit detection on Debian/Ubuntu

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 4 16:22:01 PST 2018


tra added a comment.

In D55269#1319437 <https://reviews.llvm.org/D55269#1319437>, @jdenny wrote:

> In D55269#1319382 <https://reviews.llvm.org/D55269#1319382>, @tra wrote:
>
> > Let's start with fixing OpenMP's cmake files. Once it no longer insists on specifying --cuda-path=/usr, and isUbuntu is in place, what is the remaining failure that you see?
>
>
> I'm fairly certain I would see no remaining failure then, but it's not clear to me how we should convince OpenMP's cmake files to stop doing that.
>
> openmp/libomptarget/cmake/Modules/LibomptargetNVPTXBitcodeLibrary.cmake is the file, and there's one occurrence of --cuda-path.
>
> If CUDA_TOOLKIT_ROOT_DIR is specified explicitly to cmake, that --cuda-path is necessary, so we cannot just remove it.
>
> If CUDA_TOOLKIT_ROOT_DIR is not specified explicitly, it is computed by cmake.  So I believe this boils down to getting cmake to find the right CUDA root on Debian/Ubuntu.
>
> Do you agree so far?


I guess we're dealing with even more  issues here.
cmake currently only knows about CUDA compilation with nvcc. The autodetection of CUDA_TOOLKIT_ROOT_DIR is intended to work for nvcc only and it does serve that purpose. Debian/Ubuntu packaging was also initially done with only nvcc in mind and it does work for nvcc. OpenMP's cmake files rely on CUDA_TOOLKIT_ROOT_DIR to find CUDA SDK and that is what fails for clang in case of split CUDA SDK installation.

One way to deal with that would be to change OpenMP's cmake files to check whether we're using Clang to compile CUDA and, if that's the case override CUDA root detection. Maybe ensure that CUDA install is monolithic and require user to specify a different location. Or check if we've detected a split path in /usr and override it with /usr/lib/cuda.

> Would you recommend submitting a patch to cmake's CUDA support?  Or would you recommend replicating clang's logic from D40453 <https://reviews.llvm.org/D40453> into openmp's cmake files, overriding cmake's own selection of CUDA_TOOLKIT_ROOT_DIR?

That may be a bigger can of works than a single patch can solve. The good news is that the maintainer of CUDA support in cmake is working on adding clang support. So, things may improve soon.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55269/new/

https://reviews.llvm.org/D55269





More information about the cfe-commits mailing list