Install tensorFlow with Bazel
Install TensorFlow
System:
- Ubuntu 14.04 (or Linux Mint 17.3)
- python 2.7
- GPU titan X
- Cuda 8.0
- Cudnn V7 for Cuda 8.0
- Bazel 0.5.4
sudo apt-get -y install python-dev python-pip libpng-dev libfreetype6-dev
git clone https://github.com/tensorflow/tensorflow
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
sudo apt-get -y install curl
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
wget https://github.com/bazelbuild/bazel/releases/download/0.5.4/bazel-0.5.4-installer-linux-x86_64.sh
./bazel-0.5.4-installer-linux-x86_64.sh --user
sudo pip install six numpy wheel
sudo pip install pillow lxml
sudo pip install matplotlib
sudo pip install jupyter
sudo pip install matplotlib
sudo pip install numexpr
sudo pip install tables
sudo pip install ipython h5py
LD_LIBRARY_PATH must include /usr/local/cuda/lib64
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
sudo pip install /tmp/tensorflow_pkg/tensorflow*.whl
testing tensorflow installation
python
>>> import tensorflow
======================== Object Detection TensorFlow ===================================
at tensorflowRoot
git clone https://github.com/tensorflow/models.git
at tensorflow/model
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip
cd research
../bin/protoc object_detection/protos/*.proto --python_out=.
sudo apt-get install python-tk
PYTHONPATH=$PYTHONPATH:/root_tensorflow/models/research:/root_tensorflow/models/research/slim
testing object detection installation
python object_detection/builders/model_builder_test.py
Correct Respond:
Ran 11 tests in 0.051s
OK
at tensorflow/models/research $
jupyter notebook object_detection/object_detection_tutorial.ipynb
run all cells
You will see the successful installation.
System:
- Ubuntu 14.04 (or Linux Mint 17.3)
- python 2.7
- GPU titan X
- Cuda 8.0
- Cudnn V7 for Cuda 8.0
- Bazel 0.5.4
sudo apt-get -y install python-dev python-pip libpng-dev libfreetype6-dev
git clone https://github.com/tensorflow/tensorflow
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
sudo apt-get -y install curl
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
wget https://github.com/bazelbuild/bazel/releases/download/0.5.4/bazel-0.5.4-installer-linux-x86_64.sh
./bazel-0.5.4-installer-linux-x86_64.sh --user
sudo pip install six numpy wheel
sudo pip install pillow lxml
sudo pip install matplotlib
sudo pip install jupyter
sudo pip install matplotlib
sudo pip install numexpr
sudo pip install tables
sudo pip install ipython h5py
LD_LIBRARY_PATH must include /usr/local/cuda/lib64
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
sudo pip install /tmp/tensorflow_pkg/tensorflow*.whl
testing tensorflow installation
python
>>> import tensorflow
======================== Object Detection TensorFlow ===================================
at tensorflowRoot
git clone https://github.com/tensorflow/models.git
at tensorflow/model
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip
cd research
../bin/protoc object_detection/protos/*.proto --python_out=.
sudo apt-get install python-tk
PYTHONPATH=$PYTHONPATH:/root_tensorflow/models/research:/root_tensorflow/models/research/slim
testing object detection installation
python object_detection/builders/model_builder_test.py
Correct Respond:
Ran 11 tests in 0.051s
OK
at tensorflow/models/research $
jupyter notebook object_detection/object_detection_tutorial.ipynb
run all cells
You will see the successful installation.
peerajak@Kaowkai /working/peerajak/tensorflow $ ./configure
ตอบลบWARNING: Running Bazel server needs to be killed, because the startup options are different.
You have bazel 0.5.2 installed.
Please specify the location of python. [Default is /home/peerajak/anaconda3/bin/python]: /usr/bin/python
Found possible Python library paths:
/usr/lib/python2.7/dist-packages
/working/peerajak/ConvolutionalPoseMachine/caffe/python
/usr/local/lib/python2.7/dist-packages
Please input the desired Python library path to use. Default is [/usr/lib/python2.7/dist-packages]
/usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: N
No jemalloc as malloc support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]:
No Google Cloud Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Hadoop File System support? [y/N]:
No Hadoop File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with XLA JIT support? [y/N]:
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]:
No GDR support will be enabled for TensorFlow.
Do you wish to build TensorFlow with VERBS support? [y/N]:
No VERBS support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL support? [y/N]:
No OpenCL 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 8.0]: 5.0.5
Please specify the location where CUDA 5.0.5 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Invalid path to CUDA 5.0.5 toolkit. /usr/local/cuda/lib64/libcudart.so.5.0.5 cannot be found
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 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]:
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: 5.0.5
Please specify the location where cuDNN 5.0.5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 5.2]
Do you want to use clang as CUDA compiler? [y/N]:
nvcc will be used as CUDA compiler.
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
Do you wish to build TensorFlow with MPI support? [y/N]:
No MPI support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
Add "--config=mkl" to your bazel command to build with MKL support.
Please note that MKL on MacOS or windows is still not supported.
If you would like to use a local MKL instead of downloading, please set the environment variable "TF_MKL_ROOT" every time before build.