Python* API for Intel® Threading Building Blocks (Intel® TBB).

Overview

It is a preview Python* module which unlocks opportunities for additional performance in multi-threaded Python programs by enabling threading composability between two or more thread-enabled libraries like Numpy, Scipy, Sklearn, Dask, Joblib, and etc.

The biggest improvement can be achieved when a task pool like the ThreadPool from the Python standard library or libraries like Dask or Joblib (used in multi-threading mode) execute tasks calling compute-intensive functions of Numpy/Scipy/Sklearn/PyDAAL which in turn are parallelized using Intel® Math Kernel Library or/and Intel® TBB.

The module implements Pool class with the standard interface using Intel® TBB which can be used to replace Python's ThreadPool. Thanks to the monkey-patching technique implemented in class Monkey, no source code change is needed in order to enable threading composability in Python programs.

For more information and examples, please refer to online blog.

Files

setup.py
Standard Python setup script.
Makefile
Makefile for building, installing, and testing. See below.
tbb.i
SWIG interface description file.
tbb.src.py
Python part of module implementation.

Build and install

Prior to building it, please set up the environment using corresponding tbbvars script, e.g. `source tbbvars.sh intel64`
make
Default build and run. Equivalent to 'make release test'.
make release
Compile and link against the release version of Intel TBB runtime library. The resulting executable is left in the directory for the example.
make test
Run local build of the module previously produced by one of the above commands.
make install
Install module into Python.
make [(above options or targets)] CXX={icl, icc}
Build and run as above, but use Intel® C++ compiler instead of default, native compilers (e.g., icl instead of cl.exe on Windows* systems, or icc instead of g++ on Linux* or OS X* systems). Please note, CXX=icl works on Windows only with Intel® Distribution for Python*.
make clean
Remove any intermediate files produced by the above commands.

Command-line interface

pydoc TBB
Read built-in documentation for Python interfaces.
python -m TBB your_script.py
Run your_script.py in context of `with TBB.Monkey():` when Intel TBB is enabled.

System Requirements

The Python module was not tested on older versions of Python thus we require at least Python versions 2.7 and 3.5 or higher.
SWIG must be of version 3.0.6 or higher
OS versions: Microsoft* Windows* Server 2012, Microsoft* Windows* 10, Ubuntu* 14.04 LTS, Red Hat* Enterprise Linux* 7.
Up to parent directory

Copyright © 2005-2016 Intel Corporation. All Rights Reserved.

Intel is a registered trademark or trademark of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.