Intel® Optimization for TensorFlow* Installation Guide

TensorFlow* is a predominantly-used machine learning framework in the deep learning arena, demanding efficient utilization of computational resources. In order to take full advantage of Intel® architecture and to extract maximum performance, the TensorFlow framework has been optimized using Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) primitives, a popular performance library for deep learning applications.

For more information on the optimizations as well as performance data, see this blog post TensorFlow* Optimizations on Modern Intel® Architecture .

Anaconda* has now made it convenient for the AI community to enable high-performance-computing in TensorFlow library. Starting from TensorFlow v1.9, Anaconda has and will continue to build TensorFlow using Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) primitives to deliver maximum performance in your CPU. If you are using conda package manager to manage your environments and packages, all you have to do is just install the TensorFlow package from into your virtual environments.

Additionally, Intel® Optimization for latest TensorFlow* version is distributed as Wheels and Docker images for Python 2.7, 3.5 and 3.6.

Install the latest Intel® Optimization for TensorFlow* from Anaconda* Cloud

TensorFlow* version: 1.9

Installation instructions:

Open Anaconda prompt and use the following instruction

conda install tensorflow

In case your anaconda channel is not the highest priority channel by default(or you are not sure), use the following command to make sure you get the right TensorFlow with Intel optimizations

conda install -c anaconda tensorflow

Besides the install method described above, Intel Optimization for TensorFlow is distributed as wheels, docker images and conda package on Intel channel. Follow one of the installation procedures to get Intel-optimized TensorFlow.

Install the latest Intel® Optimization for TensorFlow* from Intel Channel

TensorFlow* version: 1.9

Installation instructions:

Open Anaconda prompt and use the following instruction. Available for Python 2.7 and 3.6.

conda install tensorflow -c intel

Install the Intel® Optimization for TensorFlow* Wheel Into an Existing Python* Installation Through PIP

Available for Linux* OS

TensorFlow version: 1.9.0

Installation instructions:

Run the below instructions to install the wheel into an existing Python* installation, preferably Intel® Distribution for Python*:

# Python 2.7
pip install

# Python 3.5
pip install

# Python 3.6
pip install

Edit 08/07/18: Wheel paths have been updated to 1.9.0

Warning on ISA above AVX2:

"The TensorFlow library was not compiled to use <Instruction set> instructions, but these are available on your machine and could speed up CPU computations."

This warning can be ignored since Intel MKL-DNN library with which the TensorFlow is compiled utilizes the latest Instruction sets available in your processor to perform compute-intensive operations.

Older CPUs may not support this version of TensorFlow and may result in "Illegal instruction (core dumped)" error.

Install the Intel® Optimization for TensorFlow* Docker Images Into an Existing Python* Installation

Obtaining and Running the Containers

These docker images are all published at in theintelaipg/intel-optimized-tensorflow namespace and can be pulled with the following command:


$ docker pull<tag>


For example, to run the python 2.7 data science container directly, simply

$ docker run -it -p 8888:8888 intelaipg/intel-optimized-tensorflow

And then go to your browser on http://localhost:8888/

Available Container Configurations 

The following tags/configurations are available:

Docker Container Configurations
Python 2.7 with jupyter and sample notebooks




Python 3.5 with jupyter and sample notebooks




Python 2.7 with TensorFlow development toolchain




Python 2.7 with TensorFlow development toolchain




To get the latest Release Notes on Intel-optimized Tensorflow, please refer this article

Build TensorFlow from Source with Intel® MKL

Building TensorFlow from source is not recommended. However, if instructions provided above do not work due to unsupported ISA, you can always build from source.

Building TensorFlow from source code requires Bazel installation, refer to the instructions here, Installing Bazel.

Installation instructions:

  1. Run "./configure" from the TensorFlow source directory
  2. Execute the following commands to create a pip package that can be used to install the optimized TensorFlow build.
    • PATH can be changed to point to a specific version of GCC compiler:
      export PATH=/PATH//bin:$PATH
    • LD_LIBRARY_PATH can also be to new:
    • Set the flag to build TensorFlow with Intel® Math Kernel Library (Intel® MKL) and pass appropriate Instruction sets you want to compile the library with: 

Flags set in the command below will add AVX, AVX2 and AVX512 instructions which will result in "illegal instruction" errors when you use older CPUs. If you want to build on older CPUs, set the instruction flags accordingly

bazel build --config=mkl -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mavx512f --copt=-mavx512pf --copt=-mavx512cd --copt=-mavx512er //tensorflow/tools/pip_package:build_pip_package

        3. Install the optimized TensorFlow wheel

     bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/path_to_save_wheel
     pip install --upgrade --user ~/path_to_save_wheel /<wheel_name.whl>

Archived Wheels


Wheels(2.7, 3.5, 3.6)






For more complete information about compiler optimizations, see our Optimization Notice.


Sagalovsky, Benjamin's picture

Thank you, Preethi, but the original question still stands: will this speed up Tensorflow on my Core  i7-7500U CPU, or are those optimizations only effective for high-end Xeon processors? Thanks!

Preethi: Intel MKL-DNN, which is used to build the optimized TensorFlow supports Core processors. Refer the System Requirements section in the GitHub page here:


Sagalovsky, Benjamin's picture


I have a humble laptop with an Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz, running Windows 10 (oh, what a shame!), Anaconda and Jupyter Lab. Would I benefit at all of installing tensorflow-mkl? If there are any benefits, are there some pre-requisites/pre-installs that I would need to do?

In more general terms, what are the processors that would benefit from this install and from the MKL-DNN library as such?

Preethi Venkatesh: Hi Benjamin, The new version of  default TensorFlow (1.9) from the Anaconda Channel is build using MKL-DNN optimizations and is available for download now. just do a "conda install tensorflow". No other prerequisites needed.



Cooksey, Robert (Intel)'s picture

Is this method still relevant?

It avoids the pip <-> conda conflict.



Pradyumna's picture

Method 2 doesn't work for me on my MacBook. I get the following error:

Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - intelpython3_core
  - tbb4py
  - tensorflow
Use "conda info <package>" to see the dependencies for each package.

Can somebody please help?


Pradyumna's picture

I tried method 2, but I get the following error:

Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:
  - intelpython3_core
  - tbb4py
  - tensorflow
Use "conda info <package>" to see the dependencies for each package.

Can somebody please help?

Cai, Jason's picture

Thanks for the update about details of compiling TF+MKL from source with TF r1.6.

I am confused when doing "bazel build ...". From, it says:

# Pick the desired options
bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package

It's quite different from the bazel build cmds here.

Could you please tell me the reason why '--copt="-DEIGEN_USE_VML"' is needed?


Ehsan T. (Intel)'s picture

I installed this wheel in my conda environment, but python crashes with this error when I import tensorflow:

./tensorflow/core/common_runtime/mkl_cpu_allocator.h:144] Non-OK-status: s status: Unimplemented: Unimplemented case for hooking MKL function.

Qiang L. (Intel)'s picture

It seems that AVX512F is not compiled into released tensorflow 1.6. (but other KNL specific AVX512 instructions are compiled!!!)

I run simple "hello world" test on KNL after install the tensorflow 1.6 by following the steps mentioned here!!

it give me the message as follows:

2018-03-08 13:08:26.924344: I tensorflow/core/platform/] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX512F

BTW, i try to compile the tensorflow 1.6 from source code, and adding all of avxxxxx as -copt to bazel build cmd, after build tensorflow 1.6 package correctly, re-run above test program, it seems the "AVX512F" is compiled!!!!

Karczewski, Jakub Jan (Intel)'s picture

I've run into issue when running AlexNet ( on all of above TF versions (model works just fine on TF distribution installed with pip install tensorflow).

Error code:  tensorflow/core/kernels/] Check failed: dnnConversionCreate_F32( &convert_input, static_cast<dnnLayout_t>(inimage_shape.GetCurLayout()), lt_internal_input) == E_SUCCESS (-1 vs. 0)


Craig R.'s picture

The "... TensorFlow library wasn't compiled to use ..." may not indicate an issue.  There's a discussion over at which suggests that you'll still get SSE/AVX performance where it counts.  However, I would like a definitive answer and way to verify that I'm getting optimized versions.


Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.