Repository: tensorflow/serving (language: cpp)

Issue:
Issues Building Dockerfile.devel-mkl
I've encountered some trouble attempting to build Dockerfile.devel-mkl. 
I'm using tag 2.4.0
Build seems to be failing on this step: 
```
# Copy MKL libraries
RUN cp /root/.cache/bazel/_bazel_root/*/external/mkl_linux/lib/* /usr/local/lib
```
https://github.com/tensorflow/serving/blob/2.4.0/tensorflow_serving/tools/docker/Dockerfile.devel-mkl#L126

with error:
```bash
cannot stat '/root/.cache/bazel/_bazel_root/*/external/mkl_linux/lib/*': No such file or directory
```
I can't seem to find the produced lib files anywhere in the intermediate containers.

Any insight?


Discussion / hints:
@claynerobison -- can you help? you seem to be the maintainer of this docker file:

https://github.com/tensorflow/serving/blob/af33a247dae5486c712a5001845d06235e5b69d2/tensorflow_serving/tools/docker/Dockerfile.devel-mkl#L19


I also encountered the same issue in v2.4.0. 
It seemed that the compilation was successful, but the link library was actually missing.
Compile successfully after backing to v2.3.0.
Yeah v2.3.0 seems to work alright. Unfortunately its not a fix for me. I am attempting to migrate to v2.4.0 for other included bug fixes that prevent me from using v2.3.0. 
friendly bump
I don't have much idea. @claynerobison  or @penpornk (recent commit) would you help it out?
I think @claynerobison is the right person to ask. Also tagging @TensorFlow-MKL.
Hi, @dcyoung. Thanks for reporting this. With TF 2.4, we removed the dependency on the mkl binaries and build straight from source. We haven't ported that here yet, but will soon after we publish the Intel Optimizations for TF 2.4 binary set. Adding @ashahba (who should probably be the maintainer of this Dockerfile).
I'm looking in this issue now.
thanks for the update! Looking forward.

Fix patch:
diff --git a/.bazelrc b/.bazelrc
index a759ad92eec..88b734df61b 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -11,7 +11,7 @@ build:cuda --action_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_35,sm_50,sm_60,sm_70,sm
 # Please note that MKL on MacOS or windows is still not supported.
 # If you would like to use a local MKL instead of downloading, please set the
 # environment variable "TF_MKL_ROOT" every time before build.
-build:mkl --define=build_with_mkl=true --define=enable_mkl=true
+build:mkl --define=build_with_mkl=true --define=enable_mkl=true --define=build_with_openmp=true
 build:mkl --define=tensorflow_mkldnn_contraction_kernel=0
 
 # This config option is used to enable MKL-DNN open source library only,
diff --git a/tensorflow_serving/tools/docker/Dockerfile.devel-mkl b/tensorflow_serving/tools/docker/Dockerfile.devel-mkl
index 70c4c146f9e..bdad49a161a 100644
--- a/tensorflow_serving/tools/docker/Dockerfile.devel-mkl
+++ b/tensorflow_serving/tools/docker/Dockerfile.devel-mkl
@@ -16,7 +16,7 @@ FROM ubuntu:18.04 as base_build
 ARG TF_SERVING_VERSION_GIT_BRANCH=master
 ARG TF_SERVING_VERSION_GIT_COMMIT=HEAD
 
-LABEL maintainer="Clayne Robison <clayne.b.robison@intel.com>"
+LABEL maintainer="Abolfazl Shahbazi <abolfazl.shahbazi@intel.com>"
 LABEL tensorflow_serving_github_branchtag=${TF_SERVING_VERSION_GIT_BRANCH}
 LABEL tensorflow_serving_github_commit=${TF_SERVING_VERSION_GIT_COMMIT}
 
@@ -93,6 +93,7 @@ RUN curl -sSL --retry 5 https://github.com/tensorflow/serving/tarball/${TF_SERVI
 FROM base_build as binary_build
 # Build, and install TensorFlow Serving
 ARG TF_SERVING_BUILD_OPTIONS="--config=mkl --config=release"
+
 RUN echo "Building with build options: ${TF_SERVING_BUILD_OPTIONS}"
 ARG TF_SERVING_BAZEL_OPTIONS=""
 RUN echo "Building with Bazel options: ${TF_SERVING_BAZEL_OPTIONS}"
@@ -119,8 +120,8 @@ RUN bazel build --color=yes --curses=yes \
     /tmp/pip/tensorflow_serving_api-*.whl && \
     rm -rf /tmp/pip
 
-# Copy MKL libraries
-RUN cp /root/.cache/bazel/_bazel_root/*/external/mkl_linux/lib/* /usr/local/lib
+# Copy openmp libraries
+RUN cp /root/.cache/bazel/_bazel_root/*/execroot/tf_serving/bazel-out/k8-opt/bin/external/llvm_openmp/libiomp5.so /usr/local/lib/
 
 ENV LIBRARY_PATH '/usr/local/lib:$LIBRARY_PATH'
 ENV LD_LIBRARY_PATH '/usr/local/lib:$LD_LIBRARY_PATH'
diff --git a/tensorflow_serving/tools/docker/Dockerfile.mkl b/tensorflow_serving/tools/docker/Dockerfile.mkl
index 96a51bf6839..66e28c9bf5f 100644
--- a/tensorflow_serving/tools/docker/Dockerfile.mkl
+++ b/tensorflow_serving/tools/docker/Dockerfile.mkl
@@ -21,7 +21,7 @@ FROM ubuntu:18.04
 ARG TF_SERVING_VERSION_GIT_BRANCH=master
 ARG TF_SERVING_VERSION_GIT_COMMIT=head
 
-LABEL maintainer="Clayne Robison <clayne.b.robison@intel.com>"
+LABEL maintainer="Abolfazl Shahbazi <abolfazl.shahbazi@intel.com>"
 LABEL tensorflow_serving_github_branchtag=${TF_SERVING_VERSION_GIT_BRANCH}
 LABEL tensorflow_serving_github_commit=${TF_SERVING_VERSION_GIT_COMMIT}
 
@@ -36,8 +36,6 @@ COPY --from=build_image /usr/local/bin/tensorflow_model_server /usr/bin/tensorfl
 
 # Install MKL libraries
 COPY --from=build_image /usr/local/lib/libiomp5.so /usr/local/lib
-COPY --from=build_image /usr/local/lib/libmklml_gnu.so /usr/local/lib
-COPY --from=build_image /usr/local/lib/libmklml_intel.so /usr/local/lib
 
 ENV LIBRARY_PATH '/usr/local/lib:$LIBRARY_PATH'
 ENV LD_LIBRARY_PATH '/usr/local/lib:$LD_LIBRARY_PATH'


Test patch: