Sign up for our newsletter and get the latest HPC news and analysis.
Send me information from insideHPC:


Intel MKL and Intel TBB Working Together for Performance

Sponsored Post

The Intel® Math Kernel Library, Intel MKL, is a library of common numerical methods used in scientific and engineering applications. Highly optimized for Intel processors running Windows, MacOS, and Linux, the latest version extends functionality to include optimized methods for key machine learning algorithms.

Many of the libraries developed decades ago for core linear algebra and scientific math computation, such as BLAS, LAPACK, FFT, are still in use today with C, C++, Fortran, and now even Python programs. With MKL, Intel has engineered a ready-to-use, royalty-free library that implements these numerical algorithms optimized specifically to take advantage of the latest features of Intel chip architectures.  Even the best compiler can’t compete with the level of performance possible from a hand-optimized library. Any application that already relies on the BLAS or LAPACK functionality will achieve better performance on Intel and compatible architectures just by downloading and re-linking with Intel MKL.   And, that application will continue to run optimally on future generations of Intel processors with minimal additional effort.

About ten years ago, Intel launched an open source project to create a template library that would bring parallelism to C++ applications. Intel Threading Building Blocks (TBB) became an immediate success as a parallel programming model. Intel MKL now offers a version built on top of Intel TBB.

Intel MKL is extensively parallelized and is thread safe. Intel MKL supports either OpenMP or Intel Threaded Building Blocks (TBB) environments, executing efficiently over multiple threads. Applications can call Intel MKL functions from multiple threads and not worry about the function instances interfering with each other.

Intel Math Kernel Library working with Intel Threaded Building Blocks adds performance.Click To Tweet

Intel MKL is thread-safe, which means that all Intel MKL functions work correctly during simultaneous execution by multiple threads. In particular, any chunk of threaded Intel MKL code provides access for multiple threads to the same shared data, while permitting only one thread at any given time to access a shared piece of data. Therefore, you can call Intel MKL from multiple threads and not worry about the function instances interfering with each other.

Threading methods can be set with compiler options along with environment variables and calls to special MKL runtime functions. These are all detailed in the Intel MKL user documentation.

The following Intel MKL function domains are threaded with Intel Threading Building Blocks:

  • LAPACK.
  • Entire Level3 BLAS.
  • Fast Poisson, Laplace, and Helmholtz Solver (Poisson Library).
  • All Vector Mathematics functions (except service functions).
  • Intel MKL PARDISO, a direct sparse solver based on Parallel Direct Sparse Solver (PARDISO*).
  • Sparse BLAS.

When used in a TBB environment, Intel has demonstrated a many-fold performance improvement over the same parallelized code using Intel MKL in an OpenMP environment. Intel TBB-enabled Intel MKL is ideal when there is heavy threading in the Intel TBB application. Intel TBB-enabled Intel MKL shows solid performance improvements through better interoperability with other parts of the workload.

Along with high-performance compilers and tools for tuning and debugging, Intel MKL and Intel TBB are deeply integrated into Intel Parallel Studio XE 2017. Download and try Intel Parallel Studio XE for yourself from the following link:

Tap into the power of parallel on the fastest Intel® processors & coprocessors.  Intel® Parallel Studio XE 2017

Resource Links: