上QQ阅读APP看书,第一时间看更新
Getting ready
At present, XLA is not included in the binary distributions of TensorFlow. One needs to build it from source. To build TensorFlow from source, knowledge of LLVM and Bazel along with TensorFlow is required. TensorFlow.org supports building from source in only MacOS and Ubuntu. The steps needed to build TensorFlow from the source are as follows (https://www.tensorflow.org/install/install_sources):
- Determine which TensorFlow you want to install--TensorFlow with CPU support only or TensorFlow with GPU support.
- Clone the TensorFlow repository:
git clone https://github.com/tensorflow/tensorflow
cd tensorflow
git checkout Branch #where Branch is the desired branch
- Install the following dependencies:
-
- Bazel
- TensorFlow Python dependencies
- For the GPU version, NVIDIA packages to support TensorFlow
- Configure the installation. In this step, you need to choose different options such as XLA, Cuda support, Verbs, and so on:
./configure
- Next, use bazel-build:
- For CPU only version you use:
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
- If you have a compatible GPU device and you want the GPU Support, then use:
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
- On a successful run, you will get a script, build_pip_package.
- Run this script as follows to build the whl file:
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
- Install the pip package:
sudo pip install /tmp/tensorflow_pkg/tensorflow-1.1.0-py2-none-any.whl
Now you are ready to go.