<div dir="ltr">As mentioned in <a href="http://llvm.org/docs/CompileCudaWithLLVM.html">http://llvm.org/docs/CompileCudaWithLLVM.html</a>, the CUDA support works the best with the trunk version of LLVM. Can you possibly try that? <div><br></div><div>I also don't know how well Clang for CUDA works with CUDA 6.0 SDK. Artem, can you comment on that? </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 11:43 AM, Huebl, Axel via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Migrated from llvm-dev]<br>
<br>
Hi,<br>
<br>
I installed the latest version of clang 3.8 from the llvm deb packages<br>
(<a href="http://llvm.org/apt/" rel="noreferrer" target="_blank">http://llvm.org/apt/</a>) and have a Debian Jessie with cuda 6.0 from the<br>
official Debian repos installed and running (under /usr).<br>
<br>
When trying to compile a cuda program, the typical cuda extensions and<br>
APIs such as `__device__` and `cudaMalloc` are now known to clang,<br>
although I did set --cuda-arch=sm_35 and --cuda-path=/usr<br>
<br>
  <a href="http://mandelbrot.cu" rel="noreferrer" target="_blank">mandelbrot.cu</a>: error: unknown type name '__device__'<br>
    __device__ cuComplex( float a, float b ) : r(a), i(b) {}<br>
<br>
  <a href="http://mandelbrot.cu" rel="noreferrer" target="_blank">mandelbrot.cu</a>: error: unknown type name '__global__'<br>
    __global__ void calcMandelbrot( int* color_d, const int num_rows,<br>
    const int num...<br>
<br>
  <a href="http://mandelbrot.cu" rel="noreferrer" target="_blank">mandelbrot.cu</a>: error: use of undeclared identifier 'cudaMalloc'<br>
        cudaMalloc( (void**)&color_d, nBytes );<br>
<br>
  [...]<br>
<br>
I had a similar problem with a development version published in November<br>
but setting --cuda-path solved it that time (I think the cuda path was<br>
not in /usr but in a /opt path on our cluster).<br>
<br>
Did I miss an option or is the detection in /usr installs failing?<br>
<br>
Today's versions:<br>
<br>
$ clang++-3.8 --version<br>
clang version 3.8.0-svn260756-1~exp1 (branches/release_38)<br>
Target: x86_64-unknown-linux-gnu<br>
Thread model: posix<br>
InstalledDir: /usr/bin<br>
<br>
$ nvcc --version<br>
nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2013 NVIDIA Corporation<br>
Built on Thu_Mar_13_11:58:58_PDT_2014<br>
Cuda compilation tools, release 6.0, V6.0.1<br>
<br>
$ locate cuda.h<br>
/usr/include/cuda.h<br>
$ which nvcc<br>
/usr/bin/nvcc<br>
$ which clang++-3.8<br>
/usr/bin/clang++-3.8<br>
<br>
Compile :<br>
<br>
$ clang++-3.8 --cuda-gpu-arch=sm_35 <a href="http://mandelbrot.cu" rel="noreferrer" target="_blank">mandelbrot.cu</a> -I/usr/include/<br>
-L/usr/lib/x86_64-linux-gnu/ -lcudart -lcudart_static -ldl -lrt -pthread<br>
-I/usr/include/x86_64-linux-gnu<br>
# also tried with -lcuda<br>
<br>
File to compile:<br>
  <a href="https://git.io/vazCm" rel="noreferrer" target="_blank">https://git.io/vazCm</a><br>
<br>
<br>
Best regards,<br>
Axel Huebl<br>
--<br>
<br>
Axel Huebl<br>
Phone <a href="tel:%2B49%20351%20260%203582" value="+493512603582">+49 351 260 3582</a><br>
<a href="https://www.hzdr.de/crp" rel="noreferrer" target="_blank">https://www.hzdr.de/crp</a><br>
Computational Radiation Physics<br>
Laser Particle Acceleration Division<br>
Helmholtz-Zentrum Dresden - Rossendorf e.V.<br>
<br>
Bautzner Landstrasse 400, 01328 Dresden<br>
POB 510119, D-01314 Dresden<br>
Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey<br>
          Prof. Dr.Dr.h.c. P. Joehnk<br>
VR 1693 beim Amtsgericht Dresden<br>
<br>
<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>