Tensorflow 安装与使用 (ubuntu16.04 GPU)
%#################################################################%
由于计算机里已安装 caffe, cuda, cudnn, 为了安装tensorflow后不影响其使用,所以在anaconda中新建了一个环境,名称:tensorflow, 建完之后选择 numpy 安装
%#################################################################%
查看cuda版本 cat /usr/local/cuda/version.txt
查看cudnn版本 cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
本计算机 cuda: 8.0 cudnn: 5.1.5
%#################################################################%
激活环境
source activate tensorflow
下载安装Bazel,Bazel是Google开源构建工具,类似于Make的工具,用来编译构建tensorflow
官网提供的地址一直连接不上,放在百度网盘里(bazel-0.5.4-installer-linux-x86_64.sh):https://pan.baidu.com/s/1o93507o
放在主目录文件夹 /tensorflow_install 下,执行
cd /home/majinlei/tensorflow_install
chmod +x bazel-0.5.4-installer-linux-x86_64.sh
./bazel-0.5.4-installer-linux-x86_64.sh --user
export PATH="$PATH:$HOME/bin"
执行上述 4 个命令之后开始配置(不要使用sudo ./configure)
./configure
具体配置选择如下:
(tensorflow) majinlei@majinlei:~/tensorflow$ ./configure
WARNING: Running Bazel server needs to be killed, because the startup options are different.
You have bazel 0.5.4 installed.
Please specify the location of python. [Default is /home/majinlei/anaconda2/envs/tensorflow/bin/python]: /home/majinlei/anaconda2/envs/tensorflow/bin/python
Found possible Python library paths:
/usr/local/lib/python2.7/site-packages
/home/majinlei/anaconda2/envs/tensorflow/lib/python2.7/site-packages
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/site-packages]
/home/majinlei/anaconda2/envs/tensorflow/lib/python2.7/site-packages
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: y
jemalloc as malloc support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: y
Google Cloud Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: y
Hadoop File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: y
Amazon S3 File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with XLA JIT support? [y/N]: y
XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]: y
GDR support will be enabled for TensorFlow.
Do you wish to build TensorFlow with VERBS support? [y/N]: y
VERBS support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 9.0]: 8.0
Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7