aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xconfigure77
-rw-r--r--tensorflow/core/common_runtime/mkl_cpu_allocator.h2
-rw-r--r--tensorflow/core/kernels/mkl_concat_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_conv_grad_bias_ops.cc4
-rw-r--r--tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc4
-rw-r--r--tensorflow/core/kernels/mkl_conv_grad_input_ops.cc4
-rw-r--r--tensorflow/core/kernels/mkl_conv_ops.cc4
-rw-r--r--tensorflow/core/kernels/mkl_fused_batch_norm_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_identity_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_lrn_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_matmul_op.cc2
-rw-r--r--tensorflow/core/kernels/mkl_relu_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_reshape_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_tfconv_op.cc4
-rw-r--r--tensorflow/core/kernels/mkl_transpose_op.cc2
-rw-r--r--tensorflow/core/util/mkl_util.h8
-rw-r--r--tensorflow/tools/lib_package/BUILD11
-rw-r--r--tensorflow/tools/pip_package/BUILD5
-rwxr-xr-xtensorflow/tools/pip_package/build_pip_package.sh41
-rw-r--r--tensorflow/workspace.bzl11
-rw-r--r--third_party/mkl/BUILD11
-rw-r--r--third_party/mkl/LICENSE201
-rw-r--r--third_party/mkl/mkl.BUILD22
24 files changed, 300 insertions, 139 deletions
diff --git a/.gitignore b/.gitignore
index bdcb067fc2..fdc61ee825 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,6 @@ node_modules
/.tf_configure.bazelrc
/bazel-*
/bazel_pip
-/third_party/eigen3/mkl_include
-/third_party/mkl/*
/tools/python_bin_path.sh
/tools/git/gen
/pip_test
diff --git a/configure b/configure
index 288674753b..cd957a06f8 100755
--- a/configure
+++ b/configure
@@ -217,84 +217,15 @@ done
OSNAME=`uname -s`
if [ "$TF_NEED_MKL" == "1" ]; then # TF_NEED_MKL
- while [ "$TF_DOWNLOAD_MKL" == "" ]; do
- fromuser=""
- read -p "Do you wish to download MKL LIB from the web? [Y/n] " INPUT
- fromuser="1"
- case $INPUT in
- [Yy]* ) TF_DOWNLOAD_MKL=1;;
- [Nn]* ) TF_DOWNLOAD_MKL=0;;
- "" ) TF_DOWNLOAD_MKL=1;;
- * ) echo "Invalid selection: " $INPUT; exit 1;;
- esac
- done
-
- if [[ "$TF_DOWNLOAD_MKL" == "1" ]]; then
- DST=`dirname $0`
- ARCHIVE_BASENAME=mklml_lnx_2018.0.20170425.tgz
- GITHUB_RELEASE_TAG=v0.7
- MKLURL="https://github.com/01org/mkl-dnn/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME"
- if ! [ -e "${DST}/third_party/mkl/${ARCHIVE_BASENAME}" ]; then
- curl -fSsL -o "${DST}/third_party/mkl/${ARCHIVE_BASENAME}" "${MKLURL}"
- fi
- tar -xzf $DST/third_party/mkl/$ARCHIVE_BASENAME -C $DST/third_party/mkl/
- extracted_dir_name="${ARCHIVE_BASENAME%.*}"
- MKL_INSTALL_PATH=$DST/third_party/mkl/$extracted_dir_name
- MKL_INSTALL_PATH=`${PYTHON_BIN_PATH} -c "import os; print(os.path.realpath(os.path.expanduser('${MKL_INSTALL_PATH}')))"`
-
- else
- default_mkl_path=/opt/intel/mklml
- fromuser=""
- if [ -z "$MKL_INSTALL_PATH" ]; then
- read -p "Please specify the location where MKL is installed. [Default is $default_mkl_path]: " MKL_INSTALL_PATH
- fromuser="1"
- fi
- if [ -z "$MKL_INSTALL_PATH" ]; then
- MKL_INSTALL_PATH=$default_mkl_path
- fi
- # Result returned from "read" will be used unexpanded. That make "~" unusable.
- # Going through one more level of expansion to handle that.
- MKL_INSTALL_PATH=`${PYTHON_BIN_PATH} -c "import os; print(os.path.realpath(os.path.expanduser('${MKL_INSTALL_PATH}')))"`
- fi
-
if [ "$OSNAME" == "Linux" ]; then
- # Full MKL configuration
- MKL_RT_LIB_PATH="lib/intel64/libmkl_rt.so" #${TF_MKL_EXT}#TODO version?
- MKL_RT_OMP_LIB_PATH="../compiler/lib/intel64/libiomp5.so" #TODO VERSION?
-
- # MKL-ML configuration
- MKL_ML_LIB_PATH="lib/libmklml_intel.so" #${TF_MKL_EXT}#TODO version?
- MKL_ML_OMP_LIB_PATH="lib/libiomp5.so" #TODO VERSION?
+ write_to_bazelrc 'build:mkl --define with_mkl_support=true'
+ write_to_bazelrc 'build:mkl -c opt'
+ write_to_bazelrc 'build:mkl --copt="-DEIGEN_USE_VML"'
+ echo "Add \"--config=mkl\" to your bazel command to build with MKL support."
elif [ "$OSNAME" == "Darwin" ]; then
echo "Darwin is unsupported yet";
exit 1
fi
-
- if [ -e "$MKL_INSTALL_PATH/${MKL_ML_LIB_PATH}" ]; then
- ln -sf $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/${MKL_ML_OMP_LIB_PATH} third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/include third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/include third_party/eigen3/mkl_include
- loc=$(locate -e libdl.so.2 | sed -n 1p)
- ln -sf $loc third_party/mkl/libdl.so.2
- elif [ -e "$MKL_INSTALL_PATH/${MKL_RT_LIB_PATH}" ]; then
- ln -sf $MKL_INSTALL_PATH/${MKL_RT_LIB_PATH} third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/${MKL_RT_OMP_LIB_PATH} third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/include third_party/mkl/
- ln -sf $MKL_INSTALL_PATH/include third_party/eigen3/mkl_include
- loc=$(locate -e libdl.so.2 | sed -n 1p)
- ln -sf $loc third_party/mkl/libdl.so.2
- else
- echo "ERROR: $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} nor $MKL_INSTALL_PATH/${MKL_RT_LIB_PATH} exists";
- exit 1
- fi
-
-cat > third_party/mkl/mkl.config <<EOF
-# MKL_INSTALL_PATH refers to the location of MKL root folder. The MKL header and library
-# files can be either in this directory, or under include/ and lib64/
-MKL_INSTALL_PATH=$MKL_INSTALL_PATH
-EOF
-
fi # TF_NEED_MKL
## End MKL setup
diff --git a/tensorflow/core/common_runtime/mkl_cpu_allocator.h b/tensorflow/core/common_runtime/mkl_cpu_allocator.h
index 41bf23be27..005aabf9b8 100644
--- a/tensorflow/core/common_runtime/mkl_cpu_allocator.h
+++ b/tensorflow/core/common_runtime/mkl_cpu_allocator.h
@@ -26,7 +26,7 @@ limitations under the License.
#include "tensorflow/core/framework/allocator.h"
#include "tensorflow/core/platform/mem.h"
-#include "third_party/mkl/include/i_malloc.h"
+#include "i_malloc.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_concat_op.cc b/tensorflow/core/kernels/mkl_concat_op.cc
index d8a8cc74bf..e6673b2ffb 100644
--- a/tensorflow/core/kernels/mkl_concat_op.cc
+++ b/tensorflow/core/kernels/mkl_concat_op.cc
@@ -29,8 +29,8 @@ limitations under the License.
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/types.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
#include "tensorflow/core/util/mkl_util.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_conv_grad_bias_ops.cc b/tensorflow/core/kernels/mkl_conv_grad_bias_ops.cc
index d4364d31e4..0f1a218fe6 100644
--- a/tensorflow/core/kernels/mkl_conv_grad_bias_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_grad_bias_ops.cc
@@ -39,8 +39,8 @@ limitations under the License.
#include "tensorflow/core/util/work_sharder.h"
#include "tensorflow/core/util/mkl_util.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc b/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
index ddcf241277..3b23c72f0f 100644
--- a/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
@@ -38,8 +38,8 @@ limitations under the License.
#include "tensorflow/core/util/work_sharder.h"
#include "tensorflow/core/util/mkl_util.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc b/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
index 23827ceea5..ef7338e0e0 100644
--- a/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
@@ -40,8 +40,8 @@ limitations under the License.
#include "tensorflow/core/util/tensor_format.h"
#include "tensorflow/core/util/use_cudnn.h"
#include "tensorflow/core/util/work_sharder.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_conv_ops.cc b/tensorflow/core/kernels/mkl_conv_ops.cc
index df49e03f31..135dd254a4 100644
--- a/tensorflow/core/kernels/mkl_conv_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_ops.cc
@@ -37,8 +37,8 @@ limitations under the License.
#include "tensorflow/core/util/tensor_format.h"
#include "tensorflow/core/util/mkl_util.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_fused_batch_norm_op.cc b/tensorflow/core/kernels/mkl_fused_batch_norm_op.cc
index d533536802..bc9e906c39 100644
--- a/tensorflow/core/kernels/mkl_fused_batch_norm_op.cc
+++ b/tensorflow/core/kernels/mkl_fused_batch_norm_op.cc
@@ -21,8 +21,8 @@ limitations under the License.
#include "tensorflow/core/framework/tensor_types.h"
#include "tensorflow/core/util/tensor_format.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
#include "tensorflow/core/util/mkl_util.h"
// TODO(inteltf) Address comments from PR 8968.
diff --git a/tensorflow/core/kernels/mkl_identity_op.cc b/tensorflow/core/kernels/mkl_identity_op.cc
index cb7ea7e7f9..ca20294a26 100644
--- a/tensorflow/core/kernels/mkl_identity_op.cc
+++ b/tensorflow/core/kernels/mkl_identity_op.cc
@@ -24,8 +24,8 @@ limitations under the License.
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/logging.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
#include "tensorflow/core/util/mkl_util.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_lrn_op.cc b/tensorflow/core/kernels/mkl_lrn_op.cc
index 07a7e6b5da..aa08e93924 100644
--- a/tensorflow/core/kernels/mkl_lrn_op.cc
+++ b/tensorflow/core/kernels/mkl_lrn_op.cc
@@ -31,8 +31,8 @@ limitations under the License.
#include "tensorflow/core/util/mkl_util.h"
#include "tensorflow/core/util/tensor_format.h"
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
#if !defined(IS_MOBILE_PLATFORM)
#include "tensorflow/core/util/work_sharder.h"
diff --git a/tensorflow/core/kernels/mkl_matmul_op.cc b/tensorflow/core/kernels/mkl_matmul_op.cc
index 16143191a3..47598f443f 100644
--- a/tensorflow/core/kernels/mkl_matmul_op.cc
+++ b/tensorflow/core/kernels/mkl_matmul_op.cc
@@ -25,7 +25,7 @@ limitations under the License.
#if defined(INTEL_MKL)
-#include "third_party/mkl/include/mkl_cblas.h"
+#include "mkl_cblas.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
diff --git a/tensorflow/core/kernels/mkl_relu_op.cc b/tensorflow/core/kernels/mkl_relu_op.cc
index fabecc39a8..86a77d769a 100644
--- a/tensorflow/core/kernels/mkl_relu_op.cc
+++ b/tensorflow/core/kernels/mkl_relu_op.cc
@@ -25,8 +25,8 @@ limitations under the License.
#include "tensorflow/core/platform/default/logging.h"
#include "tensorflow/core/util/mkl_util.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_reshape_op.cc b/tensorflow/core/kernels/mkl_reshape_op.cc
index 593aa3a2fd..b3763f17bc 100644
--- a/tensorflow/core/kernels/mkl_reshape_op.cc
+++ b/tensorflow/core/kernels/mkl_reshape_op.cc
@@ -24,8 +24,8 @@ limitations under the License.
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/logging.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
#include "tensorflow/core/util/mkl_util.h"
namespace tensorflow {
diff --git a/tensorflow/core/kernels/mkl_tfconv_op.cc b/tensorflow/core/kernels/mkl_tfconv_op.cc
index b4aae67ca6..c8e5df32ce 100644
--- a/tensorflow/core/kernels/mkl_tfconv_op.cc
+++ b/tensorflow/core/kernels/mkl_tfconv_op.cc
@@ -29,8 +29,8 @@ limitations under the License.
#include "tensorflow/core/util/tensor_format.h"
#include "tensorflow/core/util/mkl_util.h"
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
namespace tensorflow {
typedef Eigen::ThreadPoolDevice CPUDevice;
diff --git a/tensorflow/core/kernels/mkl_transpose_op.cc b/tensorflow/core/kernels/mkl_transpose_op.cc
index fcbf105f8f..50d25ac511 100644
--- a/tensorflow/core/kernels/mkl_transpose_op.cc
+++ b/tensorflow/core/kernels/mkl_transpose_op.cc
@@ -18,7 +18,7 @@ limitations under the License.
#ifdef INTEL_MKL
#define EIGEN_USE_THREADS
-#include "third_party/mkl/include/mkl_trans.h"
+#include "mkl_trans.h"
#include "tensorflow/core/kernels/transpose_functor.h"
#include "tensorflow/core/kernels/transpose_op.h"
diff --git a/tensorflow/core/util/mkl_util.h b/tensorflow/core/util/mkl_util.h
index 67468bdc3f..35aca709d9 100644
--- a/tensorflow/core/util/mkl_util.h
+++ b/tensorflow/core/util/mkl_util.h
@@ -20,10 +20,10 @@ limitations under the License.
#include <string>
#include <vector>
-#include "third_party/mkl/include/mkl_dnn.h"
-#include "third_party/mkl/include/mkl_dnn_types.h"
-#include "third_party/mkl/include/mkl_service.h"
-#include "third_party/mkl/include/mkl_trans.h"
+#include "mkl_dnn.h"
+#include "mkl_dnn_types.h"
+#include "mkl_service.h"
+#include "mkl_trans.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/util/tensor_format.h"
diff --git a/tensorflow/tools/lib_package/BUILD b/tensorflow/tools/lib_package/BUILD
index 9da5d5cb5b..6b2523d52b 100644
--- a/tensorflow/tools/lib_package/BUILD
+++ b/tensorflow/tools/lib_package/BUILD
@@ -4,6 +4,7 @@
package(default_visibility = ["//visibility:private"])
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+load("//third_party/mkl:build_defs.bzl", "if_mkl")
genrule(
name = "libtensorflow_proto",
@@ -104,7 +105,10 @@ genrule(
"@protobuf//:LICENSE",
"@snappy//:COPYING",
"@zlib_archive//:zlib.h",
- ],
+ ] + if_mkl([
+ "//third_party/mkl:LICENSE",
+ "@mkl//:LICENSE",
+ ]),
outs = ["include/tensorflow/c/LICENSE"],
cmd = "$(location :concat_licenses.sh) $(SRCS) >$@",
tools = [":concat_licenses.sh"],
@@ -135,7 +139,10 @@ genrule(
"@protobuf//:LICENSE",
"@snappy//:COPYING",
"@zlib_archive//:zlib.h",
- ],
+ ] + if_mkl([
+ "//third_party/mkl:LICENSE",
+ "@mkl//:LICENSE",
+ ]),
outs = ["include/tensorflow/jni/LICENSE"],
cmd = "$(location :concat_licenses.sh) $(SRCS) >$@",
tools = [":concat_licenses.sh"],
diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD
index 442b335be5..bffa870d32 100644
--- a/tensorflow/tools/pip_package/BUILD
+++ b/tensorflow/tools/pip_package/BUILD
@@ -126,7 +126,10 @@ filegroup(
"@snappy//:COPYING",
"@zlib_archive//:zlib.h",
"@org_python_pypi_backports_weakref//:LICENSE",
- ] + if_not_windows([
+ ] + if_mkl([
+ "//third_party/mkl:LICENSE",
+ "@mkl//:LICENSE",
+ ]) + if_not_windows([
"@nccl_archive//:LICENSE.txt",
]) + tf_additional_license_deps(),
)
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
index 8b9a6b3de0..a158fd7345 100755
--- a/tensorflow/tools/pip_package/build_pip_package.sh
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -79,23 +79,6 @@ function main() {
bazel-bin/tensorflow/tools/pip_package/simple_console_for_window_unzip/runfiles \
"${TMPDIR}/external"
RUNFILES=bazel-bin/tensorflow/tools/pip_package/simple_console_for_window_unzip/runfiles/org_tensorflow
- elif [ ! -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow ]; then
- # Really old (0.2.1-) runfiles, without workspace name.
- cp -R \
- bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/tensorflow \
- "${TMPDIR}"
- mkdir "${TMPDIR}/external"
- cp_external \
- bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/external \
- "${TMPDIR}/external"
- RUNFILES=bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles
- # Copy MKL libs over so they can be loaded at runtime
- if [ -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl ]; then
- mkdir "${TMPDIR}/_solib_k8"
- cp -R \
- bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl \
- "${TMPDIR}/_solib_k8"
- fi
else
if [ -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/external ]; then
# Old-style runfiles structure (--legacy_external_runfiles).
@@ -107,11 +90,13 @@ function main() {
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/external \
"${TMPDIR}/external"
# Copy MKL libs over so they can be loaded at runtime
- if [ -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl ]; then
- mkdir "${TMPDIR}/_solib_k8"
- cp -R \
- bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl \
- "${TMPDIR}/_solib_k8"
+ so_lib_dir="bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8"
+ if [ -d ${so_lib_dir} ]; then
+ mkl_so_dir=$(ls ${so_lib_dir} | grep mkl)
+ if [ $? -eq 0 ]; then
+ mkdir "${TMPDIR}/_solib_k8"
+ cp -R ${so_lib_dir}/${mkl_so_dir} "${TMPDIR}/_solib_k8"
+ fi
fi
else
# New-style runfiles structure (--nolegacy_external_runfiles).
@@ -124,11 +109,13 @@ function main() {
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles \
"${TMPDIR}/external"
# Copy MKL libs over so they can be loaded at runtime
- if [ -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl ]; then
- mkdir "${TMPDIR}/_solib_k8"
- cp -R \
- bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cintel_Ubinary_Ublob___Uthird_Uparty_Smkl \
- "${TMPDIR}/_solib_k8"
+ so_lib_dir="bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/_solib_k8"
+ if [ -d ${so_lib_dir} ]; then
+ mkl_so_dir=$(ls ${so_lib_dir} | grep mkl)
+ if [ $? -eq 0 ]; then
+ mkdir "${TMPDIR}/_solib_k8"
+ cp -R ${so_lib_dir}/${mkl_so_dir} "${TMPDIR}/_solib_k8"
+ fi
fi
fi
RUNFILES=bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 4760673058..42d2ebc3fe 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -172,6 +172,17 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
)
native.new_http_archive(
+ name = "mkl",
+ urls = [
+ "http://mirror.bazel.build/github.com/01org/mkl-dnn/releases/download/v0.7/mklml_lnx_2018.0.20170425.tgz",
+ "https://github.com/01org/mkl-dnn/releases/download/v0.7/mklml_lnx_2018.0.20170425.tgz",
+ ],
+ sha256 = "3cc2501fb209e1fd0960a5f61c919438f9619c68a644dcebf0fdf69b07460c57",
+ strip_prefix = "mklml_lnx_2018.0.20170425",
+ build_file = str(Label("//third_party/mkl:mkl.BUILD")),
+ )
+
+ native.new_http_archive(
name = "ortools_archive",
urls = [
"http://mirror.bazel.build/github.com/google/or-tools/archive/253f7955c6a1fd805408fba2e42ac6d45b312d15.tar.gz",
diff --git a/third_party/mkl/BUILD b/third_party/mkl/BUILD
index 8c86766eff..b27d341404 100644
--- a/third_party/mkl/BUILD
+++ b/third_party/mkl/BUILD
@@ -1,4 +1,6 @@
-licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like TODO
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE"])
config_setting(
name = "using_mkl",
@@ -16,10 +18,9 @@ load(
cc_library(
name = "intel_binary_blob",
srcs = if_mkl([
- "libdl.so.2",
- "libmklml_intel.so",
- "libiomp5.so",
+ "@mkl//:libmklml_intel.so",
+ "@mkl//:libiomp5.so",
]),
- includes = ["."],
visibility = ["//visibility:public"],
+ deps = ["@mkl//:mkl_headers"],
)
diff --git a/third_party/mkl/LICENSE b/third_party/mkl/LICENSE
new file mode 100644
index 0000000000..9c8f3ea087
--- /dev/null
+++ b/third_party/mkl/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. \ No newline at end of file
diff --git a/third_party/mkl/mkl.BUILD b/third_party/mkl/mkl.BUILD
new file mode 100644
index 0000000000..37daa52419
--- /dev/null
+++ b/third_party/mkl/mkl.BUILD
@@ -0,0 +1,22 @@
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE"])
+
+cc_library(
+ name = "mkl_headers",
+ srcs = glob(["include/*"]),
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "libmklml_intel.so",
+ srcs = ["lib/libmklml_intel.so"],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "libiomp5.so",
+ srcs = ["lib/libiomp5.so"],
+ visibility = ["//visibility:public"],
+)