Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
94f1dc0
modules: The 'feature' module
seiko2plus Jan 17, 2023
86eb639
modules: Add method 'feature.cpu_features'
seiko2plus Jan 17, 2023
18db1ff
Fix runtime detect of AVX features
seiko2plus Jan 18, 2023
64b7152
Satisfy the linter
seiko2plus Jan 18, 2023
5a1de8b
replace method to_dict with get
seiko2plus Jan 25, 2023
6c90fa5
improve test method
seiko2plus Jan 25, 2023
54fe62d
Fix returned boolean value when test fails
seiko2plus Jan 26, 2023
f18398f
Shrink the module
seiko2plus Jul 12, 2023
7d8bbe1
Fix config src dir
seiko2plus Jul 19, 2023
6cb3f99
Several improvements
seiko2plus Aug 7, 2023
248a3d5
fix initialize Compiler when user_defined_options is None
seiko2plus Aug 7, 2023
fac1e42
expose CompileResult because its needed by unittest
seiko2plus Aug 7, 2023
3c0a21d
Avoid full importing of module typing
seiko2plus Aug 7, 2023
f82ccbd
DOC: Improve the overview, functions signatures
seiko2plus Aug 10, 2023
55fb7df
BUG: Fix features tests on cross-compile builds
seiko2plus Sep 10, 2023
ae3b57f
feature module: Fix handling of multiple conflicts per attribute
Vogtinator Mar 28, 2024
6bf7fef
Avoid using symlink, merge all the module tests into a single project
seiko2plus Jun 8, 2026
4b7735b
fix linting problems & make the module compatible with latest version
seiko2plus Jun 8, 2026
6b1f295
Implement BLAS/LAPACK API and dependencies: OpenBLAS, MKL, Accelerate
rgommers Oct 9, 2023
3b4f374
BUG: fix macOS SDK version detection
rgommers Oct 10, 2023
b008f54
Improve macOS version check in order to use Accelerate NEWLAPACK
rgommers Oct 30, 2023
3fbdf0b
Add Netlib BLAS (libblas/libcblas) and LAPACK (liblapack/liblapacke) …
rgommers Nov 1, 2023
c1d25c8
BUG: fix macOS version checks so things work in very old versions
rgommers Dec 22, 2023
8650ab3
fix long-standing linting problems
mattip Jul 31, 2025
b45087f
update syntax for MKL get_option()
mattip Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions docs/markdown/Dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,163 @@ to what is provided by the C runtime libraries.

`method` may be `auto`, `builtin` or `system`.

## BLAS and LAPACK

*(numpy/meson#2)*

Enables compiling and linking against BLAS and LAPACK libraries. BLAS and
LAPACK are generic APIs, which can be provided by a number of different
implementations. It is possible to request either any implementation that
provides the API, or a specific implementation like OpenBLAS or MKL.
Furthermore, a preferred order may be specified, as well as the bitness (32 or
64) of the interface and whether to use the C or Fortran APIs.

Using the generic `'blas'` or `'lapack'` will try to find any matching
implementation. The search order over implementations is not guaranteed; Meson
aims to search them from higher to lower performance.

```meson
dependency('blas', interface : 'lp64', cblas : true)
dependency('lapack', interface : 'ilp64', lapacke : false)
```

Keywords:
- `interface`: options are `lp64` for 32-bit LP64, and `ilp64` for 64-bit
ILP64. Default is `lp64`.
- `cblas`: `true` or `false`. Default is `true`. (TBD: is `auto` needed?)
- `lapacke`: `true` or `false`. Default is `false`.

The search order can be controlled by explicitly specifying it:

```meson
# Specify what implementations to look for, and in what order
blas_dep = dependency('accelerate', 'mkl', 'openblas', 'blis', 'atlas', 'netlib')
lapack_dep = dependency('accelerate', 'mkl', 'openblas', 'atlas', 'netlib')

# You can also add the generic BLAS or LAPACK as a fallback, this may help
# portability
blas_dep = dependency('openblas', 'mkl', 'blis', 'netlib', 'blas')
lapack_dep = dependency('openblas', 'mkl', 'atlas', 'netlib')
```

Note that it is not necessary to specify both `'lapack'` and `'blas'` for the
same build target, because LAPACK itself depends on BLAS. (TBD: is this okay
for libflame?).


### Specific BLAS and LAPACK implementations

#### OpenBLAS

The `version` and `interface` keywords may be passed to request the use of a
specific version and interface, correspondingly:

```meson
openblas_dep = dependency('openblas',
version : '>=0.3.21',
language: 'c', # can be c/cpp/fortran
modules: [
'interface: ilp64', # can be lp64 or ilp64 (or auto?)
'symbol-suffix: 64_', # check/auto-detect? default to 64_ or no suffix?
'cblas',
'lapack', # OpenBLAS can be built without LAPACK support
]
)

# Query properties as needed:
has_cblas = openblas.get_variable('cblas')
is_ilp64 = openblas_dep.get_variable('interface') == 'ilp64'
blas_symbol_suffix = openblas_dep.get_variable('symbol-suffix')
```

If OpenBLAS is installed in a nonstandard location *with* pkg-config files,
you can set `PKG_CONFIG_PATH`. Alternatively, you can specify
`openblas_includedir` and `openblas_librarydir` in your native or cross machine
file, this works also if OpenBLAS is installed *without* pkg-config files:

```ini
[properties]
openblas_includedir = '/path/to/include_dir' # should contain openblas_config.h
openblas_librarydir = '/path/to/library_dir'
```

Note that OpenBLAS can be built with either pthreads or OpenMP. Information on
this is not available through Meson.

#### MKL

```meson
mkl_dep = dependency('mkl',
version: '>=2021.1.0',
modules: [
interface: 'lp64', # options are 'lp64' or 'ilp64'
threading: 'seq', # options are 'seq' or 'omp'
library: 'dynamic', # options are 'dynamic' or 'static'
]
)
```

#### Netlib BLAS and LAPACK

```meson
netlib_blas_dep = dependency('netlib-blas', version: '>=3.9.0')
netlib_lapack_dep = dependency('netlib-lapack', version: '>=3.9.0')
```

Note that this dependency will look for `libblas` or `liblapack`. No attempt is made
to enforce that they're the original Netlib reference libraries; if another library
is built with the same name, it's assumed that the APIs match.

TODO: the Netlib BLAS library typically ships CBLAS as a separate library and a separate
cblas.pc file.


#### ArmPL

```meson
armpl_dep = dependency('armpl',
version: '>=22.1',
modules: [
interface: 'lp64',
threading: 'seq',
library: 'dynamic',
]
)
```

The options for the `interface`, `threading` and `library` modules are the same
as for MKL.



#### ATLAS

TODO

#### BLIS

TODO

### libflame

TODO

### Accelerate

Supports the BLAS and LAPACK components of macOS Accelerate, also referred to
as the vecLib framework. ILP64 support is only available on macOS 13.3 and up.
From macOS 13.3, Accelerate ships with two different builds of 32-bit (LP64)
BLAS and LAPACK. Meson will default to the newer of those builds, by defining
`ACCELERATE_NEW_LAPACK`, unless `MACOS_DEPLOYMENT_TARGET` is set to a version
lower than 13.3.

```meson
accelerate_dep = dependency('accelerate',
version: '>818.60', # vecLib version (TODO: can this be determined?)
modules: [interface: 'lp64']
)
```

## Blocks

Enable support for Clang's blocks extension.
Expand Down
Loading
Loading