diff --git a/Dockerfile b/Dockerfile index e689bfdc0ae0e9ddffaf8c61dda288cbbbddc0d5..b2820e8d63e84d67b420f78e5e6510e4e9aa4d9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 //tensorflow:tensorflow_framework.so" +ARG BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package //tensorflow:libtensorflow_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,14 +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/ \ + && cp -P bazel-bin/tensorflow/libtensorflow_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* bazel-bin/tensorflow/tensorflow_framework.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/libtensorflow_framework.so* /tmp/tensorflow_pkg/tensorflow*.whl ) \ # Cleaning && rm -rf bazel-* /src/tf /root/.cache/ /tmp/* @@ -120,7 +120,8 @@ RUN cd /src/otb/build/OTB/build \ -Dtensorflow_include_dir=/opt/otbtf/include/tf \ # Forcing TF>=2, this Dockerfile hasn't been tested with v1 + missing link for libtensorflow_framework.so in the wheel -DTENSORFLOW_CC_LIB=/opt/otbtf/lib/libtensorflow_cc.so.2 \ - -DTENSORFLOW_FRAMEWORK_LIB=/opt/otbtf/lib/python3/site-packages/tensorflow/libtensorflow_framework.so.2 \ + #/opt/otbtf/lib/python3/site-packages/tensorflow/libtensorflow_framework.so.2 \ + -DTENSORFLOW_FRAMEWORK_LIB=/opt/otbtf/lib/libtensorflow_framework.so.2 \ && make install -j $(python -c "import os; print(round( os.cpu_count() * $CPU_RATIO ))") \ # Cleaning && ( $GUI || rm -rf /opt/otbtf/bin/otbgui* ) \