【发布时间】:2021-01-19 13:30:42
【问题描述】:
我正在使用 bazel 构建 tensorflow 和 tensorflow/serving,通常当我使用 bazel 构建 tensorflow/serving 时,bazel 会在 bazel-bin/tensorflow_serving/core/ 中为我生成一些静态库。
比如我成功构建tensorflow/serving后,得到bazel-bin/tensorflow_serving/core/libaspired_version_policy.a等等。
但是在另一个 docker 实例上构建 tensorflow/serving 时情况发生了变化,在 bazel-bin/tensorflow_serving/core/ 下我只有 _objs,没有静态库了,怎么会?
我应该怎么做才能获得这些静态库?
这是我的 Dockerfile:
FROM tensorflow/tensorflow:1.15.5-py3
LABEL version="1.0.0"
WORKDIR /root/
ENV TMP=/tmp
RUN export https_proxy=http://220.181.102.178:8118 && \
export http_proxy=http://220.181.102.178:8118
RUN ln -s /usr/local/bin/gfortran /usr/bin/gfortran
RUN apt-get update -yq ; exit 0
RUN apt-get install -yq software-properties-common apt-utils && apt-get update -yq; exit 0
RUN apt-get install -yq vim tree clang gdb make git
RUN apt-get install -yq automake bison flex libboost-all-dev libevent-dev
RUN apt-get install -yq libssl-dev ssh libtool pkg-config
RUN apt-get install -yq default-jdk default-jre libunwind8-dev libc-ares-dev
RUN apt-get install -yq python-numpy python-future libleveldb-dev libsnappy-dev libgoogle-perftools-dev
RUN apt-get install -yq librdkafka-dev libapr1-dev libaprutil1-dev texinfo unzip zip
RUN unset TF_NEED_CUDA
## To install go, uncomment below
#RUN add-apt-repository ppa:longsleep/golang-backports -y
#RUN apt-get install -yq golang-go
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y
RUN apt-get install -yq gcc-8 g++-8
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 \
--slave /usr/bin/g++ g++ /usr/bin/g++-8 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8
RUN export https_proxy=http://220.181.102.178:8118 && wget https://github.com/Kitware/CMake/releases/download/v3.18.5/cmake-3.18.5-Linux-x86_64.sh && \
bash cmake-3.18.5-Linux-x86_64.sh --prefix=/usr/ --skip-license && \
rm -rf cmake-3.18.5-Linux-x86_64.sh
RUN export https_proxy=http://220.181.102.178:8118 && wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh && \
bash bazel-0.24.1-installer-linux-x86_64.sh && rm -rf bazel-0.24.1-installer-linux-x86_64.sh
RUN mkdir .ssh/
ADD .ssh/ .ssh/
ADD .vimrc .
ADD .bashrc .
RUN export PATH=/usr/local/cuda/bin:$PATH && export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
RUN git config --global credential.helper store
bazel 版本:0.24.1
tensorflow/serving 版本:从 github 发布页面下载的 1.15.0。
构建命令:
export https_proxy=http://10.130.48.179:3128
unset TF_NEED_CUDA
# Build tensorflow_model_server
bazel build -c opt --copt=-msse4.1 --copt=-msse4.2 --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-O3 --copt=-march=native --cxxopt="-fexceptions" --verbose_failures //tensorflow_serving/model_servers:tensorflow_model_server
请帮忙。谢谢。
【问题讨论】:
标签: tensorflow bazel tensorflow-serving