Intel's Tensorflow optimizations are now available for Linux as a wheel installable through pip.
For more information on the optimizations as well as performance data, see this blog post.
To install the wheel into an existing Python installation, simply run
Edit 10/12/17: Wheel paths have been updated to 1.3.0
Edit 11/22/17: Wheel paths have been updated to 1.4.0
To create a conda environment with Intel Tensorflow that also takes advantage of the Intel Distribution for Python’s optimized numpy, run
conda create -n tf -c intel python=<2|3> pip numpy |
Conda Package Now Available in Intel Python 2018
A conda package of Intel's optimized Tensorflow comes with the new 2018 Intel Python distribution on Linux. You can also create a conda environment with Intel Optimized Tensorflow with the following commands:
conda create -n intel_tf -c intel --override-channels tensorflow |
参考:https://software.intel.com/en-us/articles/build-and-install-tensorflow-on-intel-architecture
可以直接用谷歌官方的tf来编译支持Intel的mkl CPU。
Building a TensorFlow* Pip Package for Installation
If the program Git* is not currently installed on your system, issue the following command:
sudo apt install git
Clone the GitHub repository by issuing the following command:
git clone https://github.com/tensorflow/tensorflow
The tensorflow directory created during cloning contains a script named configure that must be executed prior to creating the pip package and installing TensorFlow. This script allows you to identify the pathname, dependencies, and other build configuration options. For TensorFlow optimized on Intel architecture, this script also allows you to set up Intel® Math Kernel Library (Intel® MKL) related environment settings. Execute the following commands:
cd tensorflow
./configure
Important: Select ‘Y’ to build TensorFlow with Intel MKL support, and ‘Y’ to download MKL LIB from the web. Select the default settings for the other configuration parameters. When the script has completed running, issue the following command to build the pip package:
bazel build --config=mkl --copt="-DEIGEN_USE_VML" -c opt //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Installing TensorFlow—Native Pip Option
At this point in the process the newly created pip package will be located in tmp/tensorflow_pkg. The next step is to install TensorFlow, which can be done either as a native pip installation, or in an Anaconda* virtual environment as described in the next section. For a native pip installation simply enter the following command:
sudo pip install /tmp/tensorflow_pkg/tensorflow-1.2.0rc1-cp27-cp27mu-linux_x86_64.whl
(Note: The name of the wheel, as shown above in italics, may be different for your particular build.)
Once these steps have been completed be sure to validate the installation before proceeding to the next section. Note: When running the Python validation script provided in the link, be sure to change to a different directory, for example:
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/8318282.html,如需转载请自行联系原作者
cd ..