Reputation: 413
I am trying to compile the example CUDA code axpy.cu
from the llvm docs using:
clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_86 -L/usr/local/cuda-11.2/lib64 -lcudart_static -ldl -lrt -pthread
but I'm getting the following error:
error: unable to create target: 'No available targets are compatible with triple "nvptx64-nvidia-cuda"'
What's going on here? I was able to compile CUDA with clang a day or two ago and now it's not working for some reason. I'm not sure what changed on my system.
I'm using clang 13 which should support CUDA 11.2.
Upvotes: 1
Views: 1631
Reputation: 413
The problem was that I built llvm/clang from source without support for cuda. The solution is to use the -DLLVM_TARGETS_TO_BUILD="X86;NVPTX"
when building llvm from source.
Upvotes: 3