Skip to content

Commit d668303

Browse files
committed
minor readme and publish.sh updates
publish.sh now uses upstream tf serving version from wsc.sh add arm arch variant to manifest fix up arm image metadata
1 parent 5acbb77 commit d668303

File tree

3 files changed

+62
-15
lines changed

3 files changed

+62
-15
lines changed

Diff for: README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
TensorFlow Serving on ARM
22
=========================
33

4-
TensorFlow Serving cross-compile project targeting linux on common ARM cores from
5-
a linux x86_64 host.
4+
TensorFlow Serving cross-compile project targeting linux on common arm cores from
5+
a linux amd64 (x86_64) host.
66

77
## Overview
88

99
**Upstream Project:** [tensorflow/serving](https://github.com/tensorflow/serving)
1010

1111
This project is basically a giant build wrapper around [tensorflow/serving](https://github.com/tensorflow/serving)
12-
with the intention of making it easy to cross-build the project targeting common
13-
linux arm platforms. A set of docker images are also maintained that support some
14-
of the most popular linux arm platforms.
12+
with the intention of making it easy to cross-build CPU optimized model server
13+
docker images targeting common linux arm platforms. Additonally, a set of built
14+
images is also maintained for some of the most popular linux arm platforms on
15+
Docker Hub.
1516

1617
## The Docker Images
1718

18-
**Hosted on DockerHub:** [emacski/tensorflow-serving](https://hub.docker.com/r/emacski/tensorflow-serving)
19+
**Hosted on Docker Hub:** [emacski/tensorflow-serving](https://hub.docker.com/r/emacski/tensorflow-serving)
1920

2021
### Images
2122

@@ -166,9 +167,9 @@ For `linux_arm` options see: https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/ARM-Op
166167

167168
Example building an image tuned for Cortex-A72
168169
```bash
169-
bazel build //tensorflow_model_server:image --config=linux_arm64 \
170+
bazel build //tensorflow_model_server:image.tar --config=linux_arm64 \
170171
--copt=-mtune=cortex-a72
171-
# resulting image tar: bazel-bin/tensorflow_model_server/image-layer.tar
172+
# resulting image tar: bazel-bin/tensorflow_model_server/image.tar
172173
```
173174

174175
## Disclaimer

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

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env sh
2+
# Copyright 2019 Erik Maciejewski
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# quick and dirty script to fix image arch in configs
17+
# note this sript relies on jq (apt-get install jq)
18+
19+
set -e
20+
21+
work_dir=".image_arch_fix"
22+
image=$1
23+
platform=$2
24+
25+
os="$(echo $platform | cut -d '_' -f1)"
26+
arch="$(echo $platform | cut -d '_' -f2)"
27+
28+
mkdir -p $work_dir
29+
cd $work_dir
30+
docker save $image -o image.tar
31+
tar -xvf image.tar
32+
rm image.tar
33+
config=$(jq -r '.[0].Config' manifest.json)
34+
sed -i "s/amd64/$arch/g" $config
35+
tar -cvf image.tar .
36+
docker load -i image.tar
37+
cd ..
38+
rm -rf $work_dir

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

+15-7
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,14 @@
1515

1616
set -e
1717

18-
if [ -z "$1" ]; then
19-
echo "error: version must be specified"
20-
exit 1
21-
fi
22-
23-
UPSTREAM_TFS_VERSION="$1"
18+
# this script must be run in the top-level project dir
2419

2520
if [ -z "$PROJECT_REGISTRY_PREFIX" ]; then
2621
PROJECT_REGISTRY_PREFIX="emacski/tensorflow-serving"
2722
fi
2823

24+
UPSTREAM_TFS_VERSION=$(echo -n $(./tools/wsc.sh | head -n 1 | cut -d ' ' -f 2))
25+
2926
PROJECT_PLATFORMS="linux_amd64_avx_sse4.2 linux_arm64_armv8-a linux_arm64_armv8.2-a linux_arm_armv7-a_neon_vfpv3 linux_arm_armv7-a_neon_vfpv4"
3027

3128
GENERIC_PLATFORMS="linux_amd64 linux_arm64 linux_arm"
@@ -41,6 +38,10 @@ publish_platform_bundle() {
4138
local manifest=$1; local platforms="$2"
4239
# push platform image bundle
4340
for platform in $platforms; do
41+
# quick and dirty image arch metadata fix for arm images
42+
if [ $platform = "linux_arm64" ] || [ $platform = "linux_arm" ]; then
43+
tensorflow_model_server/tools/ci/image_arch_fix.sh $manifest-$platform $platform
44+
fi
4445
docker push $manifest-$platform
4546
done
4647
# create and push manifest for arch image bundle
@@ -52,7 +53,14 @@ publish_platform_bundle() {
5253
for platform in $platforms; do
5354
os="$(echo $platform | cut -d '_' -f1)"
5455
arch="$(echo $platform | cut -d '_' -f2)"
55-
docker manifest annotate --arch $arch --os $os $manifest $manifest-$platform
56+
if_variant=""
57+
if [ $arch = "arm64" ]; then
58+
if_variant="--variant v8"
59+
fi
60+
if [ $arch = "arm" ]; then
61+
if_variant="--variant v7"
62+
fi
63+
docker manifest annotate --arch $arch $if_variant --os $os $manifest $manifest-$platform
5664
done
5765
docker manifest push --purge $manifest
5866
}

0 commit comments

Comments
 (0)