ubuntu下安装cuda,cudnn

来源:互联网 发布:linux ftp命令 二进制 编辑:程序博客网 时间:2024/06/04 18:14

参考网址:http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile


下载runfile可以去官网根据gpu型号选择,这里不多说了;主要说说安装过程:

1、Disable the Nouveau drivers.

Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

blacklist nouveau

options nouveau modeset=0

Regenerate the kernel initramfs:

$ sudo update-initramfs -u

2、$ sudo sh cuda_<version>_linux.run

3、The PATH variable needs to include /usr/local/cuda-8.0/bin

To add this path to the PATH variable:

   $ export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}

In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-8.0/lib64 on a 64-bit system, or /usr/local/cuda-8.0/lib on a 32-bit system

  • To change the environment variables for 64-bit operating systems:

    $ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\                         ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  • To change the environment variables for 32-bit operating systems:

    $ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib\                         ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
4、或者用vi /etc/profile添加全局变量

5、下载cudnn,我这里用的是5.1版本

下载后直接解压到指定路径下即可使用

sudo tar -xvf cudnn-8.0-linux-x64-v5.1.tgz  -C /usr/local/