Skip to content

Commit 0e1419f

Browse files
Update compile_tensorflow_cpp.md
1 parent 0fe0552 commit 0e1419f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

compile_tensorflow_cpp.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,15 @@ Note:
165165
1. Building TensorFlow can consume a lot of memory. So I prefer a small number of CPUs (`--jobs`), e.g. 4 CPUs use `--jobs=4`.
166166
2. Limit RAM requested by bazel with `--local_ram_resources`. The value is either integer, .e.g., 2048 use `--local_ram_resources=2048` or % of total memory, e.g., 50% use `"HOST_RAM*.50"`.
167167
3. The whole process can take up to 1 hour.
168-
4. Add `-D_GLIBCXX_USE_CXX11_ABI=0` if you use GCC 5 or higher version.
169-
5. Flags for optimization: `--copt="-O3"`.
170-
6. Flasg for both AMD and Intel chips: `--copt=-mfma --copt=-msse4.1 --copt=-msse4.2 --copt=-mfpmath=both`.
171-
7. Flags for Intel: `--copt=-mavx --copt=-mavx2`.
172-
8. Rebuild with `--config=monolithic` if you want to compile all TensorFlow C++ code into a single shared object.
168+
4. If you don't want Bazel creates cache files in your local space, add [`--output_user_root`](https://docs.bazel.build/versions/main/user-manual.html#flag--output_user_root) to change the directory where output and base files will be created, e.g.,
169+
```bash
170+
bazel --output_user_root=/scratch/bazel/ build ...
171+
```
172+
5. Add `-D_GLIBCXX_USE_CXX11_ABI=0` if you use GCC 5 or higher version.
173+
6. Flags for optimization: `--copt="-O3"`.
174+
7. Flasg for both AMD and Intel chips: `--copt=-mfma --copt=-msse4.1 --copt=-msse4.2 --copt=-mfpmath=both`.
175+
8. Flags for Intel: `--copt=-mavx --copt=-mavx2`.
176+
9. Rebuild with `--config=monolithic` if you want to compile all TensorFlow C++ code into a single shared object.
173177

174178
**Optional 1:** Test
175179
```bash

0 commit comments

Comments
 (0)