系统配置:ubuntu14.04 + GTX1060 + i7(7700K)
安装部署参考地址1:http://blog.csdn.net/zhouchao_fight/article/details/51517338
安装部署参考地址2(推荐):http://blog.csdn.net/zhaoyu106/article/details/52793183
官方下载:cuda-8.0 toolkit
github下载tensorflow*.whl文件:tensorflow_GPU_py2.7 (拉到最下面选择GPU+py2)
官方下载:cuDNNV5(需要注册登录官网)
一共3个文件放入U盘,在ubuntu实体机上读取安装。这些文件全部放在/usr/local/WYLdownload目录下
linux用户可以通过官方ppa解决安装GPU驱动的问题。使用如下命令添加Graphic Drivers PPA:
sudo add-apt-repository ppa:graphics-drivers/ppa
然后更新源:
sudo apt-get update
然后去navidia官网查看最新的驱动版本号:navidia官网:http://www.geforce.cn/drivers
比如说驱动的最新版本号为375,则执行如下指令:
sudo apt-get install nvidia-375
最后安装openGL支持:
sudo apt-get install mesa-common-dev
$ sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
$ sudo apt-get update
$ sudo apt-get install cuda-8.0
这时在/usr/local目录下产生一个cuda安装的路径叫"cuda-8.0"添加cuda到环境变量:
sudo vim /etc/profile
添加内容:
export CUDA_HOME=/usr/local/cuda-8.0
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
source /etc/profile
$ nvidia-smi
下载cuda测试用例:下载到~/cuda_examples目录下
$ cuda-install-samples-8.0.sh ~/cuda_examples
运行测试用例:
$ cd ~/cuda_examples/NVIDIA_CUDA-8.0_Samples
$ make
$ gcc --help
$ gcc --version #查看gcc版本号
最后一行为 sudo apt-get install g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
解压并将内容copy到/usr/local/cuda-8.0/include和lib64目录中:
cudann-8.0是目前为止比较稳定的版本在更新tensorflow后(1.4.1- 指令: pip install --upgrade tensorflow-gpu 即可更新tensorflow)
在官网下载对应版本的*.tgz文件。
指令如下:
sudo tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64
sudo chmod a+r /usr/local/cuda-8.0/include/cudnn.h /usr/local/cuda-8.0/lib64/libcudnn* #分配包的权限
官方安装tensorflow说明:https://www.tensorflow.org/install
1、Create a conda environment named tensorflow to run a version of Python by invoking the following command:建立tensorflow运行环境
$ conda create -n tensorflow
2、Activate the conda environment by issuing the following command:激活conda环境
$ source activate tensorflow
3、Issue a command of the following format to install TensorFlow inside your conda environment:
$ pip install --ignore-installed --upgrade TF_PYTHON_URL
其中TF_PYTHON_URL是想要配置的tensorflow版本:
如:https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
$ sudo pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
4、从conda环境中退出:
$ source deactivate
1、克隆Tensorflow仓库
#安转git支持:sudo apt-get install git
$ sudo git clone --recurse-submodules https://github.com/tensorflow/tensorflow /usr/local/WYLdownload/tensorflow
$ pip install --upgrade setuptools pip
git clone <版本库的网址> <本地目录名>
$ sudo ./configure
$ pip install --ignore-installed --upgrade tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
$ sudo apt-get install python-numpy swig python-dev python-wheel
3、安装源支持与bazel并更新bazel:
$ sudo apt-get update
$ sudo apt-get install bazel
$ sudo apt-get upgrade bazel
执行如下指令查看bazel是否安装完成:
$ bazel version