[cfe-dev] Clang/CUDA: --cuda-path

Huebl, Axel via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 16 11:18:11 PDT 2016


Thanks,


@Artem yes this is definitely the case, thanks!
I guess for the default ubuntu/debian user, scattering an (old)
contrib/non-free/multiverse version of CUDA as the default installation
might often be the case.

I opened a RFE in https://llvm.org/bugs/show_bug.cgi?id=26966

@Jingyue I tried to use clang 3.8 just because I was excited about the
recent release notes :) In parallel I started compiling the trunk but
after some hours I ran into out-of-disk on the machine where the error
occurred (my laptop; somehow the 600 MB source expanded to >5 GBs at 63%
of make) and I am currently compiling again on the cluster (where
everything is ordered as expected from the nvidia installer ;) ).


Thanks!
Axel

On 16.03.2016 13:10, Artem Belevich wrote:
> I'm afraid --cuda-path is not going to help here even if you build
> latest clang from sources.
> The problem is that clang's driver currently assumes that cuda is
> installed in its own directory.
> 
> In your case it appears that CUDA headers/libraries/executables are
> scattered ll over the place.
> Your best bet to make it work would be to uninstall your current CUDA
> version and then reinstall it using Nvidia's own installer.
> 
> It may be a good idea to file a bug for this as I suspect it may be a
> common enough scenario that clang should be able to deal with.
> 
> --Artem
> 
> 
> 
> On Wed, Mar 16, 2016 at 11:43 AM, Huebl, Axel via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> 
>     [Migrated from llvm-dev]
> 
>     Hi,
> 
>     I installed the latest version of clang 3.8 from the llvm deb packages
>     (http://llvm.org/apt/) and have a Debian Jessie with cuda 6.0 from the
>     official Debian repos installed and running (under /usr).
> 
>     When trying to compile a cuda program, the typical cuda extensions and
>     APIs such as `__device__` and `cudaMalloc` are now known to clang,
>     although I did set --cuda-arch=sm_35 and --cuda-path=/usr
> 
>       mandelbrot.cu <http://mandelbrot.cu>: error: unknown type name
>     '__device__'
>         __device__ cuComplex( float a, float b ) : r(a), i(b) {}
> 
>       mandelbrot.cu <http://mandelbrot.cu>: error: unknown type name
>     '__global__'
>         __global__ void calcMandelbrot( int* color_d, const int num_rows,
>         const int num...
> 
>       mandelbrot.cu <http://mandelbrot.cu>: error: use of undeclared
>     identifier 'cudaMalloc'
>             cudaMalloc( (void**)&color_d, nBytes );
> 
>       [...]
> 
>     I had a similar problem with a development version published in November
>     but setting --cuda-path solved it that time (I think the cuda path was
>     not in /usr but in a /opt path on our cluster).
> 
>     Did I miss an option or is the detection in /usr installs failing?
> 
>     Today's versions:
> 
>     $ clang++-3.8 --version
>     clang version 3.8.0-svn260756-1~exp1 (branches/release_38)
>     Target: x86_64-unknown-linux-gnu
>     Thread model: posix
>     InstalledDir: /usr/bin
> 
>     $ nvcc --version
>     nvcc: NVIDIA (R) Cuda compiler driver
>     Copyright (c) 2005-2013 NVIDIA Corporation
>     Built on Thu_Mar_13_11:58:58_PDT_2014
>     Cuda compilation tools, release 6.0, V6.0.1
> 
>     $ locate cuda.h
>     /usr/include/cuda.h
>     $ which nvcc
>     /usr/bin/nvcc
>     $ which clang++-3.8
>     /usr/bin/clang++-3.8
> 
>     Compile :
> 
>     $ clang++-3.8 --cuda-gpu-arch=sm_35 mandelbrot.cu
>     <http://mandelbrot.cu> -I/usr/include/
>     -L/usr/lib/x86_64-linux-gnu/ -lcudart -lcudart_static -ldl -lrt -pthread
>     -I/usr/include/x86_64-linux-gnu
>     # also tried with -lcuda
> 
>     File to compile:
>       https://git.io/vazCm
> 
> 
>     Best regards,
>     Axel Huebl
>     --
> 
>     Axel Huebl
>     Phone +49 351 260 3582 <tel:%2B49%20351%20260%203582>
>     https://www.hzdr.de/crp
>     Computational Radiation Physics
>     Laser Particle Acceleration Division
>     Helmholtz-Zentrum Dresden - Rossendorf e.V.
> 
>     Bautzner Landstrasse 400, 01328 Dresden
>     POB 510119, D-01314 Dresden
>     Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
>               Prof. Dr.Dr.h.c. P. Joehnk
>     VR 1693 beim Amtsgericht Dresden
> 
> 
> 
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> 
> 
> 
> 
> -- 
> --Artem Belevich

-- 

Axel Huebl
Phone +49 351 260 3582
https://www.hzdr.de/crp
Computational Radiation Physics
Laser Particle Acceleration Division
Helmholtz-Zentrum Dresden - Rossendorf e.V.

Bautzner Landstrasse 400, 01328 Dresden
POB 510119, D-01314 Dresden
Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
          Prof. Dr.Dr.h.c. P. Joehnk
VR 1693 beim Amtsgericht Dresden

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5119 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160316/a5d9d14a/attachment.bin>


More information about the cfe-dev mailing list