Search code examples
cudaclangllvm-clang

Compiling CUDA with clang


I am new to LLVM. I heard that clang supports CUDA. How do I compile CUDA using clang? Do I have to make some config changes or include any specific header files? I couldn't find any information on this on the web. Is it possible at all?

Right now when I try to compile a dummy cuda program with clang as

clang -I /usr/local/cuda/include filename.cu 

I get the following error

 unknown type name '__global__'

 __global__ void nothing(int *A)

any help is appreciated! btw i am running it in a mac.


Solution

  • 2016-05-01 Update: clang now supports CUDA. See @rivanvx' answer.

    The CUDA compiler is based on LLVM. Clang, though also based on LLVM, does not support CUDA.