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=512

A 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

NameNextLA (dense)NextLA (mixed precision)Vendor
gemmrecgemm!; gemmEx! with Float16 inputsrecgemm! into FullMixedPrecmul! (cuBLAS, BLAS)
syrkrecsyrk!; recsyrk! with Float16 Arecsyrk! into SymmMixedPrecsyrk!
trsmunified_rectrxm! (solve)the same with TriMixedPrectrsm!
trmmunified_rectrxm! (multiply)the same with TriMixedPrectrmm!
potrfpotrf_recursive!potrf_recursive! on SymmMixedPrecLAPACK.potrf! (cuSOLVER, LAPACK)
lulu_recursive_nopiv! (no pivoting)lu_recursive! on FullMixedPrecLAPACK.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

OptionMeaningDefault
--backends=CPU or CUDA, one per runCUDA 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 noneall three
--n=sizes4096,8192,16384,32768 (CUDA), 2048,4096,8192,16384 (CPU)
--leaf=leaf size of the containers4096 (CUDA), 2048 (CPU)
--reps=at most this many timed calls per point; the fastest is kept5
--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-vendorleave out the vendor lines
--out=results filebenchmark-<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. Float64 is much slower than Float32 on many GPUs, so a full run with Float64 up to n = 32768 can take hours there; --n, --types or --tmax make it shorter.

  • On CUDA, each size first waits until no other process uses the GPU.

  • Random inputs are seeded per size (Random.seed! and CUDA.seed!).

  • GFLOP/s use the standard flop counts:

    RoutineFlops
    GEMM2n³
    SYRK, TRSM, TRMMn³
    Choleskyn³/3
    LU2n³/3
  • For 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 (time or build), time_s, gflops, reps, status, and msg for 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.