Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

BLAS (Basic Linear Algebra Subprograms): What It Is and How Research Software Uses It

BLAS is the low-level matrix library behind NumPy and R. Learn BLAS vs LAPACK, OpenBLAS vs MKL, and what to record for reproducibility.

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

  1. 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.
  2. Loaded libraries and thread counts: the threadpoolctl package’s threadpool_info() returns one entry per loaded native library, with fields including internal_api (for example openblas or mkl), version, num_threads and, for OpenBLAS, architecture. From a shell, python -m threadpoolctl -i prints the same.
  3. 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.
  4. 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.
  5. 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:

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

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about BLAS (Basic Linear Algebra Subprograms): What It Is and How Research Software Uses It

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →