Written and maintained by CASRAI Editorial Board
Last updated
Short answer: BLAS (Basic Linear Algebra Subprograms) is a specification for the low-level vector and matrix routines that scientific software calls for its arithmetic. This page is about the numerical library, not the given name. It is written for researchers who use NumPy, SciPy, R or similar tools and want to know what BLAS is, which implementation their software is using, and what to record so the result can be reproduced.
What BLAS is
According to the Netlib BLAS page (last updated 2025-01-20), BLAS provides “standard building blocks for performing basic vector and matrix operations”. The routines are meant to be efficient, portable and widely available, and they are used by higher-level libraries such as LAPACK. BLAS is a specification with several implementations, so “which BLAS” is a real question for any analysis that does matrix arithmetic.
The three levels
- Level 1: scalar, vector and vector-vector operations.
- Level 2: matrix-vector operations.
- Level 3: matrix-matrix operations.
The Netlib page also publishes a Quick Reference Guide (blas.pdf) and lists a CBLAS C interface (cblas.h) alongside the original Fortran 77 routines.
BLAS vs LAPACK
LAPACK (Linear Algebra PACKage) sits one layer above BLAS. Netlib describes it as a Fortran 90 library for dense linear algebra: systems of linear equations, least squares, eigenvalue and singular value problems, with factorizations such as LU, Cholesky, QR, SVD and Schur. It is built so that it does as much of its work as possible through BLAS calls, especially Level 3 matrix multiplication. It covers dense and banded matrices (not general sparse ones), real and complex, single and double precision. Netlib lists 3.12.1 (released 2025-01-08) as the version on its page when read on 2026-11-07, and names the University of Tennessee, UC Berkeley, the University of Colorado Denver and NAG as developers.
In practice the stack is: your analysis code, then a library call such as a linear solve, then LAPACK, then BLAS, then the processor. Speeding up BLAS therefore speeds up everything above it.
Implementations
The reference BLAS on Netlib is written in Fortran 77, is freely available, and is explicitly not optimized for performance. Netlib’s LAPACK page says the reference BLAS is available but discouraged for performance, and that tuned vendor libraries or ATLAS are preferred. Reference BLAS may be used in commercial software with credit to the authors; if modified, the routine must be renamed and the changes commented.
| Implementation | What the sources say | Source |
|---|---|---|
| Reference BLAS | Fortran 77, free, not optimized for performance; now included in the LAPACK distribution. | Netlib BLAS and LAPACK pages |
| OpenBLAS | “An optimized BLAS library based on GotoBLAS2 1.13 BSD version”; BSD-3-Clause licence; LAPACK is included. | OpenBLAS GitHub README |
| Intel MKL | Named by NumPy as an example of a highly optimized library that takes advantage of specialized processor functionality. | NumPy linear algebra documentation |
| ATLAS | Named by Netlib and NumPy as a tuned alternative to reference BLAS. | Netlib LAPACK page; NumPy docs |
| BLIS | One of the libraries R’s build checks for, in the order OpenBLAS, BLIS, ATLAS, platform-specific choices, then a generic libblas. | R Installation and Administration manual |
Finding which BLAS your software uses
- NumPy: call
np.show_config(). The NumPy reference says it shows the libraries and system information on which NumPy was built and is being used;mode='dicts'returns the same information as a dictionary. - Loaded libraries and thread counts: the threadpoolctl package’s
threadpool_info()returns one entry per loaded native library, with fields includinginternal_api(for example openblas or mkl),version,num_threadsand, for OpenBLAS,architecture. From a shell,python -m threadpoolctl -iprints the same. - Limit threads for one block of code:
with threadpool_limits(limits=1, user_api='blas'):is the example given in the threadpoolctl README. It supports OpenBLAS and MKL. - OpenBLAS threads from the environment: set
OPENBLAS_NUM_THREADS. OpenBLAS documents the priority OPENBLAS_NUM_THREADS, then GOTO_NUM_THREADS, then OMP_NUM_THREADS, and ignores the first two if built with OpenMP. - R: the R Installation and Administration manual describes how R is built against ATLAS, OpenBLAS, BLIS, Intel MKL or the reference BLAS, and how a shared BLAS can be substituted. Read its BLAS appendix for your platform before changing it.
NumPy’s own documentation explains why this matters: its linear algebra functions rely on BLAS and LAPACK, those libraries are “multithreaded and processor dependent”, and so environment variables and packages such as threadpoolctl “may be needed to control the number of threads or specify the processor architecture”.
How fast is BLAS?
There is no single speed. It depends on the implementation, the processor and the thread count. The sources above establish only the direction: the reference BLAS is not performance-optimized, and tuned libraries are preferred where speed matters. For a number that applies to your work, benchmark your own matrix sizes on your own hardware.
Reproducibility checklist (editorial practice, not a standard)
Because BLAS implementations are processor-dependent and multithreaded, the same script can run at different speeds on different machines, and floating-point results can differ in the last digits when the implementation, thread count or processor changes. R’s manual, for example, notes that the Accelerate BLAS shows differences from the reference BLAS in the handling of NA versus NaN. A sensible record for a methods section or README includes:
- BLAS/LAPACK implementation and version (from
threadpool_info()ornp.show_config()). - Thread count in effect and how it was set.
- Processor architecture, where the library reports it.
- The package manager and environment file used; see sharing a reproducible conda environment and conda, pip and mamba in one environment.
Related NumPy behaviour is covered in element-wise multiplication in NumPy, and solving linear systems in R in solve() in R.
Strengths and limits
- Strength: a stable, shared interface lets one program run on many implementations without changes.
- Limit: the interface does not fix thread counts or hardware tuning, so performance and low-order digits are implementation-dependent.
- Limit: LAPACK, built on BLAS, handles dense and banded matrices, not general sparse ones.
FAQ
What is LAPACK?
LAPACK is the Fortran 90 Linear Algebra PACKage for dense linear algebra, built on BLAS and doing as much work as it can through BLAS calls. See “BLAS vs LAPACK” above. Netlib lists related projects ScaLAPACK (distributed memory), PLASMA (multicore) and MAGMA (GPU).
How fast is BLAS?
It depends on the implementation, hardware and threads; see the speed section above. Reference BLAS is not optimized for performance.
What ethnicity is the name Blas, and what is Blas in Welsh?
Those searches are about a given name, which is outside this page. This page covers only the numerical library.
Where can I download BLAS or find its documentation?
Netlib hosts the reference BLAS, a Quick Reference Guide and links to optimized implementations; the reference BLAS is also included in the LAPACK library, available from the LAPACK site and its GitHub repository.
Sources
- Netlib, BLAS: https://www.netlib.org/blas/ (page updated 2025-01-20; read 2026-11-07)
- Netlib, LAPACK: https://www.netlib.org/lapack/ (read 2026-11-07)
- NumPy, linear algebra routines: numpy.org linalg, and numpy.show_config (read 2026-11-07)
- OpenBLAS README: github.com/OpenMathLib/OpenBLAS (read 2026-11-07)
- threadpoolctl README: github.com/joblib/threadpoolctl (read 2026-11-07)
- R Installation and Administration: cran.r-project.org R-admin (read 2026-11-07)







