Math Kernel Library
   HOME

TheInfoList



OR:

Intel oneAPI Math Kernel Library (Intel oneMKL; formerly Intel Math Kernel Library or Intel MKL) is a
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
of optimized math routines for science, engineering, and financial applications. Core math functions include
BLAS Basic Linear Algebra Subprograms (BLAS) is a specification that prescribes a set of low-level routines for performing common linear algebra operations such as vector addition, scalar multiplication, dot products, linear combinations, and matrix ...
,
LAPACK LAPACK ("Linear Algebra Package") is a standard software library for numerical linear algebra. It provides routines for solving systems of linear equations and linear least squares, eigenvalue problems, and singular value decomposition. It als ...
,
ScaLAPACK The ScaLAPACK (or Scalable LAPACK) library includes a subset of LAPACK routines redesigned for distributed memory MIMD parallel computers. It is currently written in a Single-Program-Multiple-Data style using explicit message passing for interproc ...
, sparse solvers, fast Fourier transforms, and vector math. The library supports Intel processors and is available for
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, w ...
and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also i ...
s. ''Intel oneAPI Math Kernel Library'' is not to be confused with ''oneAPI Math Kernel Library'' (oneMKL) Interfaces, a piece of open-source
glue code Adhesive, also known as glue, cement, mucilage, or paste, is any non-metallic substance applied to one or both surfaces of two separate items that binds them together and resists their separation. The use of adhesives offers certain advant ...
that allows Intel MKL routines to be used from Data Parallel C++.


History and licensing

Intel launched the Math Kernel Library on May 9, 2003, and called it blas.lib. The project's development teams are located in Russia and the United States. The library was available in a standalone form, free of charge under the terms of Intel Simplified Software License which allow redistribution. Since April 2020, MKL has become part of oneAPI. Commercial support for oneMKL is available when purchased as part of oneAPI Base Toolkit.


Performance and vendor lock-in

MKL and other programs generated by the Intel C++ Compiler and the Intel DPC++ Compiler improve performance with a technique called function multi-versioning: a function is compiled or written for many of the x86 instruction set extensions, and at run-time a "master function" uses the
CPUID In the x86 architecture, the CPUID instruction (identified by a CPUID opcode) is a processor supplementary instruction (its name derived from CPU IDentification) allowing software to discover details of the processor. It was introduced by Intel ...
instruction to select a version most appropriate for the current CPU. However, as long as the master function detects a non-Intel CPU, it almost always chooses the most basic (and slowest) function to use, regardless of what instruction sets the CPU claims to support. This has netted the system a nickname of ''"cripple AMD" routine'' since 2009. , Intel's MKL remains the numeric library installed by default along with many pre-compiled mathematical applications on Windows (such as NumPy, SymPy). Although relying on the MKL,
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
implemented a workaround starting with Release 2020a which ensures full support for AVX2 by the MKL also for non Intel (AMD) CPUs. In older versions, setting the undocumented environment variable could be used to override the vendor string dependent codepath choice and activate supported instructions up to AVX2 on AMD processor based systems resulting in equal or even better performance when compared to Intel CPUs. Since Update 1 2020, the environment variable does not work anymore, but Intel introduced custom kernels for Zen 2 for dgemm (but not for sgemm), which is still worse than when using hack. At least two routes for
hooking In computer programming, the term hooking covers a range of techniques used to alter or augment the behaviour of an operating system, of applications, or of other software components by intercepting function calls or messages or events passed ...
the MKL's internal routines to remove the discrimination have been discovered. The hook can be added at compile-time by linking or at run-time by
injection Injection or injected may refer to: Science and technology * Injective function, a mathematical function mapping distinct arguments to distinct values * Injection (medicine), insertion of liquid into the body with a syringe * Injection, in broadca ...
. Agner Fog discovered that MKL and ICC binaries also have a hidden non-discriminating dispatcher. A function was discovered in 2019. Fog's provides code that hooks both routes. According to Daniƫl de Kok, just patching the latter function on MKL 2020 Update 1 improves performance for AMD Zen.


Details


Functional categories

Intel MKL has the following functional categories: *
Linear algebra Linear algebra is the branch of mathematics concerning linear equations such as: :a_1x_1+\cdots +a_nx_n=b, linear maps such as: :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matrices ...
: BLAS routines are vector-vector (Level 1), matrix-vector (Level 2) and matrix-matrix (Level 3) operations for real and complex single and double precision data. LAPACK consists of tuned LU, Cholesky and QR factorizations, eigenvalue and least squares solvers. MKL also includes Sparse BLAS,
ScaLAPACK The ScaLAPACK (or Scalable LAPACK) library includes a subset of LAPACK routines redesigned for distributed memory MIMD parallel computers. It is currently written in a Single-Program-Multiple-Data style using explicit message passing for interproc ...
, Sparse Solver, Extended Eigensolver (FEAST, PARDISO), PBLAS and BLACS. MKL only got good at small dimensions because o
libxsmm
*:Since MKL uses standard interfaces for BLAS and LAPACK, the application which uses other implementations can get better performance on Intel and compatible processors by re-linking with MKL libraries. *MKL includes a variety of Fast Fourier Transforms (FFTs) from 1D to multidimensional, complex to complex, real to complex, and real to real transforms of arbitrary lengths. Applications written with the open source
FFTW The Fastest Fourier Transform in the West (FFTW) is a software library for computing discrete Fourier transforms (DFTs) developed by Matteo Frigo and Steven G. Johnson at the Massachusetts Institute of Technology. FFTW is one of the fastest fre ...
can be easily ported to MKL by linking with interface wrapper libraries provided as part of MKL for easy migration. *:Cluster versions of LAPACK and FFTs are also available as part of MKL to take advantage of MPI parallelism in addition to single node parallelism from multithreading. *Vector math functions include computationally intensive core mathematical operations for single and double precision real and complex data types. These are similar to libm functions from compiler libraries but operate on vectors rather than scalars to provide better performance. There are various controls for setting accuracy, error mode and denormalized number handling to customize the behavior of the routines. * Statistics functions include random number generators and probability distributions. optimized for multicore processors. Also included are compute-intensive in and out-of-core routines to compute basic statistics, estimation of dependencies etc. *Data fitting functions include splines (linear, quadratic, cubic, look-up, stepwise constant) for 1-dimensional interpolation that can be used in data analytics, geometric modeling and surface approximation applications. *
Deep Neural Network Deep learning (also known as deep structured learning) is part of a broader family of machine learning methods based on artificial neural networks with representation learning. Learning can be supervised, semi-supervised or unsupervised. D ...
*
Partial Differential Equations In mathematics, a partial differential equation (PDE) is an equation which imposes relations between the various partial derivatives of a multivariable function. The function is often thought of as an "unknown" to be solved for, similarly to ...
* Nonlinear Optimization Problem Solvers


See also

* OneAPI (compute acceleration) * List of numerical libraries * Automatically Tuned Linear Algebra Software (ATLAS) * GotoBLAS and OpenBLAS *
Integrated Performance Primitives Intel Integrated Performance Primitives (Intel IPP) is a multi-threaded software library of functions for multimedia and data processing applications, produced by Intel. The library supports Intel and compatible processors and is available for Li ...


References


External links

*
DocumentationoneMKL User Forum
{{Numerical linear algebra 2003 software C++ numerical libraries Intel software Numerical software