Skip to content

Commit d30956f

Browse files
committed
Add get_matmul_library to actual sphinx docs
1 parent daa568f commit d30956f

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

README_DEVELOPERS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,36 @@ If you want to run the network tests, you can use the following command:
9393
pytest -m "network"
9494
```
9595

96+
## Matmul backend discovery
97+
98+
The fast `blosc2.matmul` path uses platform-specific block kernels:
99+
100+
- macOS: `Accelerate`
101+
- Linux/Windows: runtime-discovered `cblas`
102+
- fallback: portable `naive` kernel
103+
104+
For the runtime `cblas` backend, `python-blosc2` probes the active Python/NumPy
105+
environment rather than linking to one BLAS vendor at build time. Discovery
106+
starts from NumPy's reported BLAS library directory when available, and then
107+
searches common library names in the active environment's `lib` directories.
108+
109+
On Linux the current candidates include `libcblas`, `libopenblas`,
110+
`libflexiblas`, `libblis`, `libmkl_rt`, and generic `libblas`. A candidate is
111+
accepted only if it loads successfully and exports both `cblas_sgemm` and
112+
`cblas_dgemm`. If no suitable provider is found, the fast path falls back to
113+
the `naive` kernel.
114+
115+
Useful runtime helpers:
116+
117+
- `blosc2.get_matmul_library()` reports the selected runtime library when available
118+
- `BLOSC_TRACE=1` logs candidate probing, rejection, selection, and backend fallback
119+
120+
Example:
121+
122+
```bash
123+
BLOSC_TRACE=1 python -c "import blosc2; print(blosc2.get_matmul_library())"
124+
```
125+
96126
## wasm32 / Pyodide developer workflow
97127

98128
For the local wasm32 workflow (uv + pyodide-build + cibuildwheel + test loop),

doc/reference/additional_funcs.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Their result is typically a :ref:`LazyExpr` instance, which can be evaluated (wi
1616
clip
1717
contains
1818
endswith
19+
get_matmul_library
1920
imag
2021
lower
2122
real
@@ -30,6 +31,7 @@ Their result is typically a :ref:`LazyExpr` instance, which can be evaluated (wi
3031
.. autofunction:: blosc2.clip
3132
.. autofunction:: blosc2.contains
3233
.. autofunction:: blosc2.endswith
34+
.. autofunction:: blosc2.get_matmul_library
3335
.. autofunction:: blosc2.imag
3436
.. autofunction:: blosc2.lower
3537
.. autofunction:: blosc2.real

0 commit comments

Comments
 (0)