Intel Python’s Performance

Introduction

Machine learning algorithms can take significant amounts of time to run. Intel’s distribution of Python aims to accelerate this machine learning process without users having to switch to C or C++. The prospect of code acceleration within Python itself is exciting. Therefore, a very simple experiment was set up to analyse Intel Python’s performance. This experiment utilises the 4 commonly used machine learning libraries : random forest, linear regression, hierarchical clustering and K-means clustering.

Intel Python

Intel Python performs the speed up through Intel® MKL, Intel® DAAL and the Intel® AVX. These are libraries which aim to optimise matrix and vector operations (common in machine learning).

It is important to note that Intel and Anaconda have been collaborating since 2016. This means that Intel contributes to performance enhancement in Anaconda’s Python distribution. (https://www.anaconda.com/improved-security-performance-in-anaconda-distribution-5/)

The Experiment

System

Operating System: macOS Mojave – Version 10.14.6
Processor: 2.8 GHz Intel Core i7
Memory: 16 GB 2133 MHz LPDDR3
Graphics: Intel Iris Plus Graphics 655 1536 MB

Setup

The following describes the environments that were set up for this experiment.

  1. Stock Python (Stock) – Default Python environment
  2. Vanilla Conda (Conda) – Conda distributed Python environment
    (https://www.anaconda.com/distribution/)
  3. Idp Conda (IdpCon) – Intel Python environment distributed by Anaconda
    (https://software.intel.com/en-us/articles/using-intel-distribution-for-python-with-anaconda)
  4. Idp Conda Environment, Pip Install Idp (IdpPip) – Intel Python environment, installed in a conda environment using pip install.
    (https://software.intel.com/en-us/articles/installing-the-intel-distribution-for-python-and-intel-performance-libraries-with-pip-and)
  5. Idp Standalone (IdpStd) – Intel python standalone distributed by Intel.
    (https://software.intel.com/en-us/distribution-for-python)

Models

The models and size of data used for the experiment are shown below. Data is generated using numpy.random.

  • K-means Clustering – 1,000,000 rows, 3 columns, 6 clusters.
  • Hierarchical Clustering – 10,000 rows, 3 columns, 6 clusters.
  • Random Forest – 10,000 training rows, 10 training columns, 1,000 test rows, 100 estimators.
  • Linear Regression – 10,000,000 training rows, 10 training columns, 1000000 test rows.

Results

Average of experiment results out of 20 runs

Stock Python is significantly slower for LR and K-means while it is faster in hierarchical clustering. It is interesting to note that IdpPip performs ~8x faster than conda and ~16x faster than stock Python.

Conclusion

With the exception of K-means clustering, the performance of Intel’s Python distribution appears comparable to Anaconda’s Python distribution. IdpPip has a significant speedup over the other environments. However, stock Python still performs better at hierarchical clustering. Therefore, it is not conclusive if Anaconda or Intel Python is definitively better.

Fortunately, Intel is constantly working on performance enhancements for Python code. We can look forward to a near future when Intel Python becomes definitively better than other distributions of Python.

Links

Intel Python:
https://software.intel.com/en-us/distribution-for-python/benchmarks#machine-learning

Repository:
https://github.com/JwayCube/benchmark-intelpython

Author