Hi,
I am getting the above error when I am trying to compile a cuda file.
The hierarchy of directories are like below:
/NVIDIA_GPU_Computing_SDK
I have my cuda file in /NVIDIA_GPU_Computing_SDK/C/src/LPS/laplace3d.cu
I am compiling the file using the below command
nvcc laplace3d.cu -L/home/NVIDIA_GPU_Computing_SDK/C/common/inc -I/home/NVIDIA_GPU_Computing_SDK/C/common/inc
Any inputs on how to resolve this issue?
Thanks
Sai
I have also tried with the below command
nvcc laplace3d.cu -L/home/NVIDIA_GPU_Computing_SDK/C/lib -llibcutil_x86_64 -I/home/NVIDIA_GPU_Computing_SDK/C/common/inc
I got the following error
/usr/bin/ld: cannot find -llibcutil_x86_64
collect2: ld returned 1 exit status
But libcutil_x86_64.a is present in /home/NVIDIA_GPU_Computing_SDK/C/lib directory
Resolved!
The command should be
nvcc laplace3d.cu -L/home/NVIDIA_GPU_Computing_SDK/C/lib -lcutil_x86_64 -I/home/NVIDIA_GPU_Computing_SDK/C/common/inc
Thanks,
Sai
This is using an old toolkit version that included the “SDK”. That was dropped as of CUDA 5.0 and replaced by the CUDA samples.
But if you have the SDK installed (it appears you do) then the undefined reference is referring to a missing library (it is a link time error, not compile-time error).
You need to link to the necessary library which requires using both the -L switch and the -l switch. Something like this:
nvcc laplace3d.cu -L/home/NVIDIA_GPU_Computing_SDK/C/lib -lcutil -I/home/NVIDIA_GPU_Computing_SDK/C/common/inc
Look in the home/NVIDIA_GPU_Computing_SDK/C/lib directory for the cutil library. If it is there, change the -lcutil above as necessary, for example it may need to be -lcutil_x86_64
And this assumes you have already built the necessary libcutil libraries in the SDK. If not, try running make in the home/NVIDIA_GPU_Computing_SDK/C/common directory, and read the cutil_Readme.txt doc that is there.