Intel® Optimized Environment for AI

--

In this article you will learn how to setup an optimized environment to speed-up the Traning/Inference of your Artificial Intelligence algorithm running on Intel® architecture.

Do you use Numpy, Scikit-learn, Tensorflow? Than this article is for you!

Did you know Intel® has an optimized Python Distribution?

If you are running your algorithm in Intel CPUs, you should create an Intel optimized environment. It uses multi-threads, vectorization, parallelism and a highly optimized basic linear algebra subprograms(BLAS).

Trending AI Articles:

1. How ethical is Artificial Intelligence?

2. Predicting buying behavior using Machine Learning

3. Understanding and building Generative Adversarial Networks(GANs)

4. AI & NLP Workshop

Intel has been developing libraries to optimize your algorithm in many ways. Here you are some of them:

  • Intel® Data Analytics Acceleration Library (DAAL)
    Boost machine learning and data analytics performance. Analyzes larger data sets with the same compute resources.
    Source: https://software.intel.com/en-us/intel-daal
  • Intel® Threading Building Blocks (TBB)
    Intel® Threading Building Blocks (Intel® TBB) lets you easily write parallel C++ programs that take full advantage of multicore performance, that are portable and composable, and that have future-proof scalability.
    Source: https://www.threadingbuildingblocks.org/
  • Intel® Math Kernel Library (MKL)
    Features highly optimized, threaded, and vectorized math functions that maximize performance on each processor family.
    Source: https://software.intel.com/en-us/mkl
  • Intel® Math Kernel Library for Deep Neural Networks (MKLDNN)
    The library accelerates deep learning applications and framework on Intel® architectures. Intel® MKL-DNN contains vectorized and threaded building blocks which you can use to implement deep neural networks (DNN).
    Source: https://github.com/intel/mkl-dnn

Setup Optimized Intel environment for Intel CPUs.

The Intel Distribution accelerates performance of many numerical data science Python packages such as Numpy, Scipy, Scikit-learn, Tensorflow for cpu.

The packages have been optimized to take advantage of parallelism through the use of threading, multiple nodes, and vectorization.

Are you familiar with Anaconda environment?

Anaconda is a package repository / package manager to help you installing your dependencies out-of-the-box. It is very similar than PIP, but it has an easier and more organized way to create and manage environments with different versions and libraries. For more information: https://conda.io/docs/user-guide/overview.html

Now, let’s create an Anaconda environment and install Intel optimized packages:

# Create new conda environment
conda create -n intelOptimizedEnv
# Activate env
source activate intelOptimizedEnv
# Full Intel Optimized Env
# Python3 (Recommended)
conda install -c intel intelpython3_full
# Python2
conda install -c intel intelpython2_full
# Core libraries only
# Python3 (Recommended)
conda install -c intel intelpython3_core
# Python2
conda install -c intel intelpython2_core

List of all optimized packages here: https://software.intel.com/en-us/articles/complete-list-of-packages-for-the-intel-distribution-for-python

Check your installation to see if you are using the Intel Python Distribution:

# Activate env
source activate intelOptimizedEnv
# Start Python
python
Intel Python Distribution — You see Intel Corporation after the Python Version.

Some Benchmarks showing the speed-up on Scikit-learn and Numpy

Scikit-learn speed-up using Intel Python Distribution — https://software.intel.com/en-us/distribution-for-python/benchmarks
Numpy speed-up using Intel Python Distribution — https://software.intel.com/en-us/distribution-for-python/benchmarks

Now you are ready to enjoy your new optimized environment!

If this article helped you, please give a clap.

Follow me on LinkedIn: https://www.linkedin.com/in/fernando-rodrigues-junior-7390b991

--

--