Greetings! I am using clang19 to compile a cuda program. I followed cuda toolkit installation steps.
nvcc version is 12.2.2; gpu arch = Quadro M620; clang19; gcc 11.
Compile command: clang+±19 testclang.cu -o testclang --cuda-gpu-arch=sm_61 -L/usr/local/cuda
And then these errors line:
clang+±19 testclang.cu -o testclang --cuda-gpu-arch=sm_61 -L/usr/local/cuda
/usr/bin/ld: /tmp/testclang-be4996.o: in function __device_stub__hello_kernel()': testclang.cu:(.text+0x19): undefined reference to __cudaPopCallConfiguration’
/usr/bin/ld: testclang.cu:(.text+0x65): undefined reference to cudaLaunchKernel' /usr/bin/ld: /tmp/testclang-be4996.o: in function main’:
testclang.cu:(.text+0xd6): undefined reference to __cudaPushCallConfiguration' /usr/bin/ld: testclang.cu:(.text+0xe5): undefined reference to cudaDeviceSynchronize’
/usr/bin/ld: /tmp/testclang-be4996.o: in function __cuda_register_globals': testclang.cu:(.text+0x144): undefined reference to __cudaRegisterFunction’
/usr/bin/ld: /tmp/testclang-be4996.o: in function __cuda_module_ctor': testclang.cu:(.text+0x159): undefined reference to __cudaRegisterFatBinary’
/usr/bin/ld: testclang.cu:(.text+0x175): undefined reference to __cudaRegisterFatBinaryEnd' /usr/bin/ld: /tmp/testclang-be4996.o: in function __cuda_module_dtor’:
testclang.cu:(.text+0x199): undefined reference to `__cudaUnregisterFatBinary’
clang+±19: error: linker command failed with exit code 1 (use -v to see invocation)
Cuda program:
include <stdio.h>
include <cuda.h>"
global void hello_kernel() {
printf(“Hello, CUDA from GPU!\n”);
}
int main() {
hello_kernel<<<1, 1>>>();
cudaDeviceSynchronize();
printf(“Hello, CUDA from CPU!\n”);
return 0;
}
Any hint will be much appreciated. Thanks.