1.安装CUDA Tookit 7.5
- go to the webset to Install CUDA Toolkit 7.5
- log out, CTRL + ALT + F1 enter tty
- kill X service by command:
sudo server lightdm stop
- run
sudo init 3
sudo sh cuda_7.5.18_linux.run
Note when installing cuda_7.5.18, do not install openGL
2.安装cudnn v4
- 注册下载 cudnn-7.0-linux-x64-v4.0-prod.tgz
- run
tar -xzvf cudnn-7.0-linux-x64-v4.0-prod.tgz
1 cd cuda/include
2 sudo cp *.h /usr/local/cuda-7.5/include/
3 cd ../lib64
4 sudo cp lib* /usr/local/cuda-7.5/lib64/
5 cd /usr/local/cuda-7.5/lib64/
6 sudo chmod +r libcudnn.so.4.0.7
7 sudo ln -sf libcudnn.so.4.0.7 libcudnn.so.4
8 sudo ln -sf libcudnn.so.4 libcudnn.so
9 sudo ldconfig
3.安装tensorflow
- install anncoda2
bash Anaconda2-4.1.1-Linux-x86_64.sh
加上ignore-installed
4.设置环境变量
vim ~/.bashrc
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-7.5/lib64"
export CUDA_HOME=/usr/local/cuda-7.5
//
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
5.测试
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
参考文章
1.ubuntu 14.04 搭建GPU深度学习 tensorflow 平台
-
How to use CUDA and the GPU Version of Tensorflow for Deep Learning
3.HOW TO INSTALL TENSORFLOW WITH GPU SUPPORT ON A MACHINE WITH UBUNTU 14.04 LTS
tensorflow0.10.0升级到tensorflow0.11.0
(1). 卸载tensorflow0.10.0
sudo pip uninstall tensorflow
(2). 卸载cuda7.5,cuda8.0不需要卸载
cd /usr/local/cuda/bin
sudo ./uninstall_cuda_7.5.pl
# 手动清除cuda-7.5文件夹
cd /usr/local/sudo rm -rf cuda-7.5
# 删除cuda7.5samplecd ~
sudo rm -rf NVIDIA_CUDA-7.5_Samples
(3). 安装cuda8.0, 已有的不需要安装
chmod +x cuda_8.0.44_linux.run
sudo ./cuda_8.0.44_linux.run
#除了安装显卡驱动的地方选no,其他地方默认就好
(4). 安装cudnn5.1, 官网下载,解压
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
(5). 修改.bashrc文件, 将以前的7.5改成8.0,执行source .bashrc