6、安装cuda后还需要安装cudnn这个软件,官网下载和CUDA对应的版本(https://developer.nvidia.com/rdp/cudnn-download ),需要注册。然后解压文件,一次执行以下命令(我下载的版本是cudnn-9.0-linux-x64-v7.5.0.56.tgz)
tar -xvzf cudnn-9.0-linux-x64-v7.5.0.56.tgz
cd cuda
sudo cp include/cudnn.h /usr/local/cuda/include
sudo cp lib64/libcudnn.* /usr/local/cuda/lib64
CUDNN安装完成。
查看cudnn版本的方法:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
PS:这里下载cundnn一定要对应好版本,下面这个是版本对应关系:
Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 9.1
Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 9.0
Download cuDNN v7.1.2 (Mar 21, 2018), for CUDA 8.0
Download cuDNN v7.1.1 (Feb 28, 2018), for CUDA 9.1
Download cuDNN v7.1.1 (Feb 28, 2018), for CUDA 9.0
Download cuDNN v7.1.1 (Feb 28, 2018), for CUDA 8.0
Download cuDNN v7.0.5 (Dec 11, 2017), for CUDA 9.1
Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 9.0
Download cuDNN v7.0.5 (Dec 5, 2017), for CUDA 8.0
Download cuDNN v7.0.4 (Nov 13, 2017), for CUDA 9.0
Download cuDNN v7.0.4 (Nov 13, 2017), for CUDA 8.0
Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0
Download cuDNN v6.0 (April 27, 2017), for CUDA 7.5
Download cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0
Download cuDNN v5.1 (Jan 20, 2017), for CUDA 7.5
Download cuDNN v5 (May 27, 2016), for CUDA 8.0
Download cuDNN v5 (May 12, 2016), for CUDA 7.5
Download cuDNN v4 (Feb 10, 2016), for CUDA 7.0 and later.
Download cuDNN v3 (September 8, 2015), for CUDA 7.0 and later.
Download cuDNN v2 (March 17,2015), for CUDA 6.5 and later.
Download cuDNN v1 (cuDNN 6.5 R1)
7、基本环境终于安装完了,剩下最后一步了,安装TensorFlow-gpu
正常是可以直接pip install tensorflow-gpu,安装完全没有毛病,但是测试的时候会出现问题:
ImportError: libcublas.so.10.0: cannot open shared object file