Skip to content

Commit 9a0bfe2

Browse files
committed
include Section about building tf from source in README
1 parent f6be90d commit 9a0bfe2

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,116 @@ For GPU-accelerated tensorflow, ensure you do or have done the following:
101101

102102
Ansible will immediately ask you for your sudo password, as packages etc. will need to be installed through root user.
103103

104+
# Build TensorFlow from Source
105+
106+
> Note: As of now, if you configured to build TensorFlow from Source, you need to follow this guide after running the Ansible playbook. In the future, this should mostly be handled by Ansible.
107+
108+
Inside `ml/tensorflow` (default location) run `./configure`.
109+
110+
Here is my sample dialogue and the answers I gave to the questions:
111+
112+
> Note: Ensure to refer to the proper Python version you want to use! Here I compiled with Python 3.5.
113+
114+
```
115+
Extracting Bazel installation...
116+
You have bazel 0.7.0 installed.
117+
Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3
118+
119+
120+
Found possible Python library paths:
121+
/usr/local/lib/python3.5/dist-packages
122+
/usr/lib/python3/dist-packages
123+
Please input the desired Python library path to use. Default is [/usr/local/lib/python3.5/dist-packages]
124+
125+
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]:
126+
jemalloc as malloc support will be enabled for TensorFlow.
127+
128+
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: n
129+
No Google Cloud Platform support will be enabled for TensorFlow.
130+
131+
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: n
132+
No Hadoop File System support will be enabled for TensorFlow.
133+
134+
Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: n
135+
No Amazon S3 File System support will be enabled for TensorFlow.
136+
137+
Do you wish to build TensorFlow with XLA JIT support? [y/N]: n
138+
No XLA JIT support will be enabled for TensorFlow.
139+
140+
Do you wish to build TensorFlow with GDR support? [y/N]: n
141+
No GDR support will be enabled for TensorFlow.
142+
143+
Do you wish to build TensorFlow with VERBS support? [y/N]: n
144+
No VERBS support will be enabled for TensorFlow.
145+
146+
Do you wish to build TensorFlow with OpenCL support? [y/N]: n
147+
No OpenCL support will be enabled for TensorFlow.
148+
149+
Do you wish to build TensorFlow with CUDA support? [y/N]: y
150+
CUDA support will be enabled for TensorFlow.
151+
152+
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: 9.0
153+
154+
155+
Please specify the location where CUDA 9.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
156+
157+
158+
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: 7
159+
160+
161+
Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:/usr/lib/x86_64-linux-gnu
162+
163+
164+
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
165+
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
166+
Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 5.0]5.0
167+
168+
169+
Do you want to use clang as CUDA compiler? [y/N]: n
170+
nvcc will be used as CUDA compiler.
171+
172+
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
173+
174+
175+
Do you wish to build TensorFlow with MPI support? [y/N]: n
176+
No MPI support will be enabled for TensorFlow.
177+
178+
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
179+
180+
181+
Add "--config=mkl" to your bazel command to build with MKL support.
182+
Please note that MKL on MacOS or windows is still not supported.
183+
If you would like to use a local MKL instead of downloading, please set the environment variable "TF_MKL_ROOT" every time before build.
184+
Configuration finished
185+
```
186+
187+
Then trigger the building procedure (takes about 23 minutes for me):
188+
189+
```
190+
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
191+
```
192+
193+
Next create the package:
194+
195+
```
196+
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
197+
```
198+
199+
Finally install the package (choose proper pip version again! .whl-file can be named differently, investigate the folder!):
200+
201+
```
202+
sudo pip3 install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
203+
```
204+
205+
See also: https://www.tensorflow.org/install/install_sources
206+
207+
In case you want to remove previous builds again (choose proper pip version again!):
208+
209+
```
210+
sudo pip3 uninstall tensorflow
211+
sudo pip3 uninstall tensorflow-tensorboard
212+
```
213+
104214
# Run
105215

106216
1. Inside `ml/tf_vision/config/` the YAML file `config.obj_detect.sample.yml` contains the default configuration to run.

0 commit comments

Comments
 (0)