Skip to content

Instantly share code, notes, and snippets.

@masroorhasan
Last active November 6, 2020 03:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save masroorhasan/7508a405869af11c0a1b6994d59bb6d6 to your computer and use it in GitHub Desktop.
Save masroorhasan/7508a405869af11c0a1b6994d59bb6d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
USER=$1
TAG=$2
TF_SERVING_VERSION_GIT_BRANCH="r1.13"
git clone --branch="${TF_SERVING_VERSION_GIT_BRANCH}" https://github.com/tensorflow/serving
TF_SERVING_BUILD_OPTIONS="--copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2"
cd serving && \
docker build --pull -t $USER/tensorflow-serving-devel:$TAG \
--build-arg TF_SERVING_VERSION_GIT_BRANCH="${TF_SERVING_VERSION_GIT_BRANCH}" \
--build-arg TF_SERVING_BUILD_OPTIONS="${TF_SERVING_BUILD_OPTIONS}" \
-f tensorflow_serving/tools/docker/Dockerfile.devel .
cd serving && \
docker build -t $USER/tensorflow-serving:$TAG \
--build-arg TF_SERVING_BUILD_IMAGE=$USER/tensorflow-serving-devel:$TAG \
-f tensorflow_serving/tools/docker/Dockerfile .
@Mustufain
Copy link

HI, I used your bash script to build tf serving from source. However my build failed with the following error :
ERROR: /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/org_tensorflow/tensorflow/core/kernels/BUILD:3986:1: C++ compilation of rule '@org_tensorflow//tensorflow/core/kernels:conv_ops' failed (Exit 4): gcc failed: error executing command

gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-7/README.Bugs for instructions.
Target //tensorflow_serving/model_servers:tensorflow_model_server failed to build

I am using Mac OS 8 GB RAM.

@Arnold1
Copy link

Arnold1 commented Feb 14, 2020

@Mustufain were you able to fix your issue? how did you solve it? what are your settings for TF_SERVING_BUILD_OPTIONS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment