Tensorflow cannot open libcuda.so.1

后端 未结 4 1315
感动是毒
感动是毒 2021-02-07 07:27

I have a laptop with a GeForce 940 MX. I want to get Tensorflow up and running on the gpu. I installed everything from their tutorial page, now when I import Tensorflow, I get

相关标签:
4条回答
  • 2021-02-07 07:53

    In the case I just solved, it was updating the GPU driver to the latest and installing the cuda toolkit. First, the ppa was added and GPU driver installed:

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
    sudo apt install nvidia-390
    

    After adding the ppa, it showed options for driver versions, and 390 was the latest 'stable' version that was shown.

    Then install the cuda toolkit:

    sudo apt install nvidia-cuda-toolkit
    

    Then reboot:

    sudo reboot
    

    It updated the drivers to a newer version than the 390 originally installed in the first step (it was 410; this was a p2.xlarge instance on AWS).

    0 讨论(0)
  • 2021-02-07 08:08

    libcuda.so.1 is a symlink to a file that is specific to the version of your NVIDIA drivers. It may be pointing to the wrong version or it may not exist.

    # See where the link is pointing.  
    ls  /usr/lib/x86_64-linux-gnu/libcuda.so.1 -la
    # My result:
    # lrwxrwxrwx 1 root root 19 Feb 22 20:40 \
    # /usr/lib/x86_64-linux-gnu/libcuda.so.1 -> ./libcuda.so.375.39
    
    # Make sure it is pointing to the right version. 
    # Compare it with the installed NVIDIA driver.
    nvidia-smi
    
    # Replace libcuda.so.1 with a link to the correct version
    cd /usr/lib/x86_64-linux-gnu
    sudo ln -f -s libcuda.so.<yournvidia.version> libcuda.so.1
    

    Now in the same way, make another symlink from libcuda.so.1 to a link of the same name in your LD_LIBRARY_PATH directory.

    You may also find that you need to create a link to libcuda.so.1 in /usr/lib/x86_64-linux-gnu named libcuda.so

    0 讨论(0)
  • 2021-02-07 08:10

    In case anyone still encounters this. First make sure to add the --runtime=nvidia parameter in order to run your container.

    docker run --runtime=nvidia -t tensorflow/serving:latest-gpu
    

    where tensorflow/serving:latest-gpu is the name of the docker image.

    0 讨论(0)
  • 2021-02-07 08:12

    If you use Tensorflow on docker, you must have nvidia-docker 2.0 version. Otherwise there will be errors loading libcuda.so.1. Link to the tutorial with installation on Ubuntu 18.04: https://medium.com/@sh.tsang/docker-tutorial-5-nvidia-docker-2-0-installation-in-ubuntu-18-04-cb80f17cac65

    0 讨论(0)
提交回复
热议问题