Hi - I’m new to CUDA and just trying to learn the basics
I’m following the example in the CUBLAS Library but when making the call cublasCreate(&handle) I get this error
undefined reference to `cublasCreate_v2’
I have included cublas_v2.h exactly the same way as the example. Aimilar errors come up when trying to use other cublas functions - can anyone tell me why I’m getting this error? Thanks.
In Nsight, how to incorporate nvcc file.cu -lcublas -lcusparse. I am a beginner. I have included cublas_v2.h and cusparse_v2.h. I am running through my local machine which is connected by ssh to the remote server and open Nsight by typing in the terminal.
I have a similar problem with nvlink during a compilation of a code:
nvcc -arch=sm_61 -shared -Xcompiler -fPIC -O3 -dc -m64 -o /home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o -c components/zerodop/GPUampcor/cuda/GPUamp.cu
nvcc -arch=sm_61 -shared -Xcompiler -fPIC -O3 -dlink /home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o -o /home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor-linked.o -L/usr/local/cuda/lib64 -lcuda -lcublas_static -lcufft_static -lculibos -lcublas_device -lcudart -lcudadevrt
nvlink error : Undefined reference to ‘cublasCreate_v2’ in ‘/home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o’
nvlink error : Undefined reference to ‘cublasScasum_v2’ in ‘/home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o’
nvlink error : Undefined reference to 'cublasDestroy_v2’ in ‘/home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o’
nvlink error : Undefined reference to ‘cublasIcamax_v2’ in ‘/home/mgovorcin/Installation_dir/isce/isce-2.2.0/build/components/zerodop/GPUampcor/src/gpu-ampcor.o’
Based on everything that I read, can see that the problem is in linking the object with CUDA libraries. I already have all environmental variables (PATH, LD_LIBRARY_PATH, LIBRARY_PATH and CPATH) set and it is not working. I you can see the error above, I also try direct linking with -L option and received the same error. Moreover, I played with the compile flags and didnt get anywhere. Also, important is to mention that samples in /usr/local/cuda/sample all work find and I managed to install tensorflow with this cuda-10 installation.
I saw that undefined reference is also sometime resolved by putting extern C in the code, as it is not my code don’t know exactly where to put it and when I tried, I got the same error again.
I dont know what else to do, everything looks to be installed correctly but compilation of this code doesn’t want to go through. Can somebody please help me with this matter?
I believe I have a similar problem, as you @mgovorcinzd describe above. I am trying to compile GRASShopPER (a GPU based genome assembler) that was written for CUDA 8.2. I am using Ubuntu 18.02 LTS and CUDA 10.2.
If I am to install CUDA 9.2 alongside the CUDA 10.2 installation, would I simply change the $PATH and $LD_LIBRARY_PATH variables to point to CUDA 9.2 for the compiling of the code and then switch it back?
If I am to install CUDA 9.2 alongside the CUDA 10.2 installation, would I simply change the $PATH and $LD_LIBRARY_PATH variables to point to CUDA 9.2 for the compiling of the code and then switch it back?
Yes. It’s not uncommon to have a few versions on your computer. Confirm you’re using the correct version with
nvcc --version
Is/are compiled CUDA files forwards compatible?
Yes. As long as you’re not using any deprecated functions, you should be able to compile with a newer version of CUDA. When you compile with a newer version of CUDA, make sure your driver is compatible. This can be achieved with nvidia-smi.