You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scientific-libs/blas.md
+5-29Lines changed: 5 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# BLAS (OpenBLAS)
2
2
3
-
Improvements to **OpenBLAS 0.3.30** on RISC-V boards — built via EasyBuild, deployed through [EESSI](https://www.eessi.io/) with **FlexiBLAS** runtime swapping. Verification tools and A/B scripts live in the [opensolvers/benchmarks](https://github.com/opensolvers/benchmarks) repo (`dgemm/`, `numpy/`).
3
+
Improvements to **OpenBLAS 0.3.30** on RISC-V boards — built via EasyBuild, deployed through [EESSI](https://www.eessi.io/) with **FlexiBLAS** runtime swapping.
|[VisionFive 2](../boards/VisionFive2.html) — SiFive **U74** (scalar) | No U74 kernel; falls back to generic `RISCV64_GENERIC` C `2×2` GEMM | New **4×4 DGEMM micro-kernel** in RV64 assembly, `TARGET=U74`| Single-core DGEMM **~1.4 → 1.77 GFLOP/s**; 4-core DGEMM **6.31 GFLOP/s**; [HPL **1.69×**](../apps/hpl.html)|
12
-
|[Orange Pi RV2](../boards/RV2.html) — SpacemiT **X60** (RVV VLEN=256) | RVV `gemv_n` zeroes an **uninitialized** vector register → `dgemv` returns NaN | Backport upstream `gemv_n` fix; `TARGET=RISCV64_ZVL256B`| Correct `dgemv`; see [HPL](../apps/hpl.html) and A/B tables below |
13
-
|[Banana Pi F3](../boards/F3.html) — same K1 / X60 SoC | Same RVV `gemv_n` bug as RV2 | Same [easyconfigs#26444](https://github.com/easybuilders/easybuild-easyconfigs/pull/26444) fix | HPL **11.52 GFLOP/s** PASSED; `difftest` bit-identical to RV2; threaded DGEMM **17.71 GFLOP/s**|
14
-
15
-
## X60 A/B — patched RVV vs scalar (Orange Pi RV2)
16
-
17
-
All runs use a **fixed** RVV OpenBLAS (`gemv_n` patch) swapped in via FlexiBLAS. Source: [benchmarks/dgemm](https://github.com/opensolvers/benchmarks/tree/main/dgemm), [benchmarks/numpy](https://github.com/opensolvers/benchmarks/tree/main/numpy).
| NumPy `eigvalsh` N=2048, 8 threads | 10.54 s | 6.72 s |**1.6×**|
24
-
25
-
## X60 — isolating the `gemv_n` bug (`difftest`)
26
-
27
-
The [benchmarks `difftest`](https://github.com/opensolvers/benchmarks/blob/main/dgemm/difftest.c) tool `dlopen`s a BLAS `.so` and reports NaN counts per routine:
28
-
29
-
| Backend |`dgemv` NaN |`dgemm` NaN |`dgemv` sum |
Micro-benchmarks for **BLAS level-3 performance** and **per-routine correctness** — from [opensolvers/benchmarks/dgemm](https://github.com/opensolvers/benchmarks/tree/main/dgemm). Used to isolate the OpenBLAS 0.3.30 RVV `gemv_n` NaN bug before fixing downstream apps.
4
+
5
+
See also the [BLAS overview](blas.html) for OpenBLAS packages and board context.
6
+
7
+
## Tools
8
+
9
+
| File | Purpose |
10
+
| ---- | ------- |
11
+
|[`bench_dgemm.c`](https://github.com/opensolvers/benchmarks/blob/main/dgemm/bench_dgemm.c)| Times square `C = A×B` (3 reps), reports GFLOP/s, prints `C[0]`|
12
+
|[`difftest.c`](https://github.com/opensolvers/benchmarks/blob/main/dgemm/difftest.c)|`dlopen`s a BLAS `.so`, runs level-1/2/3 routines, reports `sum` / NaN counts |
13
+
14
+
Both switch backends at runtime via FlexiBLAS or `OPENBLAS_CORETYPE` — no recompile.
15
+
16
+
```bash
17
+
gcc -O2 bench_dgemm.c -o bench_dgemm -lflexiblas
18
+
gcc -O2 difftest.c -o difftest -ldl -lm
19
+
20
+
OPENBLAS_NUM_THREADS=8 ./bench_dgemm 4096
21
+
./difftest /path/to/libopenblas.so
22
+
```
23
+
24
+
## Correctness — `difftest` (X60, RV2 & F3)
25
+
26
+
Bit-identical on [Orange Pi RV2](../boards/RV2.html) and [Banana Pi F3](../boards/F3.html):
27
+
28
+
| Backend |`dgemv` NaN |`dgemm` NaN |`dgemv` sum |
Fault is in **`dgemv` only** — plain `dgemm` looks fine on the broken build, which is why [HPL](../apps/hpl.html) can NaN while a GEMM micro-benchmark passes.
35
+
36
+
## Performance — `bench_dgemm`
37
+
38
+
### Orange Pi RV2 (1 core, N=2048)
39
+
40
+
| Backend | GFLOP/s |`C[0]`|
41
+
| ------- | ------- | ------ |
42
+
| Scalar | 1.16 | 245.24 |
43
+
| Patched RVV | 2.62 | 245.24 |
44
+
45
+
**2.3×** faster, numerically identical.
46
+
47
+
### Banana Pi F3 (cross-board)
48
+
49
+
| Backend | GFLOP/s |`C[0]`|
50
+
| ------- | ------- | ------ |
51
+
| Scalar | 1.26 | 245.24 |
52
+
| Patched RVV | 2.96 | 245.24 |
53
+
54
+
**2.35×** at 1 core. Threaded (8 cores, N=4096): **17.71 GFLOP/s** on patched RVV.
LAPACK correctness and performance here are probed through **NumPy** (`eigvalsh` → `dsyevd`) and pure BLAS (`A @ B` → `dgemm`) — a real-application path for SciPy/NumPy stacks on EESSI.
3
+
LAPACK performance and correctness probed via NumPy**`eigvalsh`** (`dsyevd`) — the LAPACK-heavy half of the [NumPy benchmark](numpy.html).
Benchmark source: [opensolvers/benchmarks/numpy](https://github.com/opensolvers/benchmarks/tree/main/numpy) (`bench_blas.py`). For DGEMM (`A @ B`) see the [NumPy](numpy.html) or [DGEMM](dgemm.html) pages.
6
6
7
-
## Orange Pi RV2 (SpaceMiT X60, 8 threads)
7
+
## Orange Pi RV2 (8 threads)
8
8
9
-
Backends swapped via FlexiBLAS on a NumPy linked against the FlexiBLAS hub (`SciPy-bundle` module). Patched RVV OpenBLAS uses the `gemv_n` fix from [easyconfigs#26444](https://github.com/easybuilders/easybuild-easyconfigs/pull/26444).
9
+
Patched RVV OpenBLAS via FlexiBLAS (`SciPy-bundle` module, [easyconfigs#26444](https://github.com/easybuilders/easybuild-easyconfigs/pull/26444)).
| EIGH (`eigvalsh`, N=2048) | 10.54 s | 6.72 s |**1.6×**|
15
14
16
-
Both patched runs are **finite** (correct through real LAPACK). The eigensolver speedup is lower than DGEMM because `eigvalsh`mixes BLAS-3 with BLAS-2 tridiagonalization — the same pattern seen in [ELPA](elpa.html).
15
+
Stock EESSI default RVV: `eigvalsh`returns NaN / fails to converge. See [DGEMM `difftest`](dgemm.html).
17
16
18
-
Stock EESSI default RVV would return NaN on the eigensolver path; see the [BLAS `difftest` table](blas.html).
A **SciPy-stack probe** for BLAS and LAPACK through NumPy — from [opensolvers/benchmarks/numpy](https://github.com/opensolvers/benchmarks/tree/main/numpy) (`bench_blas.py`).
Unlike raw [DGEMM](dgemm.html), `eigvalsh` exercises BLAS-2 tridiagonalization — a correctness gate for the same `gemv_n` bug that breaks [HPL](../apps/hpl.html) and [ELPA](elpa.html).
**Stock unpatched RVV:**`eigvalsh` raises `LinAlgError: Eigenvalues did not converge`; DGEMM alone stays finite at 10.94 GFLOP/s (only `gemv` is broken — see [DGEMM difftest](dgemm.html)).
37
+
38
+
Eigensolver speedup (~1.6×) is lower than DGEMM (~2.4–3.6×) because `eigvalsh` mixes BLAS-3 with latency-bound BLAS-2 — same pattern as [ELPA](elpa.html).
Nav config: `_config.yml` (`navigation`, `navigation_boards`, `navigation_apps`, `navigation_scientific_libs`). Rendered in `_includes/header.html`. Cayman theme requires `_layouts/default.html` override to include the header.
26
26
@@ -44,6 +44,7 @@ Nav config: `_config.yml` (`navigation`, `navigation_boards`, `navigation_apps`,
44
44
45
45
| Date | Decision |
46
46
|------|----------|
47
+
| 2026-07-14 | Add dedicated DGEMM and NumPy scientific-lib pages from benchmarks repo |
0 commit comments