[ACCEPTED]-Compiling CUDA with clang-llvm-clang

Accepted answer
Score: 11

Thanks to contributions from Google and 7 others, Clang now supports building CUDA. Command 6 line parameters are slightly different from 5 nvcc, though. According to the official documentation, assuming your 4 file is named axpy.cu, the basic usage is:

$ clang++ axpy.cu -o axpy --cuda-gpu-arch=<GPU arch>  \
    -L<CUDA install path>/<lib64 or lib>              \
    -lcudart_static -ldl -lrt -pthread

Note 3 that using Clang for compiling CUDA still 2 requires that you have the proprietary CUDA 1 runtime from the NVIDIA CUDA toolkit installed.

Score: 4

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

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

More Related questions