---
title: 'XBraid: Parallel-in-Time Solver'
url: https://www.emergentmind.com/topics/xbraid
type: topic
---

# XBraid: Parallel-in-Time Solver

XBraid is an open-source software library, and a mature, non-intrusive C library, for bringing parallelism to the time dimension of unsteady simulations and unsteady PDE solvers. Its core algorithm is multigrid reduction in time (MGRIT), implemented in FAS form, and its central design choice is to wrap an existing, user-supplied time propagator rather than require a reformulation of the underlying discretization. In this way, XBraid parallelizes not only in space but also in the time domain, computes unsteady solutions parallel in time, extends the same non-intrusive structure to discrete adjoint sensitivity analysis, and can embed primal and adjoint iterations into simultaneous optimization workflows such as the One-shot method [1705.00663][1801.06356][2509.22156].

## 1. Space–time formulation and MGRIT structure

For a one-step method, XBraid assumes a user-supplied propagator
$$
u_{n+1} = \Phi(u_n,p), \qquad n = 0,1,\ldots,N-1,
$$
or, in the notation used for unsteady PDE solvers,
$$
u^i = \Phi^i(u^{i-1},\rho), \qquad i=1,\ldots,N.
$$
The same progression can be written as a residual equation
$$
R_{n+1}(u_{n+1},u_n,p) = u_{n+1} - \Phi(u_n,p) = 0,
$$
or, for linear time stepping, as a block lower bidiagonal space–time system. XBraid does not advance this system strictly sequentially. Instead, it views the entire time grid as a single space–time problem and applies an iterative multigrid algorithm in time [1705.00663][1801.06356].

MGRIT constructs a hierarchy of temporal grids by coarsening the time grid by a factor $m$ or $k$, classifying time points into C-points and F-points. On each level, relaxation sweeps and coarse-grid correction are applied. F-relaxation updates F-point values by propagating forward from the left C-point using the fine-grid propagator; these intervals are independent and computed concurrently. C-relaxation updates C-points using a coarse operator that approximates the $m$-fold composition of the fine propagator. A common pattern is FCF-relaxation: one sweep over F-points, one over C-points, followed by another F sweep. Intergrid transfer uses injection for restriction and prolongation, with prolongation augmented by relaxation to fill F-points. Standard V- and F-cycles can be used [1705.00663].

In the nonlinear case, XBraid uses FAS so that coarse-grid equations remain consistent with the current fine-grid iterate. One MGRIT cycle can be written as a nonlinear fixed-point operator
$$
u_{k+1} = H(u_k,p),
$$
which converges to the sequential time-stepping solution on the finest grid. The same viewpoint is used in the optimization literature, where the fixed-point equation $u = H(u,\rho)$ becomes the constraint for simultaneous optimization [1705.00663][1801.06356].

XBraid’s relation to other parallel-in-time methods is explicit in the literature. With two levels, MGRIT is equivalent to Parareal; with more levels, it achieves better concurrency and communication scaling. PFASST also uses nonlinear FAS ideas, whereas XBraid emphasizes wrapping arbitrary one-step propagators with minimal code changes. Schwarz-type time-parallel preconditioners offer concurrency bounded by subdomain sizes; XBraid’s concurrency is set by the temporal coarsening factor, which can be as small as $2$ [1705.00663].

## 2. Non-intrusive software interface and execution model

The library’s non-intrusive character is defined operationally. XBraid requires a small wrapper layer around an existing time-stepping code rather than a rewrite of the solver. In the adjoint paper, this wrapper consists of an application structure `App` holding time-grid metadata, MPI communicators, parameters, and any running objective; a vector structure storing a solution snapshot at one time point; a `my_Step` routine that advances the state from one time point to the next; a `my_Access` routine that evaluates per-time-step outputs; vector utilities such as init, clone, sum, norm, and free; and MPI pack/unpack routines so that states can move across processors and grids [1705.00663].

The simultaneous optimization paper describes the same pattern in multigrid language. Users supply callbacks for state stepping, state creation/cloning and destruction, basic linear algebra actions, and communication hooks to move data between levels and time partitions. For nonlinear problems, a residual or “apply” routine consistent with FAS is also supplied. The functional iterations that solve an implicit Crank–Nicolson step can remain untouched inside $\Phi^i$; XBraid orchestrates multilevel relaxation, coarse-grid correction, and inter-level communication around them [1801.06356].

The 2025 combination-method paper adds implementation details that are important for large-scale use. XBraid is described there as supporting variable/adaptive time-step sizes, distributing time steps across MPI processes in blocks that include each C point and the subsequent F points, and increasing per-process memory by a factor $O(\log_c N)$ relative to sequential stepping. By default, XBraid can store only C points and reconstruct F points by F-relaxation when needed; this was the mode used in that paper. A plausible implication is that XBraid’s non-intrusiveness is not limited to a narrow class of fixed-step integrators, but extends to broader temporal configurations so long as the propagator interface is respected [2509.22156].

This interface design is the main reason XBraid is described as non-intrusive across the papers. The user exposes the existing stepper and object-management routines through XBraid’s interface; XBraid then reformulates the serial time march into a global iterative solve over a hierarchy of time grids [1705.00663][1801.06356].

## 3. Discrete adjoint formulation and parallel-in-time sensitivities

XBraid’s adjoint extension was introduced as a consistent discrete adjoint solver for the MGRIT iteration. For objectives of the form
$$
J(u,p) = \sum_{n=0}^{N} j_n(u_n,p)
\qquad\text{or}\qquad
J(u,p)=j(u_N,p),
$$
the standard discrete adjoint recursion for a one-step method is
$$
\lambda_N = \frac{\partial j_N}{\partial u_N}, \qquad
\lambda_n = \left(\frac{\partial \Phi(u_n,p)}{\partial u_n}\right)^T \lambda_{n+1} + \frac{\partial j_n}{\partial u_n},
$$
with gradient
$$
\frac{\partial J}{\partial p}
=
\sum_{n=0}^{N-1}
\left[
\left(\frac{\partial \Phi(u_n,p)}{\partial p}\right)^T \lambda_{n+1}
+
\frac{\partial j_n}{\partial p}
\right].
$$
In XBraid, however, the primal solver computes $u$ by iterating $u_{k+1}=H(u_k,p)$, so the adjoint is formulated for the fixed-point equation:
$$
\tilde u = \nabla_u J + \left(\frac{\partial H}{\partial u}\right)^T \tilde u,
\qquad
\nabla J = \nabla_p J + \left(\frac{\partial H}{\partial p}\right)^T \tilde u.
$$
The primal and adjoint can also be advanced piggyback:
$$
u_{k+1}=H(u_k,p), \qquad
\tilde u_{k+1}=\nabla_u J(u_k,p)+\left(\frac{\partial H(u_k,p)}{\partial u}\right)^T \tilde u_k.
$$
The papers report that this simultaneous iteration converges at the same asymptotic rate, with the adjoint typically lagging slightly behind the primal [1705.00663][1801.06356].

The implementation mechanism is reverse-mode AD over an “action tape” of the primal XBraid iteration. The tape records the sequence of XBraid calls to user routines such as `my_Step`, `my_Access`, clone, sum, and MPI pack/unpack. Adjoint replay traverses this tape in reverse and applies differentiated versions of those actions. Schematically, `my_Step_adjoint` updates the previous-time adjoint and accumulates parameter-gradient contributions through Jacobian-transpose times vector products, while `my_Access_adjoint` adds the derivatives of the instantaneous objective with respect to state and parameters. Linear utility routines propagate adjoints according to their linear operations, and MPI pack/unpack reverse as send↔recv of adjoint buffers. The prototype implementation used reverse-mode AD with CoDiPack, but the interface also admits hand-coded adjoints or algorithmic Jacobian-vector products [1705.00663].

The validation case in the 2017 adjoint paper couples a far-wake advection-diffusion PDE to a near-wake nonlinear oscillator. The PDE is
$$
\partial_t v(t,x) + a\,\partial_x v(t,x) - \mu\,\partial_{xx} v(t,x)=0,
$$
with
$$
v(t,0)-\mu\,\partial_x v(t,0)=z(t),\qquad
\partial_{xx} v(t,1)=0,\qquad
v(0,x)=1,
$$
and the oscillator is
$$
[\dot z,\dot w]^T=[w,\,-z+\rho(1-z^2)w]^T,
\qquad z(0)=w(0)=1.
$$
The parameters were $a=1$, $\mu=10^{-5}$, and $T=30$, with $\rho>0$ as the design variable. Time discretization used implicit Crank–Nicolson, advection used second-order linear upwind, diffusion used central differences, and nonlinear solves at each time step used functional iterations wrapped in `my_Step`. The objective was
$$
J(u,\rho)=\frac{1}{T}\int_0^T \|u(t,\cdot)\|_2^2\,dt.
$$
For $N=60{,}000$, $120{,}000$, and $240{,}000$, with temporal coarsening $m=4$ and up to three levels, the adjoint solver’s gradient matched finite differences within roughly $0.2$–$2\%$, and strong scaling curves for the adjoint closely followed the primal [1705.00663].

The same study reported weak-scaling speedups over serial of approximately $2.84$, $5.97$, and $6.31$ for the primal at $(64,60k)$, $(128,120k)$, and $(256,240k)$, and approximately $2.22$, $4.23$, and $5.21$ for the adjoint at the same configurations. The adjoint runtimes were roughly $12\times$ the primal, close to a $10\times$ ratio also observed in serial runs; the extra approximately $1.2\times$ overhead was attributed to AD-based recording/replay and adjoint orchestration in XBraid [1705.00663].

## 4. Embedding XBraid in simultaneous optimization

The 2018 optimization paper extends XBraid from simulation and sensitivity analysis to simultaneous optimization with unsteady PDEs. The method embeds the primal and adjoint XBraid iterations into the One-shot framework, which updates design variables after each state and adjoint update rather than waiting for full convergence of the PDE and adjoint solves. The optimization problem is written as
$$
\min_{u,\rho} J(u,\rho)\quad \text{s.t.}\quad u=H(u,\rho),
$$
and the coupled iteration is
$$
u_{k+1}=H(u_k,\rho_k),
$$
$$
\bar u_{k+1}=\nabla_u J(u_k,\rho_k)+\left(\partial_u H(u_k,\rho_k)\right)^T\bar u_k,
$$
$$
\rho_{k+1}
=
\rho_k
-
B_k^{-1}
\left[
\nabla_\rho J(u_k,\rho_k)
+
\left(\partial_\rho H(u_k,\rho_k)\right)^T\bar u_k
\right].
$$
In the reported tests, a simple constant preconditioner $B_k=\theta I$ with $\theta=0.9$ yielded robust descent [1801.06356].

The paper also introduces an augmented Lagrangian merit function,
$$
L^a(u,\bar u,\rho)
=
\frac{\alpha}{2}\|H(u,\rho)-u\|^2
+
J(u,\rho)
+
\bar u^T(H(u,\rho)-u),
$$
and states that if $\alpha > 2l/(1-\eta)$, where $\eta$ is the MGRIT contractivity and $l$ quantifies adjoint time lag, then $L^a$ is an exact penalty and descent of $L^a$ implies convergence to an optimal solution. The paper reports convergence even with $\alpha=0$ in the test problem, that is, when using the reduced gradient only [1801.06356].

The validation problem is again advection-dominated flow control based on the Van-der-Pol oscillator and the 1D advection–diffusion equation, but with a tracking-type cost functional and Tikhonov regularization:
$$
J = \frac{1}{2}\left(\frac{1}{T}\int_0^T \|u(t,\cdot)\|^2\,dt - a_{\text{target}}\right)^2 + \frac{\gamma}{2}\|\rho\|^2,
$$
with $\gamma=10^{-6}$ and $a_{\text{target}}$ computed from $\rho_{\text{target}}=3$. The discretization used $N=60{,}000$, $\Delta t=5\times 10^{-4}$, $T=30$, $L=100$ spatial points, $\Delta x=10^{-2}$, implicit Crank–Nicolson in time, second-order linear upwind for advection, central differences for diffusion, MGRIT coarsening $m=4$, and three temporal levels. CoDiPack generated the derivatives required for adjoint computations [1801.06356].

At fixed design $\rho=2$, both primal and adjoint residuals dropped simultaneously, with the adjoint showing the expected time lag. Strong scaling showed that speedup over the time-serial forward/backward loops begins beyond approximately $16$ processors; at $128$ processors, speedups of approximately $3.15$ for the state and approximately $3.48$ for the adjoint were reported. In optimization, the One-shot method reached the stopping criterion $\|\text{reduced gradient}\|\le 10^{-7}$ in $22$ iterations, and the objective leveled off at the regularization scale. With $256$ time processors, the reported timings were $199\,\text{s}$ for time-serial reduced-space, $47\,\text{s}$ for time-parallel reduced-space, and $10\,\text{s}$ for time-parallel One-shot, corresponding to a $19\times$ speedup of the time-parallel One-shot method over the classical time-serial reduced-space method. Optimization overhead relative to a pure time-serial simulation of $1.6\,\text{s}$ was reduced from $124.4\times$ to $6.3\times$ [1801.06356].

These results suggest that XBraid is not only a solver wrapper, but also a fixed-point framework in which state, adjoint, and design variables can be evolved simultaneously when the application admits a discrete adjoint and a reduced-gradient update.

## 5. Convergence theory, Runge–Kutta choices, and practical tuning

A substantial part of XBraid-related practice is selecting time integrators, coarsening factors, and relaxation schemes that lead to robust MGRIT convergence. For the linear model problem
$$
u'(t) + L u(t) = f(t), \qquad t\in(0,T], \qquad u(0)=u_0,
$$
with $L$ symmetric positive definite or skew-symmetric, the 2019 analysis studies two-level Parareal and MGRIT with Runge–Kutta time integration. With fine-grid and coarse-grid propagators derived from RK stability functions,
$$
\lambda(z)=R_f(-z), \qquad \mu(z)=R_c(-kz), \qquad z=h_t \xi,
$$
the two-level convergence bounds are expressed by
$$
\varphi_F := \sup_{z\ge 0} \frac{|\mu(z)-\lambda(z)^k|}{1-|\mu(z)|},
\qquad
\varphi_{FCF} := \sup_{z\ge 0} \frac{|\lambda(z)|^k |\mu(z)-\lambda(z)^k|}{1-|\mu(z)|}.
$$
For SPD $L$, these are the main a priori predictors of the two-level convergence factor [1906.06672].

The principal conclusion is that not all RK schemes are equal from the perspective of parallel-in-time. For SPD problems, if both fine and coarse RK methods are L-stable, then
$$
\lim_{z\to\infty}\varphi_F = 0, \qquad \lim_{z\to\infty}\varphi_{FCF}=0,
$$
and the method attains $h_x$- and $h_t$-independent convergence across the full spectrum including very stiff modes. Backward Euler, SDIRK22, SDIRK33, and ESDIRK-32 are listed as L-stable examples. By contrast, A-stable but not L-stable schemes such as trapezoidal/Crank–Nicolson, implicit midpoint, Gauss–Legendre, and ESDIRK-33 can lose this property; two-level convergence is then restricted to particular ranges of $h_t\xi$, and $O(1)$ changes in $h_t$ or the coarsening factor can change the worst-case factor from $\rho\approx 0.02$ to divergence [1906.06672].

For XBraid configuration, the paper’s guidance is explicit. If both fine and coarse schemes are L-stable, then coarsening factors $k=4$–$8$ typically yield robust, $h$-independent two-level convergence; FCF still improves rates, but F-relaxation may suffice for small to moderate $z$. If an A-stable fine scheme must be used, the coarse scheme should be L-stable, FCF relaxation should be turned on, and larger $k$, often in $[8,16]$, is much more robust; odd $k$ may help for certain A-stable schemes. For skew-symmetric operators, $h$-independent convergence cannot be obtained in general, and the recommendation is backward Euler with small $k$ and limited coarse levels [1906.06672].

The same study connects these results to practical XBraid diagnostics. If per-iteration space–time residual reduction stagnates or $\rho\ge 1$, the proposed remedies are to check coarse-grid stability, reduce $k$, switch the coarse integrator to an L-stable method, increase $k$ and switch on FCF, or reduce $h_t$. A Mathematica notebook for a priori two-grid analysis is available at `https://github.com/XBraid/xbraid-convergence-est` [1906.06672].

Within the broader XBraid literature, these theoretical results clarify earlier empirical observations. The 2017 adjoint paper reports that larger coarsening led to instability in the nonlinear solver at coarse levels in an advection-dominated test, and the 2018 optimization paper notes that hyperbolic or advection-dominated problems often need careful parameter tuning and converge more slowly than parabolic ones. The 2019 analysis provides a mechanism for those observations in terms of RK stability, spectral location, and coarsening sensitivity [1705.00663][1801.06356][1906.06672].

## 6. Application domains, large-scale couplings, and limitations

XBraid has been used in at least three distinct roles: as a time-parallel primal solver, as a time-parallel adjoint and optimization engine, and as the temporal component of larger multiscale or multidimensional solver stacks. In the 2025 parabolic-problem paper, XBraid is the time-parallel component of a three-scale solver consisting of MGRIT in time, the sparse grid combination method in space, and a space-filling-curve domain decomposition method for each spatial subproblem. The authors chose XBraid for its maturity, non-intrusive C implementation, and support for variable/adaptive time-step sizes [2509.22156].

That paper formulates the semi-discrete problem for each spatial subproblem $l$ as
$$
u_{l,0}=g_{l,0}, \qquad
u_{l,n}=\Phi_{l,n}(u_{l,n-1}) + g_{l,n},
$$
with backward Euler typically used,
$$
\Phi_{l,n} = \left(1+\Delta t_{l,n} {\cal L}_{l,n}\right)^{-1},
\qquad
g_{l,n} = \left(1+\Delta t_{l,n} {\cal L}_{l,n}\right)^{-1}\Delta t_{l,n} f_{l,n}.
$$
Time coarsening uses a factor $c>1$, with $c=2$ in the experiments, and XBraid implements F-relaxation, C-relaxation, and combinations like CF and FCF, with prolongation given by injection followed by F-relaxation and restriction discarding F-points. Two integration strategies are described: $\mathrm{CTMGRIT}^{sg}$, which applies MGRIT on the sparse grid with one global time partition, and $\mathrm{CTMGRIT}^{loc}$, which applies MGRIT on each subproblem with subproblem-specific time partitions and recombination only at selected times [2509.22156].

The reported applications include the heat equation up to $d=6$, chemical master equation models of 2D and 3D genetic toggle switches, and Fokker–Planck equations associated with linear SDEs. For the heat equation, the median MGRIT iterations per space-time subproblem were essentially independent of dimension $d$, global level $L$, and anisotropy. For $\mathrm{CTMGRIT}^{loc}$ with $L=19-d$, $S=10$, and $\hat P^t=\hat N_t$, the numbers of available processes were reported as $5636\cdot\hat N_t$ for $d=2$, $38966\cdot\hat N_t$ for $d=3$, $136452\cdot\hat N_t$ for $d=4$, $292727\cdot\hat N_t$ for $d=5$, and $425610\cdot\hat N_t$ for $d=6$ [2509.22156].

For the 2D oscillator Fokker–Planck example on $[-10,10]^2$, with backward Euler, $\Delta t=0.005$, coarse factor $c=2$, and $T_{\text{end}}=100$, the reported average runtime of $\mathrm{CTMGRIT}^{loc}$ was $10385\,\text{s}$ on $1760$ processes, compared with $11595\,\text{s}$ for the full-grid sequential method on $176$ processes and $66449\,\text{s}$ for full-grid XBraid on $1760$ processes. The maximum error over time at the origin was $0.00085$ for $\mathrm{CTMGRIT}^{loc}$, $0.00098$ for the sequential full-grid method, and $0.00096$ for full-grid XBraid. When the sequential full-grid method was forced to the same $1760$ processes, runtime degraded to $61890\,\text{s}$, which the paper interprets as communication overhead dominating at high spatial concurrency; XBraid’s time concurrency enabled speedups beyond pure spatial parallelization [2509.22156].

The literature also states XBraid’s limitations with comparable precision. Coarse-level instability for stiff or highly advective problems can limit the number of levels or require tailored coarse operators and relaxation tuning. Both serial time stepping and MGRIT are $O(N)$ optimal, but MGRIT has a larger constant per iteration, so a sufficient number of time processors is required to beat the serial solve. The multigrid constant-factor overhead is described as often $10$–$20\times$ compared to optimal sequential stepping. Adjoint-based optimization further requires consistent derivatives of the discrete integrator and objective, whether supplied by automatic differentiation, hand-coded derivatives, or Jacobian-vector products. In large multilevel settings, memory and communication trade-offs remain significant, although storing only C points mitigates the memory footprint [1705.00663][1801.06356][2509.22156].

Across these studies, XBraid is positioned as a multilevel, non-intrusive infrastructure for temporal parallelism whose practical identity is defined by three recurring properties: it wraps existing one-step propagators with minimal code changes, it extends the same abstraction to adjoints and gradients, and it can serve as the time-parallel backbone inside more elaborate solver architectures. The reported evidence spans unsteady flow, adjoint sensitivity analysis, simultaneous optimization, and parabolic problems with up to six space dimensions [1705.00663][1801.06356][2509.22156].

Source: https://www.emergentmind.com/topics/xbraid