<div dir="ltr">Hi Justin,<div><br></div><div>I've installed master version from git on two systems. Currently I can thoroughly compile C/C++. But I can't compile CUDA. I think I can't show headers to clang while I am compiling cuda</div><div><br></div><div>The error what I got at the first machine</div><div><div><br></div><div>~/LLVM$ clang++ <a href="http://axpy.cu">axpy.cu</a> </div><div>In file included from <built-in>:620:</div><div>In file included from <command line>:1:</div><div>In file included from /home/Computational/appbin/llvm-git/bin/../lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:47:</div><div>In file included from /usr/include/stdlib.h:24:</div><div>/usr/include/features.h:374:12: fatal error: 'sys/cdefs.h' file not found</div><div>#  include <sys/cdefs.h></div><div>           ^</div><div><br></div></div><div>Second machine</div><div><div>~/workspace/eclipse/TEST/llvm$ clang++ <a href="http://axpy.cu">axpy.cu</a> /usr/local/cuda-7.0/include/ -include cuda_runtime_api.h -D__CUDACC__ -m64</div><div>In file included from <a href="http://axpy.cu:8">axpy.cu:8</a>:</div><div>In file included from /usr/include/cuda_runtime.h:76:</div><div>In file included from /usr/include/common_functions.h:167:</div><div>/usr/include/math_functions.h:7563:10: fatal error: 'cmath' file not found</div><div>#include <cmath></div><div>         ^</div><div><br></div></div><div>Thank you very much</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-20 1:43 GMT+01:00 Justin Lebar <span dir="ltr"><<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It would be easier to debug this if we both had the same source code.<br>
<br>
I'm able to compile many of the samples which came with the CUDA SDK<br>
*using clang built from head*.  For example:<br>
<br>
$NVIDIA_CUDA-7.5_Samples/0_Simple/matrixMul$<br>
~/code/llvm/release/bin/clang++ -o matrixMulClang -I../../common/inc<br>
-L/usr/local/cuda-7.5/lib64 -I/usr/local/cuda-7.5/ matrixMul.cu<br>
-lcudart_static -lcuda -ldl -lrt -pthread<br>
<br>
Does this work for you?  If not, what platform are you on?<br>
<br>
Note that the CUDA implementation in Clang is by no means complete.<br>
It mostly works, but there are lots of edge-cases (e.g. printf) that<br>
we're still working on.<br>
<br>
-Justin<br>
<div><div class="h5"><br>
On Mon, Dec 14, 2015 at 9:57 AM, gry666 via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> Hi all,<br>
><br>
> It's my first trial with clang. so if my question is so simple, i'm sorry<br>
> first of all.<br>
><br>
> Basically, I'm trying to compile simple axpy cuda code by using clang, I'm<br>
> following this example <a href="http://llvm.org/docs/CompileCudaWithLLVM.html" rel="noreferrer" target="_blank">http://llvm.org/docs/CompileCudaWithLLVM.html</a>.<br>
> However I'm getting this errors<br>
><br>
> $ clang++ <a href="http://axpy.cu" rel="noreferrer" target="_blank">axpy.cu</a> -o axpy-clang -I/usr/local/cuda/samples/common/inc<br>
> In file included from <a href="http://axpy.cu:1" rel="noreferrer" target="_blank">axpy.cu:1</a>:<br>
> In file included from /usr/local/cuda/samples/common/inc/helper_cuda.h:24:<br>
> /usr/local/cuda/samples/common/inc/helper_string.h:18:10: fatal error:<br>
> 'fstream' file not found<br>
> #include <fstream><br>
>          ^<br>
> 1 error generated.<br>
> axpy.cu:5:1: error: unknown type name '__global__'<br>
> __global__ void axpy(float a, float* x, float* y) {<br>
> ^<br>
> axpy.cu:5:12: error: expected unqualified-id<br>
> __global__ void axpy(float a, float* x, float* y) {<br>
>            ^<br>
> axpy.cu:19:19: error: use of undeclared identifier 'cudaMalloc'<br>
>   checkCudaErrors(cudaMalloc(&device_x, kDataLen * sizeof(float)));<br>
>                   ^<br>
> axpy.cu:20:19: error: use of undeclared identifier 'cudaMalloc'<br>
>   checkCudaErrors(cudaMalloc(&device_y, kDataLen * sizeof(float)));<br>
>                   ^<br>
> axpy.cu:22:30: error: use of undeclared identifier 'cudaMemcpyHostToDevice'<br>
>                              cudaMemcpyHostToDevice));<br>
>                              ^<br>
> axpy.cu:25:3: error: use of undeclared identifier 'axpy'<br>
>   axpy<<<1, kDataLen>>>(a, device_x, device_y);<br>
>   ^<br>
> axpy.cu:28:19: error: use of undeclared identifier 'cudaDeviceSynchronize'<br>
>   checkCudaErrors(cudaDeviceSynchronize());<br>
>                   ^<br>
> axpy.cu:30:30: error: use of undeclared identifier 'cudaMemcpyDeviceToHost'<br>
>                              cudaMemcpyDeviceToHost));<br>
>                              ^<br>
> axpy.cu:37:19: error: use of undeclared identifier 'cudaDeviceReset'<br>
>   checkCudaErrors(cudaDeviceReset());<br>
>                   ^<br>
> 9 errors generated.<br>
><br>
> What am I supposed to do?<br>
><br>
> Regards<br>
> --<br>
> sulomen<br>
><br>
</div></div>> _______________________________________________<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><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Güray Özen<br>DEU Computer Engineering Department</div>
</div>