ubuntu16.04安装cuda9.0+cudnn7.4.1+tensorflow-gpu1.6
**
装载自: ubuntu安装tensorflow gpu版本 https://zhuanlan.zhihu.com/p/44183691
Ubuntu16.04下安装cuda和cudnn的三种方法(亲测全部有效)https://blog.csdn.net/wanzhen4330/article/details/81699769
**
cudn9.0
1)下载安装文件。首先去英伟达官网下载cuda安装包:https://developer.nvidia.com/cuda-toolkit-archive
下载runfile进行安装:
sudo sh cuda_9.0.176_384.81_linux.run
安装时注意选择:
Do you accept the previously read EULA?
accept/decline/quit: accept #同意
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n #选择no 已安装显卡驱动
Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y #选择yes 安装cuda
Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]: #回车
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y #选择yes 建立cuda软链接
Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y #选择yes 安装cuda 样例程序
Enter CUDA Samples Location
[ default is /home/adminpc ]: #回车
2)设置环境变量
sudo gedit ~/.bashrc
在最后加入
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64
export PATH=$PATH:/usr/local/cuda-9.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-9.0
接着
source .bashrc
运行 nvcc --version 可检查版本是否一致。
安装cudnn
下载cudnn: https://developer.nvidia.com/rdp/cudnn-archive
选择 library for Linux
解压缩、复制与更新(复制到cuda9.0/下面,貌似同一目录中还会出现一个cuda/,别复制错了):
tar -zxvf cudnn-9.0-linux-x64-v7.1.tgz
cd cuda
sudo cp lib64/lib* /usr/local/cuda-9.0/lib64/
sudo cp include/cudnn.h /usr/local/cuda-9.0/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*
#更新链接
cd /usr/local/cuda-9.0/lib64/
sudo chmod +r libcudnn.so.7.1.3 # ls 先查看.so的版本
sudo ln -sf libcudnn.so.7.1.3. libcudnn.so.7
sudo ln -sf libcudnn.so.7 libcudnn.so
sudo ldconfig
安装tensorflow-gpu
在anaconda中新建环境0331,并安装tensorflow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider tensorflow-gpu==1.6
tensorflow与cuda版本的对应关系:
查看cpu温度
apt-get install lm-sensors
sensors-detect
service kmod start
sensors