Van der Pol#
The Lorenz and Robertson systems are three-dimensional. A lattice of van der Pol oscillators studies how the solvers scale with dimension. One oscillator evolves as
where \(\mu\) sets the stiffness: stiff for \(\mu \gg 1\), mildly non-stiff at \(\mu = 1\). A \(D\)-dimensional system couples \(D/2\) oscillators diffusively in a ring,
with indices modulo \(D/2\) and coupling strength \(d = 10\). Its Jacobian has a
banded, cyclic tridiagonal-block sparsity pattern that couples every
oscillator to the rest of the lattice while leaving the stiffness tunable
through \(\mu\). The non-stiff lattice (\(\mu = 1\)) benchmarks Tsit5 and the
stiff lattice (\(\mu = 100\)) benchmarks Rodas5P, both over \(N = 1000\)
identical trajectories starting from \((x_i, v_i) = (2, 0)\), integrated over
\(t \in [0, 1]\) with output every 0.25, at rtol = 1e-6, atol = 1e-8.
All benchmarks were performed on a single NVIDIA GeForce RTX 4070 SUPER, a
consumer-grade device with a similar number of CUDA cores to, and the same
architecture as, an L4-class datacentre GPU. DiffEqGPU.jl runs with
cpu_offload = 0, so that every trajectory is solved on the GPU. Each point is
measured in a child process of its own, and a point that does not compile and
solve within 600 s is recorded as a timeout and left off the plot. Reported
times exclude compilation: each is the mean over repeated solves after one
warm-up call. The discussion follows Section 3 of the
paper.
Non-stiff: scaling with dimension#

modax Tsit5 is the fastest solver at every dimension and scales roughly linearly with \(D\), since the right-hand side is \(O(D)\) arithmetic per stage and no matrix is factorised. At the smallest dimensions the state and stage vectors fit in registers but eventually they spill to slower but more abundant thread-local memory, cached in L1. Solves start slowing down when the L1 cache too starts to fill up.
uv run python benchmarks/nonstiff_vdp_dimensionality/main.py
Stiff: scaling with dimension#

With sparsity analysis disabled, Rodas5P must store and factorise a dense
\(D \times D\) Jacobian: \(O(D^2)\) memory per trajectory and \(O(D^3)\) work per
step. That the FP32 factorisation performs much like FP64 suggests either that
the solver is memory-bound rather than compute-bound, or that the inexact
Jacobian costs extra steps. Exploiting sparsity is therefore what lets the
solver scale. The lattice’s pattern is banded, so the number of colours, and
with it the number of forward-mode sweeps per Jacobian, is constant in \(D\) and
the Jacobian’s cost grows only linearly. The sparsity-aware FP32 modax solver keeps a
65–120× lead over Diffrax Kvaerno5 across the whole range, while the dense
solvers lose theirs as \(D\) grows. DiffEqGPU.jl’s
EnsembleGPUKernel did not compile and solve within 180 s above \(D = 16\).
uv run python benchmarks/stiff_vdp_dimensionality/main.py
Stiff: Jacobian density#

The dimension sweep keeps nearest-neighbour coupling, so the Jacobian stays
banded and its density falls as \(1/D\). Here the dimension is fixed at \(D = 64\)
and the coupling range – how many places along the ring, on either side,
oscillators are coupled – runs from nearest-neighbour to all-to-all, changing
the number of structurally non-zero entries without changing \(D\); the
coupling strength is divided by the range, so the total coupling stays fixed. The dense
modax solver and its Diffrax and DiffEqGPU.jl counterparts are insensitive to
density, as expected: they always differentiate, store and factorise the full
\(64 \times 64\) matrix. The sparsity-aware modax solver slows as the pattern
fills in, since each extra neighbour adds colour sweeps and fill-in to the
sparse LU, but at 25 per cent density it is still over 15× faster than the
dense solvers. This is not limited to banded systems: any pattern in which a
substantial fraction of the Jacobian is known to be zero benefits. DiffEqGPU.jl’s
EnsembleGPUKernel did not compile and solve within 180s at \(D = 64\).
uv run python benchmarks/stiff_vdp_sparsity/main.py
Stiff: value and gradient#

The cost of the final state together with its gradient with respect to each
trajectory’s damping scale (a parameter multiplying \(\mu\)), which is one sensitivity column integrated alongside the
state (see Computing gradients). modax is differentiated in
forward mode, by jax.vmap(jax.jacfwd(...)) of one trajectory’s loss with the
value as has_aux, which lowers to one kernel launch integrating the joint
system. Diffrax is differentiated by jax.value_and_grad, in reverse mode
through its default recursive checkpointing adjoint. DiffEqGPU.jl
differentiates neither ensemble backend, so it integrates hand-derived forward
sensitivity equations instead. The sparsity-aware modax solver returns value
and gradient at 1.2 to 3.6 times the cost of the plain solve – one extra
forward-mode sweep and one pair of triangular solves per stage for the
sensitivity column – and is roughly two orders of magnitude faster than both
Diffrax and EnsembleGPUArray at every dimension.
uv run python benchmarks/stiff_vdp_gradient/main.py