I get the following error while installing a GPU pytorch library. cmake .. has been compiled correctly but l do make -j4 l get the following error

[ 98%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/operators/rnn/recurrent_network_executor_gpu.cc.o    
[ 98%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/queue/queue_ops_gpu.cc.o                             
[ 98%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/iter_op_gpu.cc.o                                 
[ 98%] Building CXX object caffe2/CMakeFiles/caffe2_gpu.dir/sgd/learning_rate_op_gpu.cc.o                        
[ 98%] Linking CXX shared library ../lib/libcaffe2_gpu.so                                                        
/usr/bin/ld : ne peut trouver -lCUDA_cublas_device_LIBRARY-NOTFOUND                                              
collect2: erreur: ld a retourné 1 code d'état d'exécution
make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/build.make:4511: lib/libcaffe2_gpu.so] Error 1                    
make[1]: *** [CMakeFiles/Makefile2:1925: caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2                           
make: *** [Makefile:141: all] Error 

What is wrong ? such that CUDA,CUDNN, nvidia-smi, Gpu pytorch have been installed. I'm working on conda environment

  • How are you trying to specify the library in your makefile? -lcublas_device would be the expected way, with the CUDA library location specified in LD_LIBRARY_PATH. – ubfan1 Aug 22 '19 at 16:01

I faced a similar problem when using LibTorch. What solved it for me was upgrading to CMake=3.15.2. I found this solution here: https://github.com/clab/dynet/issues/1457. They say version 3.12.2 is sufficient.

In case your using Ubuntu >=18.04, 3.10.2 is the latest cmake version provided by apt. You can install a more recent version via snap:

sudo apt purge cmake # Remove cmake.
sudo snap install cmake --classic # Install a more recent. Note: it requires to disable security confinement.

You will find the executable in /snap/bin/cmake, so you might have to append run

echo "export PATH=${PATH}:/snap/bin" >> ~/.bashrc

and reopen your Terminal. Now cmake --version should give you a more recent one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.