NextLA benchmarks
benchmark/run.jl times NextLA's recursive routines against the vendor libraries, dense and mixed precision. These are the runs behind the Manual's Benchmarks page, so the same command reproduces it on your machine.
Setup
Once, from the NextLA folder:
julia --project=benchmark -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()'To benchmark on an NVIDIA GPU, also add CUDA.jl to the benchmark environment:
julia --project=benchmark -e 'using Pkg; Pkg.add("CUDA")'Running
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 gemm potrf # some routines
julia --project=benchmark benchmark/run.jl '!lu' # all but LU
julia --project=benchmark benchmark/run.jl --list # what would run
julia --project=benchmark benchmark/run.jl potrf --backends=CUDA --n=4096,8192,16384
julia --project=benchmark benchmark/run.jl trsm --types=Float32 --mixed=F16/F32
julia --project=benchmark benchmark/run.jl --backends=CPU --n=1024,2048 --leaf=512A run uses one device, never both: the GPU when CUDA.jl is installed and finds one, otherwise the CPU. --backends=CPU or --backends=CUDA chooses it; to compare the two, run twice.
Run with one Julia thread (the default), as the docs page does. The BLAS library uses its own threads.
The script is three files: run.jl reads the command line and starts the run; routines.jl has the six routines, their test matrices and exactly what each line calls; harness.jl measures the points (the timing rule, the GPU waits) and writes the results.
Routines
| Name | NextLA (dense) | NextLA (mixed precision) | Vendor |
|---|---|---|---|
gemm | recgemm!; gemmEx! with Float16 inputs | recgemm! into FullMixedPrec | mul! (cuBLAS, BLAS) |
syrk | recsyrk!; recsyrk! with Float16 A | recsyrk! into SymmMixedPrec | syrk! |
trsm | unified_rectrxm! (solve) | the same with TriMixedPrec | trsm! |
trmm | unified_rectrxm! (multiply) | the same with TriMixedPrec | trmm! |
potrf | potrf_recursive! | potrf_recursive! on SymmMixedPrec | LAPACK.potrf! (cuSOLVER, LAPACK) |
lu | lu_recursive_nopiv! (no pivoting) | lu_recursive! on FullMixedPrec | LAPACK.getrf! (pivoting) |
All on square n × n matrices: triangles from the lower side, without transposes. The test matrices are random and made well conditioned: n added to the diagonal (triangles, LU), or A + Aᵀ + 2n I (Cholesky).
Options
| Option | Meaning | Default |
|---|---|---|
--backends= | CPU or CUDA, one per run | CUDA if CUDA.jl is installed and works, else CPU |
--types= | dense lines: Float64, Float32, Float16 (Float16 inputs with Float32 accumulation, gemm and syrk only) | all three |
--mixed= | container lines: F32/F64, F16/F64, F16/F32, or none | all three |
--n= | sizes | 4096,8192,16384,32768 (CUDA), 2048,4096,8192,16384 (CPU) |
--leaf= | leaf size of the containers | 4096 (CUDA), 2048 (CPU) |
--reps= | at most this many timed calls per point; the fastest is kept | 5 |
--tmax= | optional cap: skip a line's larger sizes after a call longer than this (seconds) | none: every size runs |
--casemax= | optional cap: skip a line's larger sizes once it has used this much time (seconds) | none |
--cool= | CUDA: before each size, wait until the GPU is at or below this temperature (°C) | off |
--no-vendor | leave out the vendor lines | |
--out= | results file | benchmark-<backend>-<date>.jsonl |
F16/F32 means the off-diagonal blocks are stored in Float16 and the diagonal leaves in Float32, with log₂(n / leaf) levels; at n ≤ leaf the container is one leaf.
How each point is timed
The inputs, and any mixed-precision container, are rebuilt before every call, outside the timer.
The time is the fastest of at least 2 calls, with the device synchronized, so a first call that compiles never stands alone. More calls are made, up to
--reps, only while they are short: the timing stops once a call takes more than 0.3 s or the calls add up to 1 s.Every size runs, however long it takes.
Float64is much slower thanFloat32on many GPUs, so a full run withFloat64up ton = 32768can take hours there;--n,--typesor--tmaxmake it shorter.On CUDA, each size first waits until no other process uses the GPU.
Random inputs are seeded per size (
Random.seed!andCUDA.seed!).GFLOP/s use the standard flop counts:
Routine Flops GEMM 2n³SYRK, TRSM, TRMM n³Cholesky n³/3LU 2n³/3For the mixed-precision lines, the time to build the container is recorded separately (
"kind":"build"), since converting a matrix is not free.
Results
The run prints each point as it goes, then a GFLOP/s table per routine. Every point is also written to the results file, one JSON object per line:
id,backend,setting,impl,variant,n,depth,precisions,kind(timeorbuild),time_s,gflops,reps,status, andmsgfor an error;- a first line,
"id":"__env__", with the device, the Julia version, the NextLA version and the thread counts.
These are the fields of the files behind the docs page.
Notes
- Julia 1.10 is the version the docs page was run with; newer versions work too. A point that fails is reported as an error and the run goes on.
- Only the CPU and CUDA are supported for now. NextLA's routines run on AMDGPU, oneAPI and Metal too, but the vendor comparisons there are not in this runner yet.