Skip to content

Commit 41665bb

Browse files
authored
Merge pull request #4 from ika-rwth-aachen/v2.10+
Support v2.11.0, v2.10.1, v2.10.0
2 parents 2d199e0 + 4ebcc84 commit 41665bb

File tree

10 files changed

+78
-28
lines changed

10 files changed

+78
-28
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ DEFAULT_ARCH := $(shell dpkg --print-architecture)
2828
ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH))
2929

3030
# defaults
31-
DEFAULT_TF_VERSION := 2.9.3
32-
TF_VERSIONS := 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0
31+
DEFAULT_TF_VERSION := 2.11.0
32+
TF_VERSIONS := 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0
3333
DEFAULT_JOBS := $(shell nproc)
3434
DEFAULT_GPU := 1
3535
ifeq ($(ARCH), arm64)
@@ -130,15 +130,15 @@ clean-images: clean-official-devel-images clean-cpp-images clean-libtensorflow-c
130130
$(MAKEFILE_DIR)/scripts/$@.sh
131131

132132
.PHONY: 4-test-libtensorflow-cc
133-
4-test-libtensorflow-cc: 2-build-cpp-image
133+
4-test-libtensorflow-cc:
134134
$(MAKEFILE_DIR)/scripts/$@.sh
135135

136136
.PHONY: 5-print-versions
137-
5-print-versions: 2-build-cpp-image
137+
5-print-versions:
138138
$(MAKEFILE_DIR)/scripts/$@.sh
139139

140140
.PHONY: 6-push-image
141-
6-push-image: 2-build-cpp-image
141+
6-push-image:
142142
$(MAKEFILE_DIR)/scripts/$@.sh
143143

144144
# ----- MULTI VERSION RULES ----------------------------------------------------

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ docker run --rm \
4242
rwthika/tensorflow-cc:latest \
4343
./build-and-run.sh
4444

45-
# Hello from TensorFlow C++ 2.9.3!
45+
# Hello from TensorFlow C++ 2.11.0!
4646
#
4747
# A =
4848
# 1 2
@@ -65,16 +65,16 @@ The pre-built `libtensorflow_cc.so` library and accompanying headers are package
6565
#### GPU
6666

6767
```bash
68-
wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.9.3/libtensorflow-cc_2.9.3-gpu_$(dpkg --print-architecture).deb
69-
sudo dpkg -i libtensorflow-cc_2.9.3-gpu_$(dpkg --print-architecture).deb
68+
wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.11.0/libtensorflow-cc_2.11.0-gpu_$(dpkg --print-architecture).deb
69+
sudo dpkg -i libtensorflow-cc_2.11.0-gpu_$(dpkg --print-architecture).deb
7070
ldconfig
7171
```
7272

7373
#### CPU
7474

7575
```bash
76-
wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.9.3/libtensorflow-cc_2.9.3_$(dpkg --print-architecture).deb
77-
sudo dpkg -i libtensorflow-cc_2.9.3_$(dpkg --print-architecture).deb
76+
wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.11.0/libtensorflow-cc_2.11.0_$(dpkg --print-architecture).deb
77+
sudo dpkg -i libtensorflow-cc_2.11.0_$(dpkg --print-architecture).deb
7878
ldconfig
7979
```
8080

@@ -101,15 +101,18 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu
101101

102102
| TensorFlow Version | CPU/GPU | Architecture | Image:Tag |
103103
| :---: | :---: | :---: | --- |
104-
| 2.9.3 | GPU | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` |
105-
| 2.9.3 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` |
104+
| 2.11.0 | GPU | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` |
105+
| 2.11.0 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` |
106106

107107
<details>
108108
<summary><i>All TensorFlow Versions (GPU)</i></summary>
109109

110110
| TensorFlow Version | Architecture | Image:Tag |
111111
| :---: | :---: | --- |
112112
| latest | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` |
113+
| 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0-gpu` |
114+
| 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1-gpu` |
115+
| 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0-gpu` |
113116
| 2.9.3 | amd64, arm64 | `rwthika/tensorflow-cc:2.9.3-gpu` |
114117
| 2.9.2 | amd64, arm64 | `rwthika/tensorflow-cc:2.9.2-gpu` |
115118
| 2.9.1 | amd64 | `rwthika/tensorflow-cc:2.9.1-gpu` |
@@ -133,6 +136,9 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu
133136
| TensorFlow Version | Architecture | Image:Tag |
134137
| :---: | :---: | --- |
135138
| latest | amd64, arm64 | `rwthika/tensorflow-cc:latest` |
139+
| 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0` |
140+
| 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1` |
141+
| 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0` |
136142
| 2.9.3 | amd64, arm64 | `rwthika/tensorflow-cc:2.9.3` |
137143
| 2.9.2 | amd64, arm64 | `rwthika/tensorflow-cc:2.9.2` |
138144
| 2.9.1 | amd64 | `rwthika/tensorflow-cc:2.9.1` |
@@ -172,7 +178,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu
172178

173179
If you would like to build the deb-package and Docker images yourself, use the [`Makefile`](Makefile) as instructed below.
174180

175-
All `make` targets support the flags `TF_VERSION` (defaults to `2.9.3`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture.
181+
All `make` targets support the flags `TF_VERSION` (defaults to `2.11.0`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture.
176182

177183
All `make` targets listed below also have a counterpart named `<target>-all`, which can be used to build multiple TensorFlow versions one after the other using the `TF_VERSIONS` flag like so:
178184

@@ -236,6 +242,12 @@ make 5-print-versions
236242

237243
| Version | Architecture | Step 1 (CPU) | Step 2 (CPU) | Step 4 (CPU) | Step 1 (GPU) | Step 2 (GPU) | Step 4 (GPU) | Notes |
238244
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | --- |
245+
| 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
246+
| 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
247+
| 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
248+
| 2.10.1 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
249+
| 2.10.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
250+
| 2.10.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
239251
| 2.9.3 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
240252
| 2.9.3 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
241253
| 2.9.2 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
@@ -298,6 +310,12 @@ make 5-print-versions
298310

299311
| TensorFlow | Architecture | Ubuntu | GCC | Bazel | Python | protobuf | CUDA | cuDNN | TensorRT | GPU Compute Capability |
300312
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
313+
| 2.11.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
314+
| 2.11.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
315+
| 2.10.1 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
316+
| 2.10.1 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
317+
| 2.10.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
318+
| 2.10.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
301319
| 2.9.3 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
302320
| 2.9.3 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |
303321
| 2.9.2 | amd64 | 20.04 | 9.4.0 | 5.3.1 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 |

docker/Dockerfile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,28 @@
1919
# ==============================================================================
2020

2121
# --- build stage for building libtensorflow_cc --------------------------------
22+
ARG TARGETARCH
2223
ARG TF_VERSION=master
2324
ARG GPU_POSTFIX=-gpu
24-
ARG TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6
25-
ARG TARGETARCH
2625
FROM tensorflow/tensorflow:${TF_VERSION}-devel${GPU_POSTFIX}-${TARGETARCH} as build
2726

2827
ARG TARGETARCH
2928
ARG TF_VERSION
3029
ARG GPU_POSTFIX
31-
ARG TF_CUDA_COMPUTE_CAPABILITIES
32-
ARG JOBS="auto"
3330

3431
# clone TensorFlow
3532
RUN git clone --branch v${TF_VERSION} --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow
3633
WORKDIR /tensorflow
3734

38-
# fix build issue in v2.10.0
35+
# fix build issue in 2.10.0, 2.10.1
3936
# https://github.com/tensorflow/tensorflow/issues/57826
4037
RUN if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ]; then \
4138
git fetch --depth=1 origin b1bd1d6beeac169ce669f81dcbf3c48899ca1ed0 && \
4239
git checkout FETCH_HEAD -- tensorflow/BUILD; \
4340
fi
4441

4542
# configure compilation
43+
ARG TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6
4644
ENV PYTHON_BIN_PATH=/usr/bin/python3
4745
ENV PYTHON_LIB_PATH=/usr/lib/python3/dist-packages
4846
ENV TF_NEED_ROCM=0
@@ -54,15 +52,28 @@ ENV TF_SET_ANDROID_WORKSPACE=0
5452
RUN ./configure
5553

5654
# build C++ library
55+
# fix runtime issue in 2.10.0, 2.10.1, 2.11.0
56+
# https://github.com/tensorflow/tensorflow/issues/59081
57+
ARG JOBS="auto"
5758
RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \
58-
bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
59+
if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then \
60+
bazel build --jobs ${JOBS} --config=cuda --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
61+
else \
62+
bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
63+
fi; \
5964
else \
60-
bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
65+
if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then \
66+
bazel build --jobs ${JOBS} --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
67+
else \
68+
bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \
69+
fi; \
6170
fi
6271

6372
# move libtensorflow_cc to separate folder for easier Dockerfile COPY
6473
RUN mkdir bazel-bin/tensorflow/lib && \
6574
mv bazel-bin/tensorflow/libtensorflow_cc.so* bazel-bin/tensorflow/lib/ && \
75+
mv bazel-bin/tensorflow/libtensorflow_framework.so* bazel-bin/tensorflow/lib/ && \
76+
ln -s libtensorflow_framework.so.2 bazel-bin/tensorflow/lib/libtensorflow_framework.so && \
6677
rm bazel-bin/tensorflow/lib/*params
6778

6879
# build protobuf from source, same version as TensorFlow is using

docker/cmake/TensorFlowConfig.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ mark_as_advanced(INCLUDE_DIRS LIBRARY LIBRARY_FRAMEWORK)
4040
# set INCLUDE_DIRS and LIBRARIES
4141
if(TensorFlow_FOUND)
4242
set(TensorFlow_INCLUDE_DIRS ${INCLUDE_DIRS})
43-
set(TensorFlow_LIBRARIES ${LIBRARY} ${Protobuf_LIBRARY})
4443
if(LIBRARY_FRAMEWORK)
45-
string(APPEND TensorFlow_LIBRARIES ${LIBRARY_FRAMEWORK})
44+
set(TensorFlow_LIBRARIES ${LIBRARY} ${LIBRARY_FRAMEWORK} ${Protobuf_LIBRARY})
45+
else()
46+
set(TensorFlow_LIBRARIES ${LIBRARY} ${Protobuf_LIBRARY})
4647
endif()
47-
endif()
48+
endif()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
g++ -I /usr/local/include/tensorflow \
5+
hello_tensorflow.cpp \
6+
-ltensorflow_cc -lprotobuf \
7+
-o hello_tensorflow
8+
9+
./hello_tensorflow

example/build-and-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
g++ -I /usr/local/include/tensorflow \
55
hello_tensorflow.cpp \
6-
-ltensorflow_cc -lprotobuf \
6+
-ltensorflow_cc -ltensorflow_framework -lprotobuf \
77
-o hello_tensorflow
88

99
./hello_tensorflow

example/hello_tensorflow.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ int main(int argc, char **argv) {
4444

4545
// run graph and fetch outputs of A, x, and b
4646
vector<tensorflow::Tensor> outputs;
47-
session.Run({A, x, b}, &outputs);
47+
tensorflow::Status status = session.Run({A, x, b}, &outputs);
48+
if (!status.ok())
49+
throw std::runtime_error("Failed to run TensorFlow graph: " + status.ToString());
4850

4951
// print results
5052
cout << "Hello from TensorFlow C++ " << TF_VERSION_STRING << "!" << endl << endl;

scripts/.common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
set -e
2222
set -o pipefail
2323

24-
DEFAULT_TF_VERSION="2.9.3"
24+
DEFAULT_TF_VERSION="2.11.0"
2525
DEFAULT_JOBS=$(nproc)
2626
DEFAULT_GPU=1
2727
DEFAULT_ARCH=$(dpkg --print-architecture)

scripts/1-build-official-devel-image.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
source $(dirname "$0")/.common.sh
2323

2424
CPU_GPU_POSTFIX=${GPU_POSTFIX:--cpu}
25+
BUILD_DIR=${DOWNLOAD_DOCKERFILE_DIR}
26+
2527
if [ "$ARCH" = "amd64" ]; then
2628
DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/devel${CPU_GPU_POSTFIX}.Dockerfile
2729
elif [ "$ARCH" = "arm64" ]; then
@@ -32,7 +34,10 @@ elif [ "$ARCH" = "arm64" ]; then
3234
sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE
3335
fi
3436
fi
35-
BUILD_DIR=${DOWNLOAD_DOCKERFILE_DIR}
37+
38+
# replace sklearn (deprecated) with scikit-learn
39+
# https://pypi.org/project/sklearn/
40+
sed -i "s/sklearn/scikit-learn/" $DOCKERFILE
3641

3742
echo "Building ${IMAGE_DEVEL_ARCH} ... "
3843
docker build -t ${IMAGE_DEVEL_ARCH} -f ${DOCKERFILE} ${BUILD_DIR} | tee ${LOG_FILE}

scripts/4-test-libtensorflow-cc.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ source $(dirname "$0")/.common.sh
2323

2424
EXAMPLE_DIR=${REPOSITORY_DIR}/example
2525
EXAMPLE_MOUNT="/example"
26-
CMD="./build-and-run.sh"
26+
if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then
27+
CMD="./build-and-run.sh"
28+
else
29+
CMD="./build-and-run-monolithic.sh"
30+
fi
2731

2832
echo "Testing libtensorflow_cc in ${IMAGE_CPP} ... "
2933
if [[ "$GPU" == "1" && "$ARCH" = "amd64" ]]; then

0 commit comments

Comments
 (0)