Skip to content

Performance ​

SELAH's kernels, and whole steps through the stepper, against ADAM's FNL kernels, the code they were carved from, on an NVIDIA A30 (medooza, driver 575.51.03, nvfortran 26.9, OpenACC -gpu=cc80,cuda12.9). The programs are src/bench/selah_bench_kernels.F90 (kernels, M3) and src/bench/selah_bench_stepper.F90 (whole steps, M5). The method and every job are in notes/m3-bench.md and notes/m5-bench.md of the repository.

Setup ​

  • Field: 5 components, 16³ interior cells with 3 ghost cells, 256 blocks, in ADAM's device layout; 109 MB per field.
  • Timing: every launch is synchronous: !$acc wait before system_clock.
    • First, an unreported warm-up pass of every operation.
    • Then 3 passes, alternating which side is timed first.
    • Each operation: the median of 7 trials of 20 launches.
  • Bandwidth reference: a STREAM triad over arrays the size of one field, 816 GB/s.

Results ​

SELAH against ADAM, kernel by kernel

OperationSELAH/ADAMSELAH [GB/s]of triad
stage state (stage 5 of SSP(5,4))0.9695360.66
step update (5 registers)0.9955040.62
copy of a residual into a register0.9955130.63
two-register stage1.0017630.93
stage state, masked1.002–1.0144910.60
step update fused with the step residual—5500.67
whole SSP(5,4) step0.7954270.52

Per kernel, SELAH matches ADAM, to within 3%. On a whole step SELAH is 20% faster. It builds each stage state directly from the solution: 37 field accesses per step, against ADAM's 47, which first copy the solution into every stage buffer (M3 counted 43: the in-place stage also reads its buffer). The time ratio, 0.795, sits on the access ratio, 0.787. This row still copies each residual into its register, as ADAM does; the stepper (below) does not.

Neither code reaches 80% of the triad. The kernels stream 6 to 8 arrays over the interior of each block, a gap every 256 contiguous values; the triad streams 3 contiguous arrays.

Whole steps through the stepper ​

Whole steps on the A30

Time per step and field accesses per step, job 1368116 (pass 2): ADAM in brown, SELAH in blue.

The stepper driven as a solver drives it, the residual left in its register (the caller's work, the same on both sides). Field accesses per step over the interior, counted from the code before the runs; job 1368100.

StepAccessesTime [ms]GB/s
ADAM SSP(5,4)474.569432
ADAM FLUME SSP(5,4) + its step residual kernel534.948449
SELAH stepper SSP(5,4), Butcher272.688421
SELAH stepper SSP(5,4), Butcher, step residual fused282.714433
the same, stages_on_q=.true. (stage 1 evaluated on q; job 1368116)262.552427
SELAH stepper SSP(10,4), Butcher776.399505
SELAH stepper SSP(10,4), Ketcheson's two registers392.322705
  • With the step residual, a SELAH step costs 0.548 of ADAM FLUME's (accesses: 0.528); without it, 0.588 of ADAM's (0.574). Three passes of the field are gone: the copy of the solution into every stage buffer, the copy of every residual into its register (the caller writes it in place, into rhs_register()), and the rereading of every stage for the step residual (fused into the update).
  • The stepper costs nothing: the same kernels called without it take 0.999 of the time.
  • Or no copy at all. With stages_on_q=.true. the caller evaluates stage 1 on q and the stepper skips the copy: 0.940 of the step, 0.515 of ADAM FLUME's (see Stepper).
  • The state of the first stage is a copy. The summing kernel with nothing to sum ran at 0.57 of a copy's speed; selah_stage_state now hands that case to the copy kernel, which made the SSP(5,4) step 4.3% faster.

SSP(10,4) in two registers. Its kernels stream 3 or 4 arrays and reach 0.86 of the triad, so it costs 0.363 of the Butcher form of the same scheme, below its access ratio (0.506). At equal simulated time, with the time step at the SSP limit (coefficient 6 against SSP(5,4)'s 1.508), against SSP(5,4):

SSP(10,4) Ketcheson / SSP(5,4) Butcher
integrator time0.217
residual evaluations0.503
stored fields (with q)3 / 7

A solver's ratio lies between the first two rows, by the share of its step the residual takes. Where accuracy rather than the SSP limit sets the step, this comparison does not apply; it has not been measured.

The history forms ​

The leapfrog and the multistep form keep their history across steps (Stepper: the history). Jobs 1371417 (the base, 78d90fb, with these two operations added to the benchmark) and 1371418 (the night of #10's phase 2), both on gnode01 and started 3 s apart; pass 2:

StepAccessesTime [ms]GB/s
SELAH stepper, leapfrog (h, r and q read; h and q written)50.268782
SELAH stepper, leapfrog-raw (the filter in the same pass)50.268782
SELAH stepper, ab-3 (q and the 3 residual levels read, q written)50.421498
  • The leapfrog did not move when its history went onto the shared bookkeeping: 1.000, 0.996 and 1.000 of the base over the three passes, and every other operation of the benchmark within 0.4 % of it.
  • A multistep step is one pass. ab-3 reads each level once and writes q once; nothing is copied and no residual is evaluated again. Its sum runs through the ring's slot table (the order of the levels, whatever slot holds each), as the Butcher kernels sum their registers, and at their speed (SSP(5,4) Butcher: 421 GB/s); the leapfrog's kernel, with fixed arrays, streams at 0.96 of the triad (816 GB/s), ab-3 at 0.61. The start-up steps (two ssp-22 steps for ab-3) are not timed.
  • The fixed-point stages (#10's phase 4; jobs 1371456, the base ee5d29a, and 1371457, the night's tree with the operation, gnode01, started together). bdf-2 with 3 iterations: E (q and Un−1 read, E written), the first iterate (q, E, Rn read, the stage register written), one iteration in place by selah_lincomb (E and the residual read, written), the update (q, E, the residual read, Un saved, q written): 15 accesses, 1.245 ms, 505 GB/s, the speed of ab-3; an iteration past the first costs 3 accesses. Every other operation within 0.82 % of the base over the three passes (the largest, Ketcheson SSP(10,4), 1.008 in pass 2).

The error estimate ​

#11's phase 1 gave step_error a tolerance per component (a second variant of its kernel, the scalar one unchanged). Jobs 1371468 (the base, 30756de) and 1371469 (the night's tree, with two benchmark operations added), gnode01, started together; dopri-54's step_error after the stages of one step, the 7 residuals and q read, nothing written:

OperationAccessesTime [ms]GB/s
step_error, scalar tolerances81.438233
step_error, a tolerance per component81.438233
  • The component costs nothing. The cell's component, i1+(i5−i1)vl+o, and two reads of five-entry arrays add no time on the A30 (on the host CPU, 0.345 against 0.305 ms).
  • A reduction, not a stream. Three reductions (a max, two sums) over a read-only pass run at 233 GB/s, half the update's 433: the kernel waits for its reductions. It runs once per step attempt.
  • Nothing else moved. Every other operation within 1.04 % of the base over the three passes (Ketcheson SSP(10,4) and ab-3, 1.010 in pass 2).

#11's phase 2 added an error estimate in low storage and a second estimate. Jobs 1371491 (the base, 372e5c8) and 1371492 (the phase's tree, four benchmark operations added; 1371483 and 1371484 the same on its first snapshot), gnode01, started together, the median of three passes:

OperationAccessesTime [ms]GB/s
ssp-43, two-register form and its error accumulator: a whole step and step_error281.833641
ssp-43, Butcher form: a whole step and step_error253.225325
dopri-853 step_error, the first estimate: the 12 residuals and q read131.406388
dopri-853 step_error, the second (second=.true.): the same reads131.407388
  • Fewer registers, faster. The two-register ssp-43 needs 3 registers instead of 5, and its step with the error estimate takes 57 % of the Butcher form's time: its stage kernel fuses the accumulation, every access a stream, while the Butcher form's estimate is a pass of reductions of its own.
  • The second estimate costs a pass. It reads what the first read: a pair that needs both pays two passes of reductions (a fused kernel of the two would read the registers once).
  • Nothing else moved. Every existing operation within 0.37 % of the base (Ketcheson SSP(10,4), 1.0035); the one-estimate step_error of dopri-54 1.436 ms against 1.437.

Dense output, the implicit-stage solvers, the constraints ​

#11's phases 3 and 4. Jobs 1371514 (the base, 9bb5f7e) and 1371515 (the night's tree, seven benchmark operations added), gnode01, started together, the median of three passes (notes/methods-bench-phase34/):

OperationAccessesTime [ms]GB/s
dense_output, dopri-54 at θ=1/2: q and the 7 residuals read, u written90.715528
hermite_output, dopri-54: the same, by the stage-state kernel90.715528
step_constraint, dopri-54, every component ≥0: q and the 7 residuals read80.881381
newton_solver, a 5 × 5 block per cell: E, R, U and 5 columns read, U written91.152327
newton_solver, diagonal: perturb and update80.642522
anderson_mixing%residual, 8 differences held: the kernel and the 18 sums435.488329
newton_krylov, GMRES(16), per Krylov iteration (with the caller's residual)424.260414
  • Dense output is a stage state. Both outputs run the stage-state kernel at 528 GB/s, the rate of the stepper's own stage states (536 GB/s for SSP(5,4)'s stage 5 above).
  • The Newton block pays its LU. 5 × 5 elimination per cell in registers holds it at 327 GB/s; the diagonal form, two streaming kernels, runs at 522.
  • Reductions, not streams. step_constraint (one min over a read-only pass) and Anderson's sums (18 dot products, each a launch with its reduction) run at 330 to 380 GB/s, like step_error's 233 to 388: the kernels wait for their reductions. A Krylov iteration mixes both, 414 GB/s on average over the cycle.
  • Nothing else moved. Every existing operation within 0.43 % of the base (Ketcheson SSP(10,4), 1.0039).

The Nordsieck form ​

#11's phase 5. Jobs 1371520 (the base, 60c67ec) and 1371521 (the phase's tree, four benchmark operations added), gnode01, started together, the median of three passes (notes/methods-bench-phase56/):

OperationAccessesTime [ms]GB/s
nordsieck_stepper, Adams 12, a step: the prediction, the second stage's state, the correction587.290334
nordsieck_stepper, Adams 5, a step302.467510
error_sums at order 5: five reductions over a read-only pass50.580362
set_step at order 12: the 12 columns and Δ rescaled261.494730
  • A step streams its columns twice. The prediction reads and writes every column, the correction too: an Adams-5 step moves 30 fields at 510 GB/s, the rate of the stepper's own kernels; at order 12 the 13 columns held per cell bring it to 334 GB/s.
  • A change of step is cheap. The rescaling streams the columns once at 730 GB/s, near the triad, and needs no reduction: the step can change between any two steps.
  • Nothing else moved. Every existing operation within 0.43 % of the base.

Second-order systems ​

#11's phase 6. Jobs 1371560 (the base, 60c67ec) and 1371561 (the phase's tree, three benchmark operations added), gnode01, started together, the median of three passes (notes/methods-bench-phase56/); the forces are the caller's work and left out:

OperationAccessesTime [ms]GB/s
nystrom_stepper rkn-64, a step: six stage states from q, p and the forces before them, then q and p433.631497
stormer_stepper stormer-8, a step: eight forces, q and yn−1 read, q and yn−1 written120.715704
stormer_stepper cowell-4, a step of two stages: E, the stage state, yn−1, q=E+γR151.028612
  • One field, not two. A Nyström step holds q, p and one force per stage; the first-order form of the same system holds a state twice as large in every register. rkn-64 streams its 43 field accesses at 497 GB/s, the rate of the stepper's Butcher steps.
  • A multistep step is one pass. stormer-8 reads its ring and writes q and yn−1 in one kernel, at 704 GB/s, near the triad; Cowell's implicit stage adds three short passes.
  • Nothing else moved. Every existing operation within 0.87 % of the base.

Magnus integrators ​

#6's G2. Jobs 1371596 (the base, v0.5.0, 71150e4) and 1371597 (the night's tree, two benchmark operations added), gnode02, started together, the median of three passes (notes/magnus-bench/); the blocks and the operator are the caller's work and left out:

OperationAccessesTime [ms]GB/s
magnus_stepper cf4-2, the dense action, 5×5 blocks: the blocks at 2 nodes and q read, q written1217.14929
magnus_stepper cf4-2, the Krylov action, a step: a pointwise rotation, hλ up to 1.94, 13 iterations per exponential78785.624385
  • The dense action is bound by its arithmetic, not by memory. Each cell makes two exponentials of a 5×5 block (the Padé approximant: seven products, an elimination, the squarings) in work arrays of 16×16 private to the thread, whatever the block's size: 17 ms a step, six times an ssp-54 step's 2.7 ms. The arrays sized to the block, or one cell per thread block, are the way to speed it; not done here.
  • The Krylov action costs a stepper step per iteration. 26 iterations a step at 3.3 ms each, 385 GB/s: every iteration streams the basis for its inner products and its subtraction (the sums one launch each, with their reduction), so the cost grows as i2 within a sub-step, and a smaller tolerance or a shorter step pays in iterations. The benchmark counts the accesses from the iterations it measures: they follow the spectrum (13 per exponential with 256 blocks, λ up to 97; 11 with 2 blocks, λ up to 51).
  • Nothing else moved. Every existing operation within 1.65 % of the base (newton_solver's 5×5 blocks, 1.0165; Adams 12, 1.0102; every other within 1 %).