liveBook · Manning

Intel MKL

As explained in Fast Python: High performance techniques for large datasets

Intel MKL, now Intel oneMKL, is a library of optimized mathematical and scientific computing routines, including implementations of BLAS and LAPACK.

Intel MKL, now Intel oneMKL, supplies optimized BLAS and LAPACK routines for numerical and scientific computing. NumPy can use it beneath array operations and linear-algebra algorithms, including matrix multiplication and singular value decomposition. section 4.3.1

The linked BLAS/LAPACK implementation changes how NumPy uses CPU resources. MKL is threaded, so parallel workloads require care to avoid overcommitting CPU resources; a nonthreaded library instead leaves process-level parallelism more predictable. section 4.3.1

Use configuration inspection before tuning:

  • Run np.show_config() to inspect the libraries and directories associated with the NumPy installation. section 4.3.1
  • When configuration output is unclear, inspect package files and symbolic links; libcblas.so.3 pointing to libmkl_rt.so indicates MKL linkage. section 4.3.1
  • Avoid the slow, nonthreaded NetLib implementation when performance matters; compare OpenBLAS and MKL for maximum system-specific performance. section 4.3.2
conda create -n book-mkl blas=*=mk
conda activate book-mkl
conda install numpy

Creates an isolated Anaconda environment with the MKL BLAS build and installs NumPy without changing the existing environment. section 4.3.2

Checking the active backend

Run np.show_config(), then verify the reported library paths rather than inferring the backend from an environment name. If necessary, inspect the installed shared-library links directly. section 4.3.1

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Explains backend selection, threading consequences, configuration inspection, and installation, but stops short of benchmark results.
Examples
Uses np.show_config(), shared-library symlinks, and an Anaconda environment configured with blas=*=mk.
What it assumes
Assumes familiarity with Python distributions and NumPy, while explaining BLAS, LAPACK, dependency inspection, and package selection.
What you can do after
Operate/configure NumPy with MKL, inspect its active backend, and avoid CPU overcommitment from threaded linear algebra.
How it connects
Connects NumPy with BLAS, LAPACK, SciPy, OpenBLAS, NetLib, and CPU-resource management.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.