<div dir="ltr"><div>Hi all,</div><div><br></div><div>It's my first trial with clang. so if my question is so simple, i'm sorry first of all.</div><div><br></div><div>Basically, I'm trying to compile simple axpy cuda code by using clang, I'm following this example <a href="http://llvm.org/docs/CompileCudaWithLLVM.html">http://llvm.org/docs/CompileCudaWithLLVM.html</a>. However I'm getting this errors</div><div><br></div><div><div>$ clang++ <a href="http://axpy.cu">axpy.cu</a> -o axpy-clang -I/usr/local/cuda/samples/common/inc</div><div>In file included from <a href="http://axpy.cu:1">axpy.cu:1</a>:</div><div>In file included from /usr/local/cuda/samples/common/inc/helper_cuda.h:24:</div><div>/usr/local/cuda/samples/common/inc/helper_string.h:18:10: fatal error: 'fstream' file not found</div><div>#include <fstream></div><div>         ^</div><div>1 error generated.</div><div>axpy.cu:5:1: error: unknown type name '__global__'</div><div>__global__ void axpy(float a, float* x, float* y) {</div><div>^</div><div>axpy.cu:5:12: error: expected unqualified-id</div><div>__global__ void axpy(float a, float* x, float* y) {</div><div>           ^</div><div>axpy.cu:19:19: error: use of undeclared identifier 'cudaMalloc'</div><div>  checkCudaErrors(cudaMalloc(&device_x, kDataLen * sizeof(float)));</div><div>                  ^</div><div>axpy.cu:20:19: error: use of undeclared identifier 'cudaMalloc'</div><div>  checkCudaErrors(cudaMalloc(&device_y, kDataLen * sizeof(float)));</div><div>                  ^</div><div>axpy.cu:22:30: error: use of undeclared identifier 'cudaMemcpyHostToDevice'</div><div>                             cudaMemcpyHostToDevice));</div><div>                             ^</div><div>axpy.cu:25:3: error: use of undeclared identifier 'axpy'</div><div>  axpy<<<1, kDataLen>>>(a, device_x, device_y);</div><div>  ^</div><div>axpy.cu:28:19: error: use of undeclared identifier 'cudaDeviceSynchronize'</div><div>  checkCudaErrors(cudaDeviceSynchronize());</div><div>                  ^</div><div>axpy.cu:30:30: error: use of undeclared identifier 'cudaMemcpyDeviceToHost'</div><div>                             cudaMemcpyDeviceToHost));</div><div>                             ^</div><div>axpy.cu:37:19: error: use of undeclared identifier 'cudaDeviceReset'</div><div>  checkCudaErrors(cudaDeviceReset());</div><div>                  ^</div><div>9 errors generated.</div></div><div><br></div>What am I supposed to do? <div><br clear="all"><div>Regards</div>-- <br><div class="gmail_signature">sulomen</div>
</div></div>