cd /news/ai-research/yet-another-ode-library-selah-stage-… · home › topics › ai-research › article
[ARTICLE · art-182340] src=fortran-lang.discourse.group ↗ pub= topic=ai-research verified=true sentiment=· neutral

(Yet another ODE library) SELAH: stage-wise time integrators for block-structured solvers on CPUs and GPUs, v0.5.1 is out

SELAH v0.5.1, a Fortran library of stage-wise time integrators for block-structured finite-volume and finite-difference solvers, has been released as the successor to FOODIE, with the same kernel source running on CPUs via OpenMP and on GPUs via OpenACC. SELAH deliberately takes no right-hand side: the solver calls begin_stage and end_stage and performs ghost-cell exchanges, AMR seam filling, boundary conditions and other PDE work between stages, avoiding the indirect calls and polymorphic operators that FOODIE's operator-overloaded integrands incur. The author reports the stepper takes 0.999 of the time of the same kernels called by hand, and that whole SSP(5,4) and SSP(10,4) steps were timed on an NVIDIA A30 with 256 blocks of 16³ cells and 5 components (109 MB per field).

key takeaway

SELAH v0.5.1 gives Fortran PDE solvers stage-wise time integrators whose plain array kernels run on CPU (OpenMP) and GPU (OpenACC) with no callbacks, costing 0.999 of the time of the same kernels called by hand.

read6 min views8 publishedDec 5, 2026

S tage-wise E volution L ibrary for A ccelerators and H PC

SELAH is a modern Fortran library of time integrators for block-structured field solvers: finite-volume and finite-difference codes, AMR or not, whose state is a set of blocks with ghost cells and whose step is limited by memory bandwidth, not by arithmetic. It gives you the schemes’ coefficients, the kernels that do each stage’s arithmetic over your arrays, and a stepper that your solver drives one stage at a time. The same kernel source runs on the host, with OpenMP, and on a GPU through OpenACC. It is the successor of my FOODIE, and v0.5.1 is the first release I announce here (written with the help of an AI assistant).

Disclaimer: why SELAH takes no right-hand side. rklib, ODEPACK, the Fortran interface of SUNDIALS and my own FOODIE solve ordinary differential equations the classical way: you hand them the right-hand side, as a procedure, a callback or a class to extend, and they call it inside their step. SELAH accepts none of these, on purpose, and that choice is its HPC design:

Between two stages, the step is yours. A PDE solver has work to do there that no right-hand-side interface can foresee: ghost-cell and halo exchanges over MPI, AMR seam filling and refluxing, boundary conditions, limiters, a sub-cycled source, a linear solve, diagnostics, whatever your PDE requires. SELAH never calls your code. Your solver calls begin_stage and end_stage, and between them does anything it wants, in its own loops, on its own data, on the CPU or the GPU. A stage contract says what every buffer holds at that moment. And no overhead for that freedom. A callback or a class to extend puts an interface between the integrator and your solver: an indirect call per stage, a signature your residual must fit, and in FOODIE’s case operator-overloaded integrands whose stage arithmetic runs through polymorphic type-bound operators and their temporaries. That is fine for a system of ODEs and too costly where the cells of a large field are swept. In SELAH the stage arithmetic is plain kernels over your arrays, with no polymorphism, procedure pointer or callback in or around them: a step costs its memory traffic and nothing more, and the stepper takes 0.999 of the time of the same kernels called by hand (below). What a state is. For them, a vector. For SELAH, a field of rank 1 to 5 with ghost cells, in two memory layouts, masked or not, of which the kernels write the interior box and nothing else. What a step costs. SELAH counts the field accesses of every step and measures them on the GPU (below), and offers the low-storage forms in 2 registers instead of s + 1. Choose an ODE solver for a system of ODEs with an adaptive step, a stiff problem that needs a Newton solve with a Jacobian, or implicit Runge–Kutta: SELAH gives an error estimate and a step-size rule but no control loop, and its implicit schemes are multistep ones (Adams–Moulton, BDF), solved by fixed-point stages or by your own Newton through stage_gamma. Choose SELAH when the state is a large field, when your PDE needs its own work between the stages, at full speed, or when the step must run on a GPU from Fortran. SELAH looks young, with only five minor releases, but it is not new code: its kernels, its stepper and its catalogue are extracted from ADAM’s integrators and FOODIE’s schemes, with years of use and testing behind them, for accuracy and for performance on CPUs and GPUs. What is new (the schemes of the last releases, the Magnus integrators) is verified the same way (below). The API may still change before v1.0.

Whole SSP(5,4) and SSP(10,4) steps on an NVIDIA A30, 256 blocks of 16³ cells with 5 components (109 MB a field): time and field accesses per step, ADAM’s hand-written integrator in brown, SELAH’s stepper in blue.

1. You drive the stages. One step, as your solver writes it:

call st%initialize(SCHEME_SSP_54, FORM_BUTCHER, lb=lbound(q), ub=ubound(q))
call st%begin_step(bx, q)
do k=1, st%stages()
   call st%begin_stage(k, bx, dt, q)               ! the stepper builds the state of stage k
   u => st%stage_state()
   r => st%rhs_register()                          ! where the residual of stage k goes
   call fill_ghosts(u)                             ! yours: halo exchange, AMR seams, anything your PDE needs
   call residual(u, r, dx)                         ! yours
   call st%end_stage(k, bx, dt, q)
enddo
call st%finish_step(bx, dt, q)                     ! q^{n+1}

stage_weight(k) gives stage k’s effective weight in the step, in every storage form, which is what a flux register needs to reflux an AMR level; the step’s residual can be fused into the update. The stage contract: the stepper’s calls, and the window of each stage where the solver acts.

2. Kernels over your arrays, on the GPU. The stage and update kernels are plain loops over contiguous arrays, with no polymorphism or procedure pointer in or around them, and one source for the host, OpenMP and OpenACC through FUNDAL’s macros. On a GPU the field and the stepper’s registers live in device memory, and nothing crosses the bus during a step. Measured on the A30 (performance):

The box: the kernels write the interior cells and nothing else; ghost cells and pool blocks are never touched.

3. Storage is bandwidth. Two-register, Williamson 2N and Ketcheson forms keep a scheme in 2 registers instead of s + 1, equal to its Butcher form to round-off. SSP(10,4) in Ketcheson’s two registers runs a step in 2.32 ms where its Butcher form takes 6.40 ms; at equal simulated time, with the step at the strong-stability limit, it costs 0.217 of SSP(5,4)'s integrator time and half its residual evaluations.

The registers of each storage form, stage by stage: what the stepper writes, where your residual goes, what is read again.

Every low-storage form against its Butcher form, over 40 steps: round-off.

4. Reproducible. Every kernel sums in a fixed order, so a run repeats bit for bit, and a golden file pins 10880 values on every compiler; double or single precision is chosen at build time.

Seven families, each with its sources and its stability bounds in the schemes page:

Every one of FOODIE’s 86 schemes is among them, and a porting page maps FOODIE’s calls to SELAH’s.

Stability regions, drawn from the library’s own tableaux.

SSP(5,4) at its strong-stability limit (left) keeps the total variation from growing; above the threshold (right) it grows.

Δt = 0.6, 400 steps: the Strang splitting stays on a closed curve near the exact circle; rk4 spirals inwards.

Observed orders of every scheme in every storage form, through the stepper.

Every Magnus scheme at its order, on non-commuting systems.

Long-time energy error of the splittings against Runge–Kutta: bounded.

Gauss’s law per step: the direct deposit against SELAH’s stage currents, kept to round-off.

The gallery has all of them, each opening the page that explains it.

SELAH is the time operator of ADAM, my AMR framework: FLUME, PRISM and RIPPLE step their fields with SELAH’s stepper on the CPU and on the GPU. SETH (WENO and TENO reconstructions) and GIDEON (finite-difference and finite-volume stencils) use it in their tests and examples. It keeps FOODIE’s catalogue and drops FOODIE’s operator-overloaded integrands, which are elegant but cost too much where the cells are swept.

git clone https://github.com/szaghi/SELAH && cd SELAH
fobis fetch && fobis build --mode static-gnu

or

curl -fsSL https://github.com/szaghi/SELAH/releases/latest/download/install.sh | bash

SELAH is also a FoBiS and an fpm dependency, and its only dependencies are my own PENF and FUNDAL. It is available under your choice of license: GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT.

Coming next: diagonally implicit and IMEX Runge–Kutta stages, under the same stage contract, and the dense Magnus exponential’s speed on the GPU (#12).

My best regards.

Stefano

── more in #ai-research 4 stories · sorted by recency
── more on @selah 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/yet-another-ode-libr…] indexed:0 read:6min 2026-12-05 · —