Skip to content

Commit 3054d85

Browse files
Add configure
1 parent 203d171 commit 3054d85

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

compile_tensorflow_cpp.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22

33
Building TensorFlow C++ API is very tricky and can be a pain as there is not much information you can find about it even on TensorFlow's official documentation. Following you will find a step-by-step instruction showing how to build TensorFlow C++ v2 on Linux. It works well for my Ubuntu 20.04 running on AMD Ryzen processors.
44

5-
In this page I will walk you through the steps to install **TensorFlow C++ API version 2.7**.
5+
On this page, I will walk you through the steps to install **TensorFlow C++ API version 2.7**.
66

77
## Dependencies
88

99
- Conda
10-
- Python
10+
- Python + NumPy
1111
- GCC 5 or higher
1212
- Bazel*
1313
- Protobuf*
1414

1515
*a supported version depends on the version of TensorFlow. For TensorFlow v2.7, Python 3.9.9, GCC 10.3.0, Bazel 3.7.2, and Protobuf 3.9.2 work for me.
1616

17-
A list of supported Python, compiler, and Bazel can be found [here](https://www.tensorflow.org/install/source#tested_build_configurations).
17+
A list of supported Python, compiler and Bazel can be found [here](https://www.tensorflow.org/install/source#tested_build_configurations).
1818

1919
---
2020

2121
## Install package dependencies
2222

23-
### 1. Environment setup & install Python
23+
### 1. Environment setup
2424
```bash
2525
conda create -n tfcc
2626
conda activate tfcc # or `source activate tfcc`
27-
conda install python==3.9.9
2827
conda update --all -y
28+
conda install python==3.9.9
29+
conda install numpy
2930
```
3031

31-
### 2. Install bazel
32+
### 2. Install Bazel
3233

3334
Check a supported version at `tensorflow/.bazelversion`.
3435

@@ -71,12 +72,19 @@ cd tensorflow
7172
git checkout r2.7
7273
```
7374

75+
Configure the build:
76+
```bash
77+
./configure
78+
# I leave all answers empty, just Enter
79+
```
80+
7481
Let's compile using bazel `build` rule:
7582
```bash
7683
export CC=gcc
7784
export CXX=g++
7885
bazel build --jobs=4 --local_ram_resources="HOST_RAM*.50" \
7986
--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" -c opt \
87+
--config=noaws --config=nogcp --config=hdfs --config=nccl \
8088
//tensorflow:libtensorflow.so \
8189
//tensorflow:libtensorflow_cc.so \
8290
//tensorflow:libtensorflow_framework.so \

0 commit comments

Comments
 (0)