Skip to content

Commit 76e9e7e

Browse files
committed
update tensorflow serving to version 2.0.0
update main.cc and incorporate upstream changes update project workspace dependencies add debug docker image targets with busybox utils update bazel to version 2.0.0 remove legacy gcc based cross build bazel toolchain readme updates
1 parent 99e0429 commit 76e9e7e

File tree

19 files changed

+164
-568
lines changed

19 files changed

+164
-568
lines changed

Diff for: .bazelrc

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ build --verbose_failures
33

44
# enable proper toolchain resolution for cc rules
55
build --incompatible_enable_cc_toolchain_resolution
6+
# jpeg transient dep is using nocopts
7+
build --noincompatible_disable_nocopts
68

79
build --workspace_status_command=/proc/self/cwd/tools/wsc.sh
810

@@ -25,7 +27,6 @@ import %workspace%/third_party/tensorflow/.bazelrc
2527
build:linux_amd64 --platforms=//platforms:linux_amd64
2628

2729
build:linux_amd64_avx_sse4.2 --config=linux_amd64
28-
build:linux_amd64_avx_sse4.2 --platform_suffix=-linux_amd64_avx_sse4.2
2930
build:linux_amd64_avx_sse4.2 --copt=-mavx
3031
build:linux_amd64_avx_sse4.2 --copt=-msse4.2
3132

@@ -48,26 +49,21 @@ build:linux_arm64 --platforms=//platforms:linux_arm64
4849
build:linux_arm64 --copt=-march=armv8-a
4950

5051
build:linux_arm64_armv8-a --config=linux_arm64
51-
build:linux_arm64_armv8-a --platform_suffix=-linux_arm64_armv8-a
5252

5353
build:linux_arm64_armv8.2-a --config=linux_arm64
54-
build:linux_arm64_armv8.2-a --platform_suffix=-linux_arm64_armv8.2-a
5554
build:linux_arm64_armv8.2-a --copt=-march=armv8.2-a
5655

5756
# linux_arm
5857

5958
# linux_arm base config group. use this config when cross-building for
6059
# custom 32 bit arm targets (i.e. ones not defined here)
6160
build:linux_arm --config=common_arm
62-
build:linux_arm --cpu=armeabi
61+
build:linux_arm --cpu=arm
6362
build:linux_arm --platforms=//platforms:linux_arm
6463
build:linux_arm --copt=-march=armv7-a
65-
build:linux_arm --copt=-Wno-c++11-narrowing
6664

6765
build:linux_arm_armv7-a_neon_vfpv4 --config=linux_arm
68-
build:linux_arm_armv7-a_neon_vfpv4 --platform_suffix=-linux_arm_armv7-a_neon_vfpv4
6966
build:linux_arm_armv7-a_neon_vfpv4 --copt=-mfpu=neon-vfpv4
7067

7168
build:linux_arm_armv7-a_neon_vfpv3 --config=linux_arm
72-
build:linux_arm_armv7-a_neon_vfpv3 --platform_suffix=-linux_arm_armv7-a_neon_vfpv3
7369
build:linux_arm_armv7-a_neon_vfpv3 --copt=-mfpu=neon-vfpv3

Diff for: README.md

+36-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Docker Hub.
3333
Example
3434
```bash
3535
# on beaglebone black
36-
docker pull emacski/tensorflow-serving:1.15.0-linux_arm_armv7-a_neon_vfpv3
36+
docker pull emacski/tensorflow-serving:2.0.0-linux_arm_armv7-a_neon_vfpv3
3737
```
3838

3939
### Aliases
@@ -52,7 +52,7 @@ docker pull emacski/tensorflow-serving:1.15.0-linux_arm_armv7-a_neon_vfpv3
5252
Example
5353
```bash
5454
# on Raspberry PI 3 B+
55-
docker pull emacski/tensorflow-serving:1.15.0-linux_arm64
55+
docker pull emacski/tensorflow-serving:2.0.0-linux_arm64
5656
# or
5757
docker pull emacski/tensorflow-serving:latest-linux_arm64
5858
```
@@ -84,11 +84,40 @@ docker pull emacski/tensorflow-serving
8484
| <nobr>`emacski/tensorflow-serving:[Version]-linux_amd`</nobr> | `linux` | `amd64` |
8585

8686
Example
87-
```bash
87+
```sh
8888
# on Raspberry PI 3 B+
89-
docker pull emacski/tensorflow-serving:1.15.0
90-
# the actual image used is emacski/tensorflow-serving:1.15.0-linux_arm64
91-
# itself actually being emacski/tensorflow-serving:1.15.0-linux_arm64_armv8-a
89+
docker pull emacski/tensorflow-serving:2.0.0
90+
# the actual image used is emacski/tensorflow-serving:2.0.0-linux_arm64
91+
# itself actually being emacski/tensorflow-serving:2.0.0-linux_arm64_armv8-a
92+
```
93+
94+
### Debug Images
95+
96+
As of version 2.0.0, debug images are also built and published to docker hub.
97+
These images are identical to the non-debug images with the addition of busybox
98+
utils. The utils are located at `/busybox/bin` which is also included in the
99+
image `PATH` env variable.
100+
101+
For any image above, add `debug` after the `[Version]` and before the platform
102+
suffix (if one is required) in the image tag.
103+
104+
Examples
105+
```sh
106+
# multi-arch
107+
docker pull emacski/tensorflow-serving:2.0.0-debug
108+
# specific image
109+
docker pull emacski/tensorflow-serving:2.0.0-debug-linux_arm64_armv8-a
110+
# specific alias
111+
docker pull emacski/tensorflow-serving:latest-debug-linux_arm64
112+
```
113+
114+
```sh
115+
# start a new container with an interactive ash (busybox) shell
116+
docker run -ti --entrypoint /busybox/bin/sh emacski/tensorflow-serving:latest-debug-linux_arm64
117+
# with an interactive dash (system) shell
118+
docker run -ti --entrypoint sh emacski/tensorflow-serving:latest-debug-linux_arm64
119+
# start an interactive ash shell in a running debug container
120+
docker exec -ti my_running_container /busybox/bin/sh
92121
```
93122

94123
## Building from Source
@@ -149,7 +178,7 @@ bazel run //tensorflow_model_server:linux_arm_armv7-a_neon_vfpv4 --config=linux_
149178
to be available on the host automatically.
150179

151180
#### Build Project Binaries
152-
It's not recommended to use these binaries as standalne executables as they are built specifically to run in their respective containers.
181+
It's not recommended to use these binaries as standalone executables as they are built specifically to run in their respective containers.
153182
```bash
154183
bazel build //tensorflow_model_server --config=linux_amd64_avx_sse4.2
155184
bazel build //tensorflow_model_server --config=linux_arm64_armv8-a

Diff for: WORKSPACE

+21-19
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ http_archive(
4242
# https://github.com/bazelbuild/rules_docker
4343
http_archive(
4444
name = "io_bazel_rules_docker",
45-
sha256 = "14ac30773fdb393ddec90e158c9ec7ebb3f8a4fd533ec2abbfd8789ad81a284b",
46-
strip_prefix = "rules_docker-0.12.1",
47-
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.12.1/rules_docker-v0.12.1.tar.gz"],
45+
sha256 = "df13123c44b4a4ff2c2f337b906763879d94871d16411bf82dcfeba892b58607",
46+
strip_prefix = "rules_docker-0.13.0",
47+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.13.0/rules_docker-v0.13.0.tar.gz"],
4848
)
4949

5050
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repos = "repositories")
@@ -61,23 +61,24 @@ container_deps()
6161
http_archive(
6262
name = "org_tensorflow",
6363
patches = [
64+
"//third_party/tensorflow:BUILD.patch",
6465
"//third_party/tensorflow:curl.BUILD.patch",
6566
"//third_party/tensorflow:hwloc.BUILD.bazel.patch",
6667
],
67-
sha256 = "750186951a699cb73d6b440c7cd06f4b2b80fd3ebb00cbe00f655c7da4ae243e",
68-
strip_prefix = "tensorflow-590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b",
68+
sha256 = "b38de3408a4190246f2814dd7388cec72807b736fbcef5087e3b86a3f179bb0f",
69+
strip_prefix = "tensorflow-64c3d382cadf7bbe8e7e99884bede8284ff67f56",
6970
urls = [
70-
"https://github.com/tensorflow/tensorflow/archive/590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b.tar.gz",
71+
"https://github.com/tensorflow/tensorflow/archive/64c3d382cadf7bbe8e7e99884bede8284ff67f56.tar.gz",
7172
],
7273
)
7374

7475
# see tensorflow/serving/WORKSPACE
7576
http_archive(
7677
name = "io_bazel_rules_closure",
77-
sha256 = "ddce3b3a3909f99b28b25071c40b7fec7e2e1d1d1a4b2e933f3082aa99517105",
78-
strip_prefix = "rules_closure-316e6133888bfc39fb860a4f1a31cfcbae485aef",
78+
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
79+
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
7980
urls = [
80-
"https://github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz",
81+
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
8182
],
8283
)
8384

@@ -88,11 +89,11 @@ http_archive(
8889
patches = [
8990
"//third_party/tensorflow:nsync.BUILD.patch",
9091
],
91-
sha256 = "caf32e6b3d478b78cff6c2ba009c3400f8251f646804bcb65465666a9cea93c4",
92-
strip_prefix = "nsync-1.22.0",
92+
sha256 = "704be7f58afa47b99476bbac7aafd1a9db4357cef519db361716f13538547ffd",
93+
strip_prefix = "nsync-1.20.2",
9394
urls = [
94-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/nsync/archive/1.22.0.tar.gz",
95-
"https://github.com/google/nsync/archive/1.22.0.tar.gz",
95+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/nsync/archive/1.20.2.tar.gz",
96+
"https://github.com/google/nsync/archive/1.20.2.tar.gz",
9697
],
9798
)
9899

@@ -114,11 +115,12 @@ http_archive(
114115
name = "tf_serving",
115116
patches = [
116117
"//third_party/serving:apis.BUILD.patch",
118+
"//third_party/serving:oss.BUILD.patch",
117119
],
118-
sha256 = "4ad265afb5b7a5cfa38e374a6d7a2f8fcb25b5222ac0c413dbc04cd00a3499c0",
119-
strip_prefix = "serving-1.15.0",
120+
sha256 = "52e2dfed08c185d0fb9da9454063dac053f0889118b38e818b74631ea1b06ebe",
121+
strip_prefix = "serving-2.0.0",
120122
urls = [
121-
"https://github.com/tensorflow/serving/archive/1.15.0.tar.gz",
123+
"https://github.com/tensorflow/serving/archive/2.0.0.tar.gz",
122124
],
123125
)
124126

@@ -202,7 +204,7 @@ container_pull(
202204
)
203205

204206
container_pull(
205-
name = "discolix_cc_debug_linux_amd64",
207+
name = "discolix_cc_linux_amd64_debug",
206208
digest = "sha256:cdf4fd88dcc9cae6508084b50b7aa1e7834a065426b99989cebc6982de67db77",
207209
registry = "index.docker.io",
208210
repository = "discolix/cc",
@@ -220,7 +222,7 @@ container_pull(
220222
)
221223

222224
container_pull(
223-
name = "discolix_cc_debug_linux_arm64",
225+
name = "discolix_cc_linux_arm64_debug",
224226
digest = "sha256:f6e3d0c9b57c3924cab2f891e8f077f4f1390388fb3ca08eec5c85c7681ffcc2",
225227
registry = "index.docker.io",
226228
repository = "discolix/cc",
@@ -238,7 +240,7 @@ container_pull(
238240
)
239241

240242
container_pull(
241-
name = "discolix_cc_debug_linux_arm",
243+
name = "discolix_cc_linux_arm_debug",
242244
digest = "sha256:4fb7463db2391762742fcbf8acbf8a5e0c251b7aa2eb8f83cf4e626c907a0394",
243245
registry = "index.docker.io",
244246
repository = "discolix/cc",

Diff for: tensorflow_model_server/BUILD

+20-32
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
load("@bazel_skylib//lib:selects.bzl", "selects")
1615
load(
1716
"@io_bazel_rules_docker//container:container.bzl",
1817
"container_bundle",
@@ -77,26 +76,6 @@ config_setting(
7776
],
7877
)
7978

80-
config_setting(
81-
name = "debug",
82-
define_values = {"image": "debug"},
83-
)
84-
85-
selects.config_setting_group(
86-
name = "linux_arm_debug",
87-
match_all = [":linux_arm", ":debug"],
88-
)
89-
90-
selects.config_setting_group(
91-
name = "linux_arm64_debug",
92-
match_all = [":linux_arm64", ":debug"],
93-
)
94-
95-
selects.config_setting_group(
96-
name = "linux_amd64_debug",
97-
match_all = [":linux_amd64", ":debug"],
98-
)
99-
10079
container_layer(
10180
name = "dash",
10281
debs = select({
@@ -106,15 +85,12 @@ container_layer(
10685
}),
10786
)
10887

109-
container_image(
110-
name = "image",
88+
[container_image(
89+
name = "image" + suffix,
11190
base = select({
112-
":linux_arm": "@discolix_cc_linux_arm//image",
113-
":linux_arm64": "@discolix_cc_linux_arm64//image",
114-
":linux_amd64": "@discolix_cc_linux_amd64//image",
115-
":linux_arm_debug": "@discolix_cc_debug_linux_arm//image",
116-
":linux_arm64_debug": "@discolix_cc_debug_linux_arm64//image",
117-
":linux_amd64_debug": "@discolix_cc_debug_linux_amd64//image",
91+
":linux_arm": "@discolix_cc_linux_arm" + suffix + "//image",
92+
":linux_arm64": "@discolix_cc_linux_arm64" + suffix + "//image",
93+
":linux_amd64": "@discolix_cc_linux_amd64" + suffix + "//image",
11894
}),
11995
directory = "/usr/bin/",
12096
entrypoint = ["tf_serving_entrypoint.sh"],
@@ -132,11 +108,12 @@ container_image(
132108
"8501",
133109
],
134110
stamp = True,
135-
)
111+
) for suffix in ("", "_debug")]
136112

137-
# these targets only serve to give a project ":image" a fully qualified docker
138-
# image name and should always be accompanied by their respective config group like:
113+
# these targets only serve to generate publishable images with fully qualified docker
114+
# image names and should always be accompanied by their respective config group like:
139115
# bazel run //tensorflow_model_server:linux_arm64_armv8-a --config=linux_arm64_armv8-a
116+
140117
[container_bundle(
141118
name = tag,
142119
images = {"{PROJECT_REGISTRY_PREFIX}:{UPSTREAM_TFS_VERSION}-" + tag: ":image"},
@@ -147,3 +124,14 @@ container_image(
147124
"linux_arm64_armv8-a",
148125
"linux_amd64_avx_sse4.2",
149126
]]
127+
128+
[container_bundle(
129+
name = tag,
130+
images = {"{PROJECT_REGISTRY_PREFIX}:{UPSTREAM_TFS_VERSION}-" + tag: ":image_debug"},
131+
) for tag in [
132+
"debug-linux_arm_armv7-a_neon_vfpv4",
133+
"debug-linux_arm_armv7-a_neon_vfpv3",
134+
"debug-linux_arm64_armv8.2-a",
135+
"debug-linux_arm64_armv8-a",
136+
"debug-linux_amd64_avx_sse4.2",
137+
]]

Diff for: tensorflow_model_server/main.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ int main(int argc, char** argv) {
204204
}
205205

206206
if (display_version) {
207-
std::cout << "TensorFlow ModelServer: 1.15.0" << "\n"
207+
std::cout << "TensorFlow ModelServer: 2.0.0" << "\n"
208208
<< "TensorFlow Library: " << TF_Version() << "\n"
209-
<< "TFS_ARM Rev: 2 (" << cBUILD_SCM_REV_STAMP << ")\n";
209+
<< "TFS_ARM Rev: 1 (" << cBUILD_SCM_REV_STAMP << ")\n";
210210
return 0;
211211
}
212212

Diff for: tensorflow_model_server/tools/ci/bazel.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/bin/sh
22
# Copyright 2019 Erik Maciejewski
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");

Diff for: tensorflow_model_server/tools/ci/image_arch_fix.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/bin/sh
22
# Copyright 2019 Erik Maciejewski
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");

Diff for: tensorflow_model_server/tools/ci/publish.sh

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/bin/sh
22
# Copyright 2019 Erik Maciejewski
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -85,7 +85,27 @@ publish_platform_bundle "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION" "$GENER
8585
retag_platform_bundle "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION" "$PROJECT_REGISTRY_PREFIX:latest" "$GENERIC_PLATFORMS"
8686
publish_platform_bundle "$PROJECT_REGISTRY_PREFIX:latest" "$GENERIC_PLATFORMS"
8787

88-
# push any changes to the build image
88+
# debug images
89+
90+
for platform in $PROJECT_PLATFORMS; do
91+
image_prefix="$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug"
92+
# quick and dirty image arch metadata fix for arm images
93+
tensorflow_model_server/tools/ci/image_arch_fix.sh $image_prefix-$platform $platform
94+
docker push "$image_prefix-$platform"
95+
done
96+
97+
# debug aliases and manifest lists
98+
99+
docker tag "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_amd64_avx_sse4.2" "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_amd64"
100+
docker tag "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_arm64_armv8-a" "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_arm64"
101+
docker tag "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_arm_armv7-a_neon_vfpv4" "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug-linux_arm"
102+
103+
publish_platform_bundle "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug" "$GENERIC_PLATFORMS"
104+
105+
retag_platform_bundle "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-debug" "$PROJECT_REGISTRY_PREFIX:latest-debug" "$GENERIC_PLATFORMS"
106+
publish_platform_bundle "$PROJECT_REGISTRY_PREFIX:latest-debug" "$GENERIC_PLATFORMS"
107+
108+
# build image
89109
docker tag "$PROJECT_REGISTRY_PREFIX:latest-devel" "$PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-devel"
90110
docker push $PROJECT_REGISTRY_PREFIX:$UPSTREAM_TFS_VERSION-devel
91111
docker push $PROJECT_REGISTRY_PREFIX:latest-devel

Diff for: tensorflow_model_server/tools/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN apt-get update && \
3636
apt-get install -y zip unzip && \
3737
apt-get clean && \
3838
rm -rf /var/lib/apt/lists/*
39-
ENV INSTALL_BAZEL_VERSION=1.2.0
39+
ENV INSTALL_BAZEL_VERSION=2.0.0
4040
RUN curl -L https://github.com/bazelbuild/bazel/releases/download/${INSTALL_BAZEL_VERSION}/bazel-${INSTALL_BAZEL_VERSION}-installer-linux-x86_64.sh \
4141
-o bazel-${INSTALL_BAZEL_VERSION}-installer-linux-x86_64.sh && \
4242
chmod +x bazel-${INSTALL_BAZEL_VERSION}-installer-linux-x86_64.sh && \

Diff for: third_party/serving/oss.BUILD.patch

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--- tensorflow_serving/session_bundle/oss/BUILD 2020-01-05 18:48:02.876576508 -0800
2+
+++ oss.BUILD.new 2020-01-05 18:49:09.017713023 -0800
3+
@@ -1,4 +1,4 @@
4+
-load("@org_tensorflow//tensorflow/core:platform/default/build_config.bzl", "tf_proto_library")
5+
+load("@org_tensorflow//tensorflow/core/platform:default/build_config.bzl", "tf_proto_library")
6+
load("//tensorflow_serving:oss_or_google.bzl", "oss_only_cc_test")
7+
8+
licenses(["notice"]) # Apache 2.0

Diff for: third_party/tensorflow/.bazelrc

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ build --define=grpc_no_ares=true
77
build --define=use_fast_cpp_protos=true
88
build --define=allow_oversize_protos=true
99

10-
build:common_arm --copt=-DARM_NON_MOBILE
1110
build:common_arm --copt=-DRASPBERRY_PI
1211
build:common_arm --define=tensorflow_mkldnn_contraction_kernel=0
1312

@@ -20,7 +19,6 @@ build:linux_arm64 --define=CURL_SIZEOF_LONG=8
2019
build:linux_arm64 --define=HWLOC_SIZEOF_UNSIGNED_LONG=8
2120

2221
build:linux_arm --copt=-Wno-narrowing
23-
build:linux_arm --define=raspberry_pi_with_neon=true
2422
build:linux_arm --define=CURL_OS=arm-linux-gnueabihf
2523
build:linux_arm --define=CURL_SIZEOF_LONG=4
2624
build:linux_arm --define=HWLOC_SIZEOF_UNSIGNED_LONG=4

0 commit comments

Comments
 (0)