Hello everybody,
I will begin a master thesis dealing with Computational Fluid Dynamics and GPGPU in a few months. So I have to learn Cuda programming language. Being on an Asus Laptop (Linux Ubuntu) with Optimus I battle a couple of hours but I finally succeed in installing Cuda Toolkit 4.0.
First I installed the famous Bumblebee, then I install Nvidia drivers and 4.0 Toolkit. I try to compile the SDK package, but it failed. I had a “cannot find -lcuda”. I use the following command to make a symbolic link to libcuda.so which is in /usr/lib/nvidia-current and not in /usr/lib :
ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so
ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/libcuda.so.1
Finally, it works. I compile the SDK package and run for example ./deviceQuery or ./oceanFFT with the otirun command.
But the problem is when I try to compile my own Cuda code. I find a “Hello World” in Cuda on this forum. But when I try to compile it with nvcc :
nvcc hellocuda.cu
I have the following errors :
hellocuda.obj: In function `main':
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x88): undefined reference to `cudaMalloc'
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0xa4): undefined reference to `cudaMemcpy'
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0xfe): undefined reference to `cudaConfigureCall'
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x12a): undefined reference to `cudaMemcpy'
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x136): undefined reference to `cudaFree'
hellocuda.obj: In function `__cudaUnregisterBinaryUtil()':
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x175): undefined reference to `__cudaUnregisterFatBinary'
hellocuda.obj: In function `__device_stub__Z10helloWorldPc(char*)':
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x199): undefined reference to `cudaSetupArgument'
hellocuda.obj: In function `__sti____cudaRegisterAll_44_tmpxft_000009a5_00000000_4_hellocuda_cpp1_ii_main()':
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x1ed): undefined reference to `__cudaRegisterFatBinary'
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text+0x24e): undefined reference to `__cudaRegisterFunction'
hellocuda.obj: In function `cudaError cudaLaunch<char>(char*)':
tmpxft_000009a5_00000000-1_hellocuda.cudafe1.cpp:(.text._Z10cudaLaunchIcE9cudaErrorPT_[cudaError cudaLaunch<char>(char*)]+0x14): undefined reference to `cudaLaunch'
collect2: ld returned 1 exit status
It seems that nvcc doesn’t find all the Cuda functions. It’s probably stupid, but can anyone help ?
JF
P.S. : Sorry for my English, which is not very good, I must admit !