


Thus with MKL you will automatically benefit from all features and instruction sets (such as AVX2 and AVX512) if they are available on your CPU, without any additional configuration.
#Mac os install openblas atlas code
In fact, the library contains multiple code paths, which are selected at runtime depending on individual features of the CPU it is being loaded on. MKL provides a very highly optimized implementation of linear algebra routines, and especially on Intel CPUs. Starting 2017, Intel made MKL freely available and allows royalty-freely runtime redistribution even for commercial application (although, just like, for example, CUDA, it is still a closed-source commercial product). Previously MKL used to be a paid product. To use MKL with Kaldi use the -DHAVE_MKL compiler flag. Intel MKL provides C-language interface to a high-performance implementation of the BLAS and LAPACK routines, and is currently the preferred CBLAS/CLAPACK provider for Kaldi.

MKL provides complete C-callable interfaces for its own BLAS and LAPACK implementations no additional libraries are required. Because of this, the f2c library is required during linking with the "original" CLAPACK (usually -lg2c or -lf2c). Netlib's LAPACK with ATLAS's BLAS).ĬLAPACK is a version of LAPACK that has been converted from Fortan to C automatically using the f2c utility. It is possible to mix-and-match LAPACK and BLAS implementations (e.g. The reference implementation of LAPACK was implemented and has been maintained by Netlib. It includes higher-level routines than BLAS, such as matrix inversion, SVD, etc. LAPACK is a set of linear-algebra routines, originally written in Fortran. MKL, ATLAS and OpenBLAS provide optimized implementations of BLAS.ĬBLAS is just the C language interface to BLAS. The reference implementation lacks any optimization whatsoever, and exists solely as a touchstone to validate the correctness of other implementations. The reference implementation of BLAS originated back in 1979, and has been maintained since by Netlib.
#Mac os install openblas atlas plus
They have names like daxpy (for " double-precision a x plus y"), and dgemm (for "double-precision general matrix-matrix multiply"). There is BLAS Level 1 (vector-vector), Level 2 (vector-matrix) and Level 3 (matrix-matrix). Run the script with the -help option for the complete option list.īecause we refer a lot to BLAS (and more often CBLAS) and LAPACK (or, rarely, CLAPACK) in this section, we briefly explain what it is.īLAS is a set of subroutine declarations that correspond to low-level matrix-vector operations. If called with no arguments it will use any Intel MKL installation it can find in "normal" places in your system, but it is configurable. It does this by creating the file "kaldi.mk" in the "src" directory, which gives appropriate flags to the compiler. The "configure" script in the "src" directory is responsible for setting up Kaldi to use the libraries. Additionally, some routines are not even available in ATLAS so we have had to implement them ourselves. However, the rest of the matrix code is not completely insulated from these issues because the ATLAS and CLAPACK versions of higher-level routines are called differently (so we have a lot of "#ifdef HAVE_ATLAS" directives and the like). The code that deals most directly with including the external libraries and setting up the appropriate typedef's and defines, is in kaldi-blas.h. It must then be linked with the appropriate libraries. The Kaldi code requires exactly one of the three macros HAVE_ATLAS, HAVE_CLAPACK, HAVE_OPENBLAS or HAVE_MKL to be defined (normally using -DHAVE_ATLAS as an option to the compiler).

The code has to "know" which of these four options is being used, because although in principle BLAS and LAPACK are standardized, there are some differences in the interfaces. Some implementation of BLAS plus CLAPACK (note: this has not been tested recently).ATLAS, which is an implementation of BLAS plus a subset of LAPACK (with a different interface).OpenBLAS, which provides BLAS and LAPACK.Intel MKL, which provides both BLAS and LAPACK (the default).The code has been designed to be as flexible as possible in terms of what libraries it can use. The matrix code in Kaldi is mostly a wrapper on top of the linear-algebra libraries BLAS and LAPACK. Here we describe how our matrix library makes use of external libraries.
