Commit b1da6cc0 authored by Narcon Nicolas's avatar Narcon Nicolas
Browse files

WIP: try to add libtensorflow_framework to build

parent 4abb16a4
No related merge requests found
Showing with 3 additions and 2 deletions
+3 -2
......@@ -46,7 +46,7 @@ RUN wget -qO /opt/otbtf/bin/bazelisk https://github.com/bazelbuild/bazelisk/rele
&& chmod +x /opt/otbtf/bin/bazelisk \
&& ln -s /opt/otbtf/bin/bazelisk /opt/otbtf/bin/bazel
ARG BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package"
ARG BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package //tensorflow:tensorflow_framework.so"
# "--config=opt" will enable 'march=native' (otherwise read comments about CPU compatibilty and edit CC_OPT_FLAGS in build-env-tf.sh)
ARG BZL_CONFIGS="--config=nogcp --config=noaws --config=nohdfs --config=opt"
# "--compilation_mode opt" is already enabled by default (see tf repo .bazelrc and configure.py)
......@@ -71,13 +71,14 @@ RUN git clone --single-branch -b $TF https://github.com/tensorflow/tensorflow.gi
&& pip3 install --no-cache-dir --prefix=/opt/otbtf /tmp/tensorflow_pkg/tensorflow*.whl \
&& ln -s /opt/otbtf/lib/python3.* /opt/otbtf/lib/python3 \
&& cp -P bazel-bin/tensorflow/libtensorflow_cc.so* /opt/otbtf/lib/ \
&& cp -P bazel-bin/tensorflow/tensorflow_framework.so* /opt/otbtf/lib/ \
&& ln -s $(find /opt/otbtf -type d -wholename "*/site-packages/tensorflow/include") /opt/otbtf/include/tf \
# The only missing header in the wheel
&& cp tensorflow/cc/saved_model/tag_constants.h /opt/otbtf/include/tf/tensorflow/cc/saved_model/ \
# Symlink external libs (required for MKL - libiomp5)
&& for f in $(find -L /opt/otbtf/include/tf -wholename "*/external/*/*.so"); do ln -s $f /opt/otbtf/lib/; done \
# Compress and save TF binaries
&& ( ! $ZIP_TF_BIN || zip -9 -j --symlinks /opt/otbtf/tf-$TF.zip tensorflow/cc/saved_model/tag_constants.h bazel-bin/tensorflow/libtensorflow_cc.so* /tmp/tensorflow_pkg/tensorflow*.whl ) \
&& ( ! $ZIP_TF_BIN || zip -9 -j --symlinks /opt/otbtf/tf-$TF.zip tensorflow/cc/saved_model/tag_constants.h bazel-bin/tensorflow/libtensorflow_cc.so* bazel-bin/tensorflow/tensorflow_framework.so* /tmp/tensorflow_pkg/tensorflow*.whl ) \
# Cleaning
&& rm -rf bazel-* /src/tf /root/.cache/ /tmp/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment