NextLA.jl

Benchmarks

NextLA’s mixed-precision routines against the vendor libraries on one GPU, an NVIDIA GB10 (DGX Spark). How it was measured is at the end.

Mixed precision: Cholesky, SYRK and TRSM

The routines of paper [3] (Citing NextLA) on recursively split matrices whose blocks are stored in different precisions (Mixed precision), as NextLA’s speed over the vendor library at the leaf precision. A configuration lists the off-diagonal precision at each level, then the leaf: [F16, F16, F32] has two levels of Float16 off-diagonal blocks and Float32 leaves. The table gives the configurations paper [3] reports, at n = 65536 wherever it fits in the GB10’s memory.

Configuration n NextLA (× vendor) Error (n)
Cholesky [F16, F32, F64] 64K 2.69× 2.7e-08 (32K)
Cholesky [F16, F16, F16, F32] 64K 2.29× 9.6e-08 (32K)
Cholesky [F16×6, F32] 64K 2.43× 9.7e-08 (32K)
Cholesky Pure F16 64K 4.41× 6.0e-04 (32K)
SYRK [F16, F16, F32] 64K 1.19× 1.0e-04 (16K)
SYRK [F16×4, F32] 64K 1.20× 1.2e-04 (16K)
SYRK Pure F16 64K 4.89× 2.2e-04 (16K)
TRSM [F16×4, F32] 64K 2.52× 6.7e-04 (16K)
TRSM Pure F16 64K 3.12× 7.0e-04 (16K)

Two choices trade speed for accuracy. Float16 products are summed in Float32, and every update is checked for overflow, raising the block’s scale instead of storing Inf. A Float64 leaf updated from Float16 or Float32 rows sums that update in Float32 (see Mixed precision): on the matrices these errors are measured on, which add 10nI, that changes the error by at most 3%; on less diagonally dominant matrices it grows, about 9× with [F32, F64] on AA^T + nI.

Cholesky: potrf_recursive! on SymmMixedPrec

NextLA’s speed over cuSOLVER potrf at the leaf precision, one panel per configuration (log scale; above 1× is faster than the vendor library, timed in the same run).

Cholesky: NextLA's speed over cuSOLVER potrf

```@raw html

The numbers behind the Cholesky chart ``` | Configuration | n | NextLA | cuSOLVER `potrf` | × vendor | Build | Error | |:---|---:|---:|---:|---:|---:|---:| | Pure F32 | 16K | 0.14 s | 0.137 s | **0.98×** | – | 2.3e-08 | | Pure F32 | 32K | 0.859 s | 1.02 s | **1.18×** | – | 5.6e-08 | | Pure F32 | 64K | 6.99 s | 7.75 s | **1.11×** | – | – | | Pure F16 | 16K | 0.0585 s | 0.137 s | **2.34×** | – | 6.0e-04 | | Pure F16 | 32K | 0.286 s | 1.02 s | **3.55×** | – | 6.0e-04 | | Pure F16 | 64K | 1.76 s | 7.75 s | **4.41×** | – | – | | Pure F64 | 16K | 3.8 s | 3.64 s | **0.96×** | – | 3.3e-16 | | Pure F64 | 32K | 29.6 s | 29.2 s | **0.99×** | – | 3.4e-16 | | [F16, F32] | 16K | 0.146 s | 0.139 s | **0.95×** | 0.0444 s | 6.4e-08 | | [F16, F32] | 32K | 0.827 s | 1.02 s | **1.23×** | 0.152 s | 9.2e-08 | | [F16, F32] | 64K | 5.14 s | 7.73 s | **1.50×** | 0.601 s | – | | [F16, F16, F32] | 16K | 0.136 s | 0.139 s | **1.02×** | 0.0382 s | 7.1e-08 | | [F16, F16, F32] | 32K | 0.646 s | 1.02 s | **1.58×** | 0.127 s | 9.4e-08 | | [F16, F16, F32] | 64K | 4.05 s | 7.73 s | **1.91×** | 0.493 s | – | | [F16, F16, F16, F32] | 16K | 0.137 s | 0.139 s | **1.02×** | 0.0324 s | 7.6e-08 | | [F16, F16, F16, F32] | 32K | 0.587 s | 1.02 s | **1.73×** | 0.118 s | 9.6e-08 | | [F16, F16, F16, F32] | 64K | 3.38 s | 7.73 s | **2.29×** | 0.432 s | – | | [F16×5, F32] | 16K | 0.163 s | 0.138 s | **0.85×** | 0.0304 s | 8.0e-08 | | [F16×5, F32] | 32K | 0.629 s | 1.01 s | **1.61×** | 0.106 s | 9.7e-08 | | [F16×5, F32] | 64K | 3.09 s | 7.84 s | **2.53×** | 0.408 s | – | | [F16×6, F32] | 16K | 0.196 s | 0.139 s | **0.71×** | 0.0303 s | 8.0e-08 | | [F16×6, F32] | 32K | 0.691 s | 1.02 s | **1.47×** | 0.104 s | 9.7e-08 | | [F16×6, F32] | 64K | 3.18 s | 7.73 s | **2.43×** | 0.37 s | – | | [F16×7, F32] | 16K | 0.229 s | 0.138 s | **0.60×** | 0.0413 s | 8.0e-08 | | [F16×7, F32] | 32K | 0.712 s | 1.01 s | **1.42×** | 0.115 s | 9.7e-08 | | [F16×7, F32] | 64K | 3.28 s | 7.84 s | **2.39×** | 0.379 s | – | | [F32, F32, F32, F64] | 16K | 0.997 s | 3.64 s | **3.65×** | 0.05 s | 6.6e-12 | | [F32, F32, F32, F64] | 32K | 6.69 s | 29.2 s | **4.37×** | 0.17 s | 3.5e-12 | | [F32, F32, F32, F64] | 64K | 51.2 s | 233 s | **4.54×** | 1.01 s | – | | [F16, F32, F64] | 16K | 1.53 s | 3.64 s | **2.38×** | 0.0499 s | 4.4e-08 | | [F16, F32, F64] | 32K | 11.2 s | 29.2 s | **2.61×** | 0.182 s | 2.7e-08 | | [F16, F32, F64] | 64K | 86.5 s | 233 s | **2.69×** | 1.38 s | – | ```@raw html

Error: ``\|A - LL^T\|_F / \|A\|_F`` in `Float64`, on ``(R/\sqrt{n})(R/\sqrt{n})^T + 10nI`` with ``R`` uniform random. Build is the container build alone; it is also inside every timed call.

### [SYRK: `recsyrk!` into `SymmMixedPrec`](@id bench-syrk)

NextLA's speed over cuBLAS `syrk` at the leaf precision, one panel per configuration (log scale; above 1× is faster than the vendor library, timed in the same run).

![SYRK: NextLA's speed over cuBLAS syrk](/NextLA.jl/docs/src/assets/benchmarks/v4-syrk.svg)

```@raw html
<details><summary>The numbers behind the SYRK chart</summary>
Configuration n NextLA cuBLAS syrk × vendor Build Error
Pure F32 16K 0.241 s 0.31 s 1.28× – 1.0e-06
Pure F32 32K 1.91 s 2.51 s 1.31× – –
Pure F32 64K 21.3 s 27.1 s 1.27× – –
Pure F16 16K 0.0884 s 0.317 s 3.59× – 2.2e-04
Pure F16 32K 0.413 s 3.04 s 7.37× – –
Pure F16 64K 5.57 s 27.2 s 4.89× – –
[F16, F16, F32] 16K 0.323 s 0.309 s 0.96× 0.0807 s 1.0e-04
[F16, F16, F32] 32K 2.26 s 2.49 s 1.10× 0.281 s –
[F16, F16, F32] 64K 22.6 s 27 s 1.19× 1.1 s –
[F16×4, F32] 16K 0.324 s 0.309 s 0.95× 0.0698 s 1.2e-04
[F16×4, F32] 32K 2.28 s 2.49 s 1.09× 0.264 s –
[F16×4, F32] 64K 22.5 s 27 s 1.20× 1.01 s –

```@raw html </details>


Error: Frobenius error of the lower triangle against a `Float64` reference. Build is the container build alone; it is also inside every timed call.

### [TRSM: `unified_rectrxm!` with `TriMixedPrec`](@id bench-trsm)

NextLA's speed over cuBLAS `trsm` at the leaf precision, one panel per configuration (log scale; above 1× is faster than the vendor library, timed in the same run).

![TRSM: NextLA's speed over cuBLAS trsm](/NextLA.jl/docs/src/assets/benchmarks/v4-trsm.svg)

```@raw html
<details><summary>The numbers behind the TRSM chart</summary>
Configuration n NextLA cuBLAS trsm × vendor Build Error
Pure F32 16K 0.32 s 0.316 s 0.99× – 2.2e-07
Pure F32 32K 2.51 s 2.49 s 0.99× – –
Pure F32 64K 18.3 s 19.8 s 1.09× – –
Pure F16 16K 0.122 s 0.313 s 2.57× – 7.0e-04
Pure F16 32K 0.67 s 2.44 s 3.63× – –
Pure F16 64K 5.87 s 18.3 s 3.12× – –
[F16, F16, F32] 16K 0.224 s 0.308 s 1.37× 0.0366 s 6.4e-04
[F16, F16, F32] 32K 1.26 s 2.46 s 1.96× 0.125 s –
[F16, F16, F32] 64K 10.2 s 18.2 s 1.79× 0.471 s –
[F16×4, F32] 16K 0.172 s 0.308 s 1.79× 0.032 s 6.7e-04
[F16×4, F32] 32K 0.927 s 2.46 s 2.65× 0.117 s –
[F16×4, F32] 64K 7.23 s 18.2 s 2.52× 0.409 s –

```@raw html </details>


Error: Frobenius error of ``X`` against a `Float64` reference solve. Left side, upper triangle, no transpose. Build is the container build alone; it is also inside every timed call.

## [Mixed precision: GEMM and LU](@id bench-gemm-lu)

### [GEMM: `recgemm!` into `FullMixedPrec`](@id bench-gemm)

NextLA's speed over cuBLAS `gemm` at the leaf precision, one panel per configuration (log scale; above 1× is faster than the vendor library, timed in the same run).

![GEMM: NextLA's speed over cuBLAS gemm](/NextLA.jl/docs/src/assets/benchmarks/v4-gemm.svg)

```@raw html
<details><summary>The numbers behind the GEMM chart</summary>
Configuration n NextLA cuBLAS gemm × vendor Build Error
[F16, F32] 8K 0.0421 s 0.061 s 1.45× 0.0168 s 1.5e-04
[F16, F32] 16K 0.161 s 0.553 s 3.44× 0.0598 s 1.5e-04
[F16, F32] 32K 1.01 s 4.95 s 4.90× 0.223 s –
[F16, F16, F32] 8K 0.0431 s 0.061 s 1.41× 0.0178 s 1.8e-04
[F16, F16, F32] 16K 0.175 s 0.553 s 3.16× 0.054 s 1.8e-04
[F16, F16, F32] 32K 1.04 s 4.95 s 4.74× 0.203 s –
[F16×4, F32] 8K 0.0475 s 0.061 s 1.28× 0.0191 s 2.0e-04
[F16×4, F32] 16K 0.184 s 0.553 s 3.01× 0.0584 s 2.0e-04
[F16×4, F32] 32K 1.15 s 4.95 s 4.31× 0.202 s –
[F16, F32, F64] 8K 0.76 s 2.72 s 3.57× 0.0227 s 1.5e-04
[F16, F32, F64] 16K 5.68 s 21.7 s 3.82× 0.0734 s 1.5e-04

```@raw html </details>


Error: ``\|C - C_{64}\|_F / \|C_{64}\|_F`` against `Float64` cuBLAS. NextLA sums the `Float16` blocks in `Float32`.

### [LU: `lu_recursive!` on `FullMixedPrec`](@id bench-lu)

NextLA's speed over cuSOLVER `getrf` at the leaf precision, one panel per configuration (log scale; above 1× is faster than the vendor library, timed in the same run).

![LU: NextLA's speed over cuSOLVER getrf](/NextLA.jl/docs/src/assets/benchmarks/v4-lu.svg)

```@raw html
<details><summary>The numbers behind the LU chart</summary>
Configuration n NextLA cuSOLVER getrf × vendor Build Error
Pure F32 8K 0.0368 s 0.0579 s 1.57× – 7.8e-08
Pure F32 16K 0.218 s 0.288 s 1.32× – 7.4e-08
Pure F32 32K 1.61 s 1.91 s 1.18× – –
Pure F16 8K 0.0231 s 0.0579 s 2.51× – 3.2e-05
Pure F16 16K 0.101 s 0.288 s 2.85× – 1.6e-05
Pure F16 32K 0.503 s 1.91 s 3.79× – –
[F16, F32] 8K 0.0547 s 0.0579 s 1.06× 0.0178 s 9.3e-07
[F16, F32] 16K 0.211 s 0.288 s 1.37× 0.0593 s 1.2e-06
[F16, F32] 32K 1.11 s 1.91 s 1.73× 0.214 s –
[F16, F16, F32] 8K 0.0771 s 0.0579 s 0.75× 0.0209 s 1.2e-06
[F16, F16, F32] 16K 0.222 s 0.288 s 1.30× 0.059 s 1.4e-06
[F16, F16, F32] 32K 1.02 s 1.91 s 1.88× 0.202 s –
[F16, F16, F16, F32] 8K 0.122 s 0.0579 s 0.47× 0.0154 s 1.3e-06
[F16, F16, F16, F32] 16K 0.281 s 0.288 s 1.03× 0.0628 s 1.5e-06
[F16, F16, F16, F32] 32K 1.03 s 1.91 s 1.85× 0.195 s –
[F16×4, F32] 8K 0.156 s 0.0579 s 0.37× 0.0189 s 1.3e-06
[F16×4, F32] 16K 0.312 s 0.288 s 0.93× 0.0568 s 1.6e-06
[F16×4, F32] 32K 1.06 s 1.91 s 1.80× 0.209 s –
[F32, F64] 8K 1 s 0.979 s 0.98× 0.026 s 7.1e-11
[F32, F64] 16K 7.52 s 7.5 s 1.00× 0.09 s 5.0e-11
[F16, F64] 8K 0.998 s 0.979 s 0.98× 0.0219 s 9.3e-07
[F16, F64] 16K 7.51 s 7.5 s 1.00× 0.0781 s 1.2e-06
[F16, F16, F32, F64] 8K 0.471 s 0.979 s 2.08× 0.024 s 1.2e-06
[F16, F16, F32, F64] 16K 2.93 s 7.5 s 2.56× 0.0723 s 1.4e-06
[F16, F16, F16, F32, F64] 8K 0.42 s 0.979 s 2.33× 0.0189 s 1.3e-06
[F16, F16, F16, F32, F64] 16K 1.83 s 7.5 s 4.10× 0.0626 s 1.5e-06

```@raw html </details>


Error: ``\|LU - A\|_F / \|A\|_F``.

## [How it was measured](@id bench-method)

- **Machine:** an NVIDIA DGX Spark: a GB10 GPU (compute capability 12.1) with 121 GB of memory shared with the CPU.
- **Code:** NextLA as in this release, on Julia 1.10.14 and CUDA.jl 6.4.2. Each point is divided by the vendor routine timed in the same run.
- **Timing:** one untimed warm-up call, then up to 5 timed calls (2 when a call takes over 10 s, 1 when it takes over 60 s); the fastest is kept. Each call ends with `CUDA.device_synchronize()`, so work started in `@async` tasks is inside the time. The mixed-precision container is built inside the timed call; its build is also timed on its own. The GPU is idle before each call.
- **Inputs** (those of paper [3]'s experiments): Cholesky, uniform random plus ``nI`` (Pure `Float16`: scaled to the `Float16` range, plus ``100I``); SYRK, ``0.1\,\mathrm{randn}`` in the leaf type, ``C = 0``, ``\alpha = -1``, ``\beta = 1``; TRSM, left side, upper triangle, no transpose, ``\alpha = 1``; GEMM, ``C \leftarrow C - AB`` into a `FullMixedPrec` with ``A`` and ``B`` in the off-diagonal precision; LU, uniform random plus ``2nI``, unpivoted. Standard flop counts.
- **Sizes:** 16K, 32K and 64K; GEMM and LU 8K, 16K and 32K. `Float64` SYRK and TRSM at 64K are not measured: they need 120–137 GB. Errors are measured outside the timing, up to 16K (32K for Cholesky).
- **Not measured:** mixed-precision TRMM, adaptive precision and real-world matrices.

## [Run it on your machine](@id bench-run)

`benchmark/run.jl` in the repository times NextLA's routines, dense and mixed precision, against the vendor libraries on your machine, synchronized the same way (`CUDA.device_synchronize()`) and keeping the fastest of several calls. From the NextLA folder, set up the benchmark environment once (add CUDA.jl for an NVIDIA GPU):

```bash
julia --project=benchmark -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()'
julia --project=benchmark -e 'using Pkg; Pkg.add("CUDA")'

Then run every routine, or name some:

julia --project=benchmark benchmark/run.jl                                 # every routine, on one device: the GPU if CUDA works, else the CPU
julia --project=benchmark benchmark/run.jl potrf trsm --mixed=F16/F32      # some routines, one mixed configuration

It prints a GFLOP/s table per routine and writes every point to a results file. The options and the timing rule are in Running the benchmarks (benchmark/README.md).