Ubuntu下安装CUDA

参考链接:
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
http://blog.csdn.net/jhszh418762259/article/details/52958287?locationNum=8&fps=1
http://www.cnblogs.com/wangduo/p/7383989.html

cuda

  1. Perform the pre-installation actions.
    sudo apt-get install linux-headers-$(uname -r)
  2. Install repository meta-data
    sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
  3. Update the Apt repository cache
    sudo apt-get update
  4. Install CUDA
    sudo apt-get install cuda
  5. Perform the post-installation actions
    export CUDA_HOME=/usr/local/cuda-8.0
    export PATH=$CUDA_HOME/bin:$PATH
    # export LD_LIBRARY_PATH=$CUDA_HOME/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    source ~/.bashrc
    

check:

nvcc --version
nvidia-smi

cuDNN

下载cuDNN后解压

tar -xzvf cudnn-9.0-linux-x64-v7.tgz
sudo cp lib* /usr/local/cuda/lib64/
sudo cp cudnn.h /usr/local/cuda/include/
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

更新软链接

cd /usr/local/cuda/lib64/
sudo rm -rf libcudnn.so libcudnn.so.5
sudo ln -s libcudnn.so.5.1.5 libcudnn.so.5
sudo ln -s libcudnn.so.5 libcudnn.so

若需要更换cudnn版本,则替换原来的libcudnn*,并重新软链接。

更新链接库

sudo ldconfig

/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbol link
/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbol link

sudo mv /usr/lib/nvidia-375/libEGL.so.1 /usr/lib/nvidia-375/libEGL.so.1.org
sudo mv /usr/lib32/nvidia-375/libEGL.so.1 /usr/lib32/nvidia-375/libEGL.so.1.org
sudo ln -s /usr/lib/nvidia-375/libEGL.so.375.39 /usr/lib/nvidia-375/libEGL.so.1
sudo ln -s /usr/lib32/nvidia-375/libEGL.so.375.39 /usr/lib32/nvidia-375/libEGL.so.1
posted @ 2017-11-05 15:01  actonton  阅读(1681)  评论(0编辑  收藏  举报