NextLA.jl

NextLA tests

test/runtests.jl runs the tests with ParallelTestRunner.jl: each test runs in its own Julia process, several at once, and a test that fails does not stop the others. A summary with the time and memory of each test is printed at the end.

Running

Run the tests from the NextLA folder with Julia 1.10 or newer. Everything after -- goes to the test runner. A shortcut keeps the commands short (bash or zsh; ParallelTestRunner’s docs suggest a similar one):

alias nlatest='julia --project -e "using Pkg; Pkg.test(test_args=ARGS)" --'

The first run takes longer: Pkg sets up and precompiles the test environment.

Choosing tests

Every test is named by its path without .jl, e.g. dense/lapack/qr/geqrt. A name selects every test that starts with it; ! leaves tests out.

nlatest                                   # everything: dense and mxp
nlatest --list                            # the test names; × marks those that failed last time
nlatest mxp                               # one part: dense or mxp
nlatest dense/lapack/qr                   # one folder
nlatest mxp/blas/trsm/rectrxm_mixed       # one file
nlatest dense/lapack/qr/geqrt mxp/core    # several
nlatest '!mxp'                            # everything except mxp

--list remembers the last run for each Julia version and each --backends choice, so after a failure you can rerun just the tests it marks.

GPU backends

Each test runs on the CPU and on each GPU backend that is installed in the test environment and working (CUDA, AMDGPU, oneAPI, Metal), except where a routine exists only for some backends: then its test runs only there, e.g. the blocked Cholesky of dense/lapack/cholesky/potrf_blocked on GPUs only. No GPU package is a test dependency, so a plain run installs none and runs on the CPU. To test on a GPU, add its package to the test environment once (this edits test/Project.toml; do not commit that change):

julia --project=test -e 'using Pkg; Pkg.add("CUDA")'    # or AMDGPU, oneAPI, Metal

To run on the GPU, define nlatest with --backends; it then applies to every test (the list is comma-separated: CPU, CUDA, AMDGPU, oneAPI, Metal):

alias nlatest='julia --project -e "using Pkg; Pkg.test(test_args=ARGS)" -- --backends=CUDA'
nlatest                        # every test, CUDA only
nlatest mxp                    # the mixed-precision tests, CUDA only

Use --backends=CPU,CUDA for both, or --backends=CPU for the CPU alone (no GPU package is loaded). --backends can be given only once, so to change it, define nlatest again; without --backends, as at the top, every usable backend runs.

Choosing cases inside the tests

Most tests loop over sizes, types and flags. These options set what those loops run; anything not given keeps the test’s own values.

Types and flags work on any selection, and run only the values a test has:

nlatest --types=Float32,ComplexF32 mxp      # only these element types
nlatest --uplo=L --side=R dense/blas/trsm   # only these flag values
nlatest --trans=N,T --diag=U                # trans N, T or C; diag N or U
nlatest --precisions=Float16,Float32,Float64 mxp   # mixed precision: this precision list in place of the test's
nlatest --threads=8                         # threads for the checks of parallel routines (default 4)

Sizes and block sizes are your own numbers, for one test at a time, since n means something different in each test. --params lists what a test takes, what each number means and its default values:

nlatest --params dense/blas/trsm/trsm                     # the test's options
nlatest --m=4,8 --n=300,1000 dense/blas/trsm/trsm         # every combination of m and n
nlatest --m=500 --n=200 --ib=16 dense/lapack/qr/geqrt     # sizes and the inner block size
nlatest --n=128 --tile=16 dense/lapack/lu/lu_tiled        # the order and the tile size (a GPU test)

The number options are --m, --n, --k (sizes), --ib (inner block size), --block (block size), --tile and --batch (matrices in a batch). A test’s sizes go together: a test of m and n needs both. A combination the test cannot take (for example an ib larger than LAPACK allows) is skipped, and the output says why; so is a type or flag the test does not run. Checks written for one fixed case (an edge case, an error check, a fixed size inside the check) keep their values. The first lines of the run list the options in force; several values are separated by commas.

Speed and output

nlatest --jobs=4                            # 4 tests at once
nlatest --jobs=1                            # one test at a time
nlatest --quickfail                         # stop at the first failing test file
nlatest --failfast                          # stop each test file at its first failing check
nlatest --verbose                           # more output (start and set-up times)
nlatest --gpu-debug                         # say why a GPU backend was skipped
nlatest --no-float64 --backends=CUDA        # run a GPU as one without Float64 (as Metal)

Another Julia version

With juliaup, define nlatest with the version (+1.10, +release, +nightly, …) and, if needed, --backends:

alias nlatest='julia +1.10 --project -e "using Pkg; Pkg.test(test_args=ARGS)" -- --backends=CUDA'
nlatest mxp                    # the mixed-precision tests on Julia 1.10, CUDA only

From the Julia REPL

Start Julia with julia --project in the NextLA folder (with juliaup, julia +1.10 --project for another version). Pkg.test takes the same arguments as nlatest, written between backticks; this is also the way on Windows:

using Pkg
Pkg.test("NextLA")                                                   # everything
Pkg.test("NextLA"; test_args=`--list`)                               # the test names
Pkg.test("NextLA"; test_args=`mxp`)                                  # one part
Pkg.test("NextLA"; test_args=`dense/lapack/qr/geqrt mxp/core`)       # several
Pkg.test("NextLA"; test_args=`'!mxp'`)                               # everything except mxp
Pkg.test("NextLA"; test_args=`--backends=CUDA mxp`)                  # mxp on CUDA only
Pkg.test("NextLA"; test_args=`--jobs=4 mxp`)                         # 4 tests at once
Pkg.test("NextLA"; test_args=`--types=Float32 mxp`)                 # only Float32
Pkg.test("NextLA"; test_args=`--m=500 --n=200 dense/lapack/qr/geqrt`)  # your own sizes, one test

Results

The summary lists every file with its time and memory, and the command ends with an error if any test fails. Broken counts known NextLA bugs, marked so the run still passes; when one is fixed, its test shows as an error until the mark is removed.

Each run prints its random seed. nlatest --seed=1234 mxp/core/blocks gives that test the same random inputs again, on the same Julia version, so a failure can be repeated alone.

What the tests check

Test files

Dense (test/dense)

One test per file, at the same path as the source it tests in src/dense, e.g. dense/lapack/qr/geqrt or dense/blas/gemm/recgemm:

Folder Tests
dense/core NextLAMatrix
dense/blas axpy, gerc
dense/blas/gemm matmul, recgemm, gemmEx, gemm_types, gemm_precision, gemm_batched, gemm_grouped
dense/blas/trsm trsm, trmm, rectrxm, rectrxm_complex, rectrxm_float16, trsm_batched
dense/blas/syrk syrk, syrk_kernel, recsyrk
dense/lapack/lu lu_base, lu_pivot, lu_tiled, reclu
dense/lapack/cholesky potrf, potrf_kernel, potrf_register, potrf_blocked, recpotrf, potrf_batched
dense/lapack/qr geqr2, geqrt, larfg, larf, larft, larfb, unmqr, tsqrt, tsmqr, ttqrt, ttmqr, parfb, pamm, pemv
dense/lapack/rotations lartg

A test with a suffix is one part of a larger test, e.g. dense/blas/trsm/rectrxm_complex. Their shared helpers (LAPACK reference wrappers, tolerances, backend helpers) are in test/setup/ and loaded by test/setup/dense.jl.

Mixed precision (test/mxp)

One test per source file, at the same path as the source in src/mxp:

Test name Tests
mxp/core/fullmixedprec FullMixedPrec
mxp/core/symmmixedprec SymmMixedPrec
mxp/core/trimixedprec TriMixedPrec
mxp/core/tiledtrimixedprec TiledTriMixedPrec
mxp/core/transposedmixedprec the lazy transpose/adjoint of a container
mxp/core/blocks the argument checks all constructors share, and the block helpers
mxp/core/adaptive adaptive_precisions
mxp/core/quantize quantize, dequantize
mxp/blas/gemm/recgemm_mixedprec recgemm!
mxp/blas/trsm/rectrxm_mixed unified_rectrxm! with mixed-precision containers
mxp/blas/syrk/recsyrk_mixedprec recsyrk!
mxp/lapack/lu/reclu_mixedprec lu_recursive!
mxp/lapack/cholesky/recpotrf_mixedprec potrf_recursive!

mxp/core runs all the container tests, mxp/blas the BLAS routines, and so on.

The helpers shared by these tests (error bounds, test matrices, reference results) are in test/setup/mxp.jl; the comment at its top lists the error bounds.