diff options
author | Xiaoming (Jason) Cui <xiaoming.cui@intel.com> | 2018-09-25 00:42:42 -0700 |
---|---|---|
committer | Xiaoming (Jason) Cui <xiaoming.cui@intel.com> | 2018-09-28 12:23:18 -0700 |
commit | b5feceb9058e06eac3de86ec45c44f5637054855 (patch) | |
tree | 08d828f1033dacec9d476a3b9a5b88c3af13622d /tensorflow/core/graph | |
parent | 986193d79e00f1780fb3278ed890a72f7285f66e (diff) |
Added the feature to disable MKL support of TensorFlow by environmental variable TF_DISABLE_MKL=1
Diffstat (limited to 'tensorflow/core/graph')
-rw-r--r-- | tensorflow/core/graph/mkl_layout_pass.cc | 5 | ||||
-rw-r--r-- | tensorflow/core/graph/mkl_tfconversion_pass.cc | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tensorflow/core/graph/mkl_layout_pass.cc b/tensorflow/core/graph/mkl_layout_pass.cc index 06d3fefef1..7394b1cddf 100644 --- a/tensorflow/core/graph/mkl_layout_pass.cc +++ b/tensorflow/core/graph/mkl_layout_pass.cc @@ -38,6 +38,7 @@ limitations under the License. #include "tensorflow/core/lib/hash/hash.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/util/tensor_format.h" +#include "tensorflow/core/util/util.h" #include "tensorflow/core/graph/mkl_graph_util.h" #include "tensorflow/core/graph/mkl_layout_pass.h" @@ -4511,6 +4512,10 @@ Status MklLayoutRewritePass::Run(const GraphOptimizationPassOptions& options) { if (options.graph == nullptr && options.partition_graphs == nullptr) { return Status::OK(); } + if (DisableMKL()) { + VLOG(2) << "TF-MKL: Disabling MKL"; + return Status::OK(); + } auto process_graph = [&](std::unique_ptr<Graph>* g) { // Get the ownership of a graph diff --git a/tensorflow/core/graph/mkl_tfconversion_pass.cc b/tensorflow/core/graph/mkl_tfconversion_pass.cc index 8c5ffd71a3..6804ab84ce 100644 --- a/tensorflow/core/graph/mkl_tfconversion_pass.cc +++ b/tensorflow/core/graph/mkl_tfconversion_pass.cc @@ -31,6 +31,7 @@ limitations under the License. #include "tensorflow/core/lib/gtl/map_util.h" #include "tensorflow/core/lib/hash/hash.h" #include "tensorflow/core/platform/logging.h" +#include "tensorflow/core/util/util.h" #include "tensorflow/core/graph/mkl_graph_util.h" #include "tensorflow/core/graph/mkl_tfconversion_pass.h" @@ -424,6 +425,10 @@ Status MklToTfConversionPass::Run(const GraphOptimizationPassOptions& options) { if (options.graph == nullptr && options.partition_graphs == nullptr) { return Status::OK(); } + if (DisableMKL()) { + VLOG(2) << "TF-MKL: Disabling MKL"; + return Status::OK(); + } auto process_graph = [&](std::unique_ptr<Graph>* g) { // Get the ownership of graph |