Multilevel Interior Penalty Methods on GPUs
Paper · 2024 · Cu Cui and Guido Kanschat
Summary
A high-order finite element method can represent a solution accurately with relatively few unknowns, yet solving the resulting equations can still be expensive. The difficulty grows when the approximation uses higher-degree polynomials and the solver must store and repeatedly read the matrix that couples their coefficients. Cu Cui and Guido Kanschat study this problem for the Poisson equation in two and three dimensions. They combine a discontinuous Galerkin discretization, in which neighboring cells have separate polynomial representations, with a matrix-free multigrid solver. The solver evaluates the action of the discretized operator as needed and uses coarser meshes to correct errors that are hard to remove with local updates. The paper asks how to make those local updates effective on a graphics processor without losing the convergence benefits that make them worth using. GPU & parallel computing
The local updates act on vertex patches, groups of cells that meet at a mesh vertex. A full patch correction can use every coefficient in the patch, but computing its residual requires information from neighboring cells. The authors compare it with a Dirichlet variant, which reads only patch cells and approximates the residual, and a clamped variant, which makes the same local reads while computing the exact residual for a smaller set of test functions. Both variants make individual smoothing steps cheaper. On the Cartesian meshes studied, the authors also use fast diagonalization to solve patch equations through one-dimensional operations and arrange those operations to avoid conflicts in the GPU’s shared memory.
In the three-dimensional convergence experiments, the full patch version gives the smallest fractional iteration counts. The localized versions nevertheless lead to shorter overall solves in the timing comparison, benefiting from smoothing steps that are 4–5 times faster. The clamped version needs many more iterations at low polynomial degree, and its convergence improves as the degree rises. At degree 4, operator application and smoothing reach 39% of the A100’s theoretical double-precision arithmetic peak. Running the multigrid cycle in single precision while keeping the outer GMRES iteration in double precision yields end-to-end speedups of up to 90% in the reported tests. On multiple GPUs, performance depends on how much work each device has. The distributed smoother needs a much larger problem than operator application to reach its best throughput, because patch updates across partition boundaries add communication.
Deep dive: Multilevel Interior Penalty Methods on GPUs
A matrix-free multigrid method speeds up high-order Poisson solves on GPUs through vertex-patch smoothing, tensor operations, and mixed precision. · about 39 minutes to read
The problem and its context
Why a high-order discretization needs a different solver design
The paper studies a boundary-value problem for the Poisson equation. The unknown is a function throughout a domain, and the differential equation relates its curvature to a prescribed source. The boundary condition fixes the function to zero along the outside of the domain. A finite element discretization replaces this continuous problem with equations for a finite set of coefficients. Its mesh divides the domain into cells, and a polynomial represents the unknown within each cell. The polynomial degree determines how much variation the cell can represent. Refining the mesh and raising the polynomial degree are different ways of increasing what the approximation can resolve.
The authors motivate high order through accuracy per degree of freedom. A degree of freedom is an independent quantity used to specify the approximate solution. When a higher-order polynomial represents the solution well on a cell, it can make productive use of those quantities. The resulting calculation also offers the kind of arithmetic that a GPU can exploit. The cost of reaching that calculation matters, however. A conventional assembled method stores the coefficients of a matrix expressing how the unknowns interact. At high order, even a local block of that matrix can grow much larger than the vector of unknowns it acts on. Applying the operator then entails moving a large amount of stored data.
A matrix-free implementation retains the vector of coefficients and evaluates the operator action from the discretization. The advantage comes from the structure of that evaluation. On a tensor-product cell, the basis is built from functions in individual coordinate directions. An operator application can therefore reuse one-dimensional calculations across many lines of values. This makes the arithmetic cheaper than a direct evaluation that treats every direction together, and it reduces the amount of data carried through memory. The paper treats this gain as a starting point for the solver. The same issue of how to get work out of compact data arises again in the preconditioner, which can otherwise become the most expensive part of the calculation.
Discontinuous Galerkin, or DG, adds a complication at cell interfaces. Each cell has its own approximation, so two cells sharing a face can assign different values to points on that face. The discretized equation includes face terms to account for the relationship between the two sides. In the symmetric interior penalty method, these terms use values and gradients taken from the adjacent cells, and a penalty discourages a jump in the approximate solution. The global operator therefore couples cells even though their coefficients are stored separately. That coupling becomes important when the authors ask which data must be read to update a small group of cells.
The cost of a solve has both a numerical and a hardware component. A strong update can make large progress in each iteration, yet cost too much if it gathers scattered coefficients and keeps other updates waiting. A cheap update can use the GPU well, yet make so little progress that the solver must repeat it many times. This tension is particularly clear in multigrid. Its smoothing step should remove error that a coarser mesh cannot represent effectively. If the smoother leaves substantial error at that scale, the coarse correction cannot compensate simply by running faster.
What the authors take from earlier work
The paper places its implementation in a line of work on high-order calculations on graphics processors. The earlier studies it cites include GPU implementations of nodal DG, matrix-free finite element operators, and tensor-product evaluations. Those studies establish the setting for asking how much of the solver can be expressed as regular arithmetic on local data. Cui and Kanschat also draw on previous GPU multigrid work using point Jacobi and Chebyshev smoothing, and on work using tensor-product approximations for block preconditioners in DG discretizations. Nodal discontinuous Galerkin methods on graphics processors
Point Jacobi makes a correction based on individual unknowns and the diagonal of the system. For the authors’ purposes, its appeal is that many such corrections can be computed independently. A block method instead includes the interactions among a group of unknowns in its local solve. This makes it possible to remove error involving combinations of coefficients that an individual update handles poorly. The authors describe smoother quality as important for high-order multigrid convergence. Their objective is to retain a coupled correction while changing how much data the GPU must fetch and how many corrections can run at once.
The geometric multigrid hierarchy itself follows earlier work on multilevel DG methods. The authors also trace vertex-patch smoothing to methods for finite element spaces organized around divergence or curl, and describe previous uses for Stokes and Darcy–Stokes–Brinkman problems. They cite work on localized residual evaluation for continuous elements and on GPU tensor-product patch smoothers. The comparison with continuous finite elements becomes a guide to their DG design. For the continuous case described in the paper, imposing a zero value on the boundary of the patch can confine the residual calculation to the patch. In DG, the face terms make the analogous step more involved.
Earlier approaches to applying the DG operator offered a related choice about where to do the work. A face-wise implementation computes contributions to both cells that meet at a face together. This gives it a chance to share calculations and data associated with the face. Processing one cell at a time collects all of its contributions in one pass and fits a vector organized by cell. Each choice favors a different kind of reuse. The paper’s patch-wise organization groups some cell and face work together, with the aim of retaining contiguous accesses while sharing more of the calculation.
The scope of the design follows from those choices. Cartesian, axis-aligned geometry and constant coefficients give the authors both regular data access and a separable differential operator. The same structure simplifies the local inverses. The paper’s problem is to see how far these properties can be used together, from constructing the fine-grid residual to moving data between levels and sharing the solve across devices.
The method, step by step
From the Poisson equation to cell coefficients
The authors start from a Poisson problem with a homogeneous Dirichlet condition. The word homogeneous here means that the prescribed boundary value is zero. In the interior, the Laplacian measures how the solution varies with position. The problem is posed in the following form.
−Δu = f in Ω, with u = 0 on ∂Ω
Here u is the unknown function, Δ is the Laplacian, and f is the prescribed source. Ω is the computational domain and ∂Ω is its boundary. The leading minus sign is part of the Poisson operator used in the paper. The domain has spatial dimension d, with d equal to 2 or 3 in the study.
The mesh supplies a collection of cells on which to approximate u. Within a cell, the approximation belongs to Qₖ, a space obtained from tensor products of univariate polynomials of degree up to k and mapped onto the cell. The full space, Vₕ, is made from these cell spaces. The subscript h identifies the mesh. The cell polynomials are independent across an interface, which is why the same position on a shared face can have a value from each side. The independence is also useful for implementation, since a cell’s coefficients can be addressed as a self-contained group.
The appendix explains the basis in terms of shape functions. A shape function is one of the building blocks whose weighted sum represents the approximate function. The multidimensional functions come from multiplying one-dimensional ones. In two dimensions the paper gives the construction as follows.
φ₍α,β₎(x, y) = φₐ(x) φᵦ(y)
The symbol φ₍α,β₎ denotes the two-dimensional shape function indexed by α and β. The factors φₐ and φᵦ are the one-dimensional functions associated with those indices. The arguments x and y are the coordinate values at which the basis is evaluated. Multiplication combines each coordinate’s contribution into the value of the full shape function.
φ₍α,β,γ₎(x, y, z) = φₐ(x) φᵦ(y) φᵧ(z)
Here φ₍α,β,γ₎ is the three-dimensional shape function. The index γ selects the one-dimensional function φᵧ for the additional coordinate z. The functions and arguments associated with α and β play the same roles as in two dimensions.
For the standard one-dimensional construction, the authors choose k + 1 Gauss–Lobatto points on the interval [0, 1]. A coefficient is then the value of the interpolating polynomial at the corresponding point. The points include the interval endpoints, giving the authors an explicit way to select basis functions associated with the edges of a cell. In the appendix, the interpolation condition is written as follows.
φᵥ(ξμ) = δμν
The function φᵥ is the basis function indexed by ν, and ξμ is the interpolation point indexed by μ. The symbol δμν is the Kronecker delta. It is one when the indices agree and zero otherwise. The basis function thus picks out its own point and has zero value at the other interpolation points. This value-based construction also helps explain the change later made for the clamped patch. There, the boundary information must distinguish values from derivatives.
Adding the interface terms
The cell integrals alone account for gradients within each cell. For the equations to describe a single boundary-value problem, they also need terms describing what happens on the faces. The authors use averages of the two traces, meaning the values approached from the interior of the neighboring cells. They also use a jump, oriented by the face normals. In normal-oriented notation the interior definitions read as follows.
{u} = (u⁺ + u⁻) / 2
Here u⁺ and u⁻ are the traces from the cells marked plus and minus, respectively. Braces denote their arithmetic mean on an interior face. The choice of which side is labeled plus has no effect on the mean.
⟦u⟧ = u⁺n⁺ + u⁻n⁻
The brackets denote the jump of the scalar u expressed as a vector. The symbols n⁺ and n⁻ are the outward unit normals from the cells marked plus and minus. Their opposite directions give the jump its sign and make it zero when the traces agree. On an exterior face there is only one interior trace. The boundary convention uses that trace for the average and the jump magnitude, with the exterior normal supplying the orientation where the form uses a vector jump.
The authors express the discretization through a bilinear form. Evaluating it takes a trial function, whose coefficients represent a candidate solution, and a test function, which selects an equation. The same collection of basis functions represents both kinds of functions. The gradient terms within a cell are accompanied by a penalty and consistency terms on faces.
aₕ(uₕ, vₕ) = ∑_{K∈𝒯ₕ} ∫ₖ ∇uₕ · ∇vₕ dx + ∑_{F∈ℱₕ} ∫ꜰ (γₑ ⟦uₕ⟧ · ⟦vₕ⟧ − {∇uₕ} · ⟦vₕ⟧ − ⟦uₕ⟧ · {∇vₕ}) dσ
Here aₕ is the form on mesh h, uₕ is the trial function, and vₕ is the test function. 𝒯ₕ is the set of cells and K is a member of that set. ℱₕ is the set of interior and boundary faces, and F is a face. The first integral is over K and uses volume measure dx. The face integral is over F and uses surface measure dσ. The symbol ∇ denotes a spatial gradient, and the centered dot is the vector dot product. The penalty weight for the face is γₑ. The average and jump use the face conventions just described.
The first term inside the face integral makes disagreement between the traces costly. The next term pairs an average of the trial gradient with a jump in the test function. The final term pairs the trial jump with the average test gradient, giving the form its symmetry with respect to the trial and test arguments. This final term is central to the patch design. Making a test function vanish on the patch boundary removes its value jump there. A derivative can remain, allowing the last term to bring in information from the adjacent cell. That surviving contribution is the distinction between the two localized smoothers.
γₑ = k(k + 1)(1/h⁺ + 1/h⁻)
The symbols h⁺ and h⁻ are the cell-size quantities for the sides labeled plus and minus in the face formula. The degree k specifies the polynomial space. The weight γₑ rises with the polynomial-degree factor and the reciprocal cell-size contributions.
aₕ(uₕ, vₕ) = ∑_{K∈𝒯ₕ} ∫ₖ f vₕ dx for all vₕ ∈ Vₕ
Here uₕ is the solution sought in the discrete space Vₕ. The equation must hold for every vₕ in that space. The source f appears on the right, integrated against vₕ over each cell K in mesh 𝒯ₕ with volume measure dx. Choosing the test functions from the basis gives a set of equations for the coefficients.
A x = b
The matrix A denotes the action of the discrete bilinear form in the chosen basis, x holds the coefficients of uₕ, and b contains the source integrals for the test functions. This equation defines the solver’s target. The implementation uses A to denote an operation even when it stores no assembled global matrix.
Applying the operator without assembling it
A direct assembly procedure pays for constructing the entries that express the discrete interactions. The paper gives O(k³ᵈ) arithmetic for a straightforward assembly algorithm and O(k²ᵈ) storage for the resulting local matrices, in terms of the polynomial degree k and spatial dimension d. The O notation describes how those costs grow. In a matrix-free implementation the unknowns are stored as vectors, and the effects of the entries are evaluated when the solver needs them. In this way an increase in the polynomial degree enlarges the data for the polynomial coefficients without requiring storage for every pairwise interaction.
The authors describe the general matrix-free evaluation in terms of quadrature, which approximates integrals using weighted evaluations at points. The operator interpolates the coefficient values to these points and sums the resulting contributions. Treating the multidimensional interpolation and summation together takes O(k²ᵈ) arithmetic. Sum factorization applies the interpolation or summation in separate coordinate directions and reuses the intermediate values. The reported cost becomes O(dkᵈ⁺¹), with the introduction giving O(kᵈ) memory for the matrix-free tensor-product approach. Each of these bounds concerns the work or data associated with the finite element operator as the degree changes, rather than a runtime for the complete solver.
For constant coefficients and Cartesian geometry, the paper gives a more specialized representation. It builds the cell action out of stiffness matrices in one direction and mass matrices in the others. A stiffness matrix here represents the one-dimensional gradient contribution. A mass matrix represents the one-dimensional integrals pairing basis functions, with no derivative in that direction.
Aⱼ = L₁ ⊗ M₀ + M₁ ⊗ L₀
In this expression Aⱼ denotes the cell matrix for cell j in two dimensions. L₀ and L₁ are the stiffness matrices associated with the coordinate directions indexed by 0 and 1. M₀ and M₁ are the mass matrices for those directions. The symbol ⊗ is the Kronecker product, which applies the factors in their respective directions of the tensor data. The sum accounts for the two directional contributions to the Laplacian.
Aⱼ = L₂ ⊗ M₁ ⊗ M₀ + M₂ ⊗ L₁ ⊗ M₀ + M₂ ⊗ M₁ ⊗ L₀
Here Aⱼ is the cell matrix in three dimensions. L₂ and M₂ are the stiffness and mass matrices for the additional coordinate direction. As in the preceding formula, each term uses L in the differentiated direction and M in the remaining directions. The Kronecker products describe the action without requiring the implementation to form their dense multidimensional matrices. Later, the paper uses Aⱼ for a restricted patch operator, where j indexes a patch.
Using the cell formula alone would leave out the face contributions. In their patch-wise integration, the authors decide which pieces of the cell and face calculations to perform together and which coefficients can be written by the current patch. Their two-dimensional illustration distinguishes the cells the patch may update from nearby cells that supply read-only information. It also distinguishes faces that contribute to the updated cells. The work changes at the domain boundary. A patch at an outside corner has a different arrangement of cells and faces from an interior patch, and a patch along an outside edge has a different arrangement again. The figure shows how a patch can organize the work without losing the contributions at these boundaries.
This organization lets a patch perform part of the operator evaluation with contiguous accesses. Contiguity matters on the GPU because nearby threads can combine accesses to nearby addresses into fewer memory transactions. The patch also becomes a common unit for organizing parts of the computation used by the smoother and the transfers between levels. The authors retain separate operators for these tasks. The shared organization concerns how they locate and handle coefficient data.
Building a multigrid cycle
The authors produce the mesh hierarchy by regular refinement. On each finer level every cell comes from a coarser parent. Refining a cell produces 2ᵈ children, with d the dimension. The experiments take their coarsest mesh from the regular refinement of a single cell. The mesh levels are ordered as follows.
𝒯₀ ⊏ 𝒯₁ ⊏ ⋯ ⊏ 𝒯ₗ
The symbol 𝒯 with a level subscript denotes the mesh at that level. Here 0 is the coarsest level, L, shown as the final subscript, is the finest, and the dots stand for the intervening levels. The symbol ⊏ indicates the refinement relationship.
V₀ ⊂ V₁ ⊂ ⋯ ⊂ Vₗ
Here V with a subscript denotes the discrete function space on the corresponding mesh. The inclusion sign indicates that a coarser function can be represented in the finer space, since its polynomial on a parent cell restricts to polynomials on the children. The finest space is the one in which the problem is solved.
Prolongation passes a coarse correction to the finer mesh by representing the same function in the finer basis. Restriction passes data from the finer level to the coarser one using the L² projection, the projection based on the integral pairing of functions. The arrows on the transfer notation distinguish these two directions. In a V-cycle, the method first smooths on the current grid, then restricts the residual so that it can seek a correction on a coarser grid. On the way back it applies the coarse correction and smooths again. The authors describe a cycle with a single smoothing step on each side of the coarse correction.
A multigrid V-cycle with vertex-patch smoothing
The steps in order.
The outer iterative method is GMRES, or generalized minimal residual. Its iterations seek to reduce the residual of the system. The V-cycle plays the role of a preconditioner, supplying a practical approximation to the action of an inverse. At the bottom of the hierarchy the authors specify an exact inverse action.
P₀⁻¹ = A₀⁻¹
The symbol P₀⁻¹ is the preconditioner on the coarsest level, and A₀⁻¹ is the inverse of that level’s discrete operator. The superscript −1 denotes an inverse. With the hierarchy in place, the recursive definition needs only the operation at the current level and the action of the preconditioner below it.
xℓ ← Sℓ(xℓ, bℓ)
Here ℓ is the current level, xℓ is its current approximation to the correction, and bℓ is the right-hand side at that level. Sℓ is the smoothing operation, and the arrow means that it replaces xℓ with the updated vector. This same form is used for pre-smoothing and post-smoothing.
xℓ ← xℓ + I↑₍ℓ₋₁₎ P⁻¹₍ℓ₋₁₎ I↓₍ℓ₋₁₎ (bℓ − Aℓ xℓ)
The product in parentheses uses Aℓ, the operator at level ℓ, to form the residual against bℓ. I↓₍ℓ₋₁₎ restricts that residual to the next coarser level. P⁻¹₍ℓ₋₁₎ applies the recursive preconditioner there, and I↑₍ℓ₋₁₎ prolongs the resulting correction to level ℓ. The arrow again means replacement, in this case after adding the prolonged correction to xℓ. After post-smoothing, the resulting vector represents the action of the level’s preconditioner on bℓ.
Choosing how much of a patch to correct
A vertex patch contains the cells attached to a chosen vertex. Adjacent patches can share cells. The smoother is multiplicative, meaning a later update can use the solution already changed by an earlier update. The choice of a patch space specifies which coefficients the update is allowed to change. To find the update, the authors start with the residual of the current approximation.
r ← b − A x
Here r is the residual, b is the right-hand-side vector, A is the discrete operator, and x is the current approximation. The arrow assigns the difference to r. A residual component says how much of the corresponding discrete equation remains unsatisfied.
x ← x + Rⱼᵀ Aⱼ⁻¹ Rⱼ r
Here j identifies the patch. Rⱼ selects the residual components for the test functions in its local space Vⱼ. Aⱼ is the operator restricted to the patch space, and Aⱼ⁻¹ applies its inverse to the selected residual. Rⱼᵀ is the transpose of the restriction, which inserts the correction into the appropriate positions of the global vector. The formula adds that correction to x.
This description separates the space of corrections from the data needed to compute one. A patch can update only its own coefficients while still needing coefficients from nearby cells to evaluate its residual. With the full kernel, the patch space is the set of finite element functions supported on all of the patch cells. The residual on this space includes contributions from faces at the patch boundary. The neighboring cells appearing in those contributions enlarge the domain of dependence, the set of data that can influence the update. The authors describe the full calculation as reading from twice as many cells as are in the patch. The resulting access pattern is less regular than the tensor arrangement inside a patch. An update adjacent to the patch can also change the values needed for its residual. The implementation uses global residual updates for this variant.
The Dirichlet kernel takes a smaller correction space. It uses the Lagrange basis and leaves out the functions associated with interpolation points on the patch boundary. Every retained function has zero value there. The implementation computes the residual from the patch cells, so it avoids gathering from the surrounding cells. However, the average test gradient can still be non-zero on the patch boundary, and the face term in which it appears can involve a jump determined partly by the exterior cell. The computed residual is therefore inconsistent with the exact restriction of the global residual to this space. The outer solver still targets the original system, while the smoother uses this approximation to propose a correction.
The clamped kernel makes a further restriction. It uses a Hermite-type basis at cell boundaries, where interpolation includes derivative information. Within that basis the authors can select test functions whose value and normal derivative both vanish on the outside of the patch.
v = 0 and ∂ₙv = 0 on the patch boundary
Here v is a test function retained in the clamped patch space. The symbol ∂ₙ is differentiation in the outward normal direction n of the patch boundary. The zero conditions apply to traces at that boundary. The value condition removes the test jump there. The normal derivative condition removes the remaining contribution pairing the trial jump with the test gradient. The selected equations can consequently be evaluated exactly from inside the patch.
This exactness refers to the residual seen by the retained test functions. The correction space is still smaller than it is for the full kernel. At low degree the functions excluded by the boundary conditions account for a substantial part of the available space. At higher degree the patch has more freedom to represent a correction even with those conditions imposed. The authors use this difference to interpret the convergence tests.
With the clamped restriction, patches that share no cells have independent updates. The authors color the patches so a color collects such a set. On the regular mesh a color can be pictured as patches arranged to tile the interior, with shifted arrangements for the other colors. The order across colors preserves the multiplicative update. Inside a color, patches run in parallel. The implementation computes the residual needed for a patch from its input coefficients, applies the patch inverse, and writes the local correction before moving on to the next color. The change in dependence is what lets this execution use the current solution without globally recomputing the residual for each localized patch.
Turning the patch inverse into tensor operations
The restricted system on a patch would be expensive to invert by treating it as a general dense matrix. The paper gives O(k³ᵈ) arithmetic for a direct inverse construction and O(k²ᵈ) for applying the inverse as a dense matrix-vector product. Here k and d again describe dependence on the polynomial degree and dimension. The authors point out that a patch spans several cells, increasing the size of the directional problems compared with a cell. They instead use fast diagonalization, which takes advantage of the same separable structure used in operator application.
For each coordinate direction they solve a generalized eigenvalue problem that pairs the stiffness and mass matrices. The resulting eigenvectors give coordinates in which the stiffness action can be represented by eigenvalues. The mass matrix specifies the normalization used for that basis.
Lₐ Sₐ = Mₐ Sₐ Λₐ
The index a selects a coordinate direction. Lₐ is its one-dimensional stiffness matrix, Mₐ its one-dimensional mass matrix, Sₐ the matrix of generalized eigenvectors, and Λₐ the diagonal matrix of generalized eigenvalues. The columns of Sₐ are the directional basis vectors for this calculation. The equation says that the stiffness action on each such vector equals the mass action scaled by the corresponding eigenvalue.
The inverse is applied by transforming the patch residual into tensor products of these directional eigenvectors, applying a diagonal inverse, and transforming back. The diagonal inverse is cheap because each entry is determined from a sum of eigenvalues. In two dimensions the formula is as follows.
Aⱼ⁻¹ = (S₁ ⊗ S₀)(Λ₁ ⊗ I + I ⊗ Λ₀)⁻¹(S₁ᵀ ⊗ S₀ᵀ)
The patch inverse is Aⱼ⁻¹. S₁ and S₀ are the direction-specific eigenvector matrices, and superscript T denotes transpose. Λ₁ and Λ₀ hold the eigenvalues for the corresponding directions. I is an identity matrix sized to the direction it acts in. The Kronecker products, indicated by ⊗, extend the directional operations to the patch. The middle factor is the inverse of a diagonal matrix. Each diagonal entry combines a contribution from each direction.
Aⱼ⁻¹ = (S₂ ⊗ S₁ ⊗ S₀)(Λ₂ ⊗ I ⊗ I + I ⊗ Λ₁ ⊗ I + I ⊗ I ⊗ Λ₀)⁻¹(S₂ᵀ ⊗ S₁ᵀ ⊗ S₀ᵀ)
This is the three-dimensional patch inverse. S₂ and Λ₂ add the eigenvectors and eigenvalues for the additional direction. Each summand in the middle factor contains an eigenvalue matrix for one direction and identity matrices for the others. The sum remains diagonal. Applying the outer products as directional operations preserves the advantage of sum factorization in both the forward transform and the return to patch coefficients.
The benefit goes beyond performing fewer operations. The transformations can be organized as small matrix multiplications reusing values that are already available to the threads. A direct patch inverse would require fetching entries of a much larger matrix each time it was applied. In the fast diagonalization version, the small directional factors and intermediate vectors are suitable for fast memory close to the computation. This is how the patch solve comes to resemble the operator application in both arithmetic structure and implementation.
Placing data and work on the GPU
The implementation uses CUDA. Its GPU work is divided into thread blocks, groups of threads that can cooperate through shared memory. The host launches separate GPU operations for the pieces of the V-cycle, including operator evaluation, smoothing and transfer between levels. This matches the communication available within a block and the need for distinct stages at the scale of the full grid. The patch structure determines which data a block takes responsibility for. A block may handle one or more patches, and the implementation uses atomic additions when contributions from separate work items can target the same global entry. An atomic operation makes the addition indivisible with respect to other updates to that entry.
The order in which the coefficients are stored is important. The paper compares numbering that follows coordinates across the entire domain with numbering that follows coordinates within each cell. Global coordinate order gives regular global indices for a brick. It becomes difficult to keep that arrangement when an automated partitioner divides the mesh. Cell-wise order lets each cell keep its own contiguous block. It also means the GPU must rearrange the cell blocks into the coordinate order expected by the patch’s tensor operations.
The rearrangement is determined by the position of the shared patch vertex within each cell. Once the cells are ordered on that basis, a fixed map converts their local numbering to the tensor numbering for the patch. The authors store this map in constant memory. For locally owned patch cells, the first coefficient index for each cell is enough to reconstruct the other indices. This avoids saving a complete list of coefficient indices for every patch of every color. The savings become important as the polynomial degree increases, because the number of coefficients per cell grows while the number of cell starts to be stored for a patch stays fixed.
Constant memory and shared memory have different roles in the design. For the one-dimensional stiffness and mass matrices, the authors prefer shared memory. When they put these factors in constant memory, compiler optimizations increased register use. Registers keep values immediately available to an individual thread, but their use affects how many blocks a streaming multiprocessor can accommodate simultaneously. The authors choose a placement for the small matrices that helps keep more of the GPU’s work available to schedule.
Within a block, the authors parallelize the calculation over output coefficients. In three dimensions a patch can exceed the limit of 1024 threads per block under a one-thread-per-output assignment. A thread can instead update a column of coefficients. This gives each thread several related operations and creates room for scheduling the arithmetic. Grid transfer also uses directional contractions. In prolongation, for instance, the authors interpolate from a parent cell along one coordinate and then use the intermediate values to interpolate along the next. The transfer loops over parent cells and a thread associated with a coarse degree of freedom handles 2ᵈ degrees of freedom in the computation.
Shared memory is divided into banks, which can serve accesses in parallel when the requests are distributed appropriately. Several threads may read the same address through a broadcast. Accesses to different addresses in the same bank create a conflict and must be served in separate groups. A tensor contraction whose reads seem regular in coordinate order can still give multiple threads distinct addresses in the same bank. The authors adjust the order of the accesses using an offset based on the row, extending the adjustment in three dimensions to account for the additional coordinate. This changes which addresses are requested together while preserving the contraction. The correct permutation depends on the precision and the layout.
Dividing work by precision and across devices
Single precision reduces the memory required for each value and offers a higher arithmetic peak than double precision on the A100 used in the study. The authors keep GMRES in double precision and run the entire V-cycle in single precision for their mixed-precision variant. Values are converted on entry to the preconditioner and on exit. The double-precision outer iteration thus receives a correction computed at lower precision, then continues working against the original system. The experiment asks whether the lower-cost cycle improves overall runtime at the solver’s required residual reduction.
For distributed execution, the authors use p4est through deal.II to partition the mesh. The partitioning seeks balanced ownership of cells and few connections crossing between partitions. Each MPI rank, a participant in the distributed computation, owns a portion of the mesh and keeps a layer of ghost cells. These are copies of neighboring cells owned by other ranks. Ghost values allow a rank to compute terms involving both sides of an interface between partitions.
A vertex patch can include cells owned by several ranks. The paper describes policies for giving such a patch to a rank whose view of it contains the fewest ghost cells, or to the rank associated with the smallest cell index in the patch. Ownership determines where to do the patch work. The patch still has to locate the coefficients of all its cells. In the deal.II layout used in the study, ghost indices are stored in sorted order after the local ones. Looking up individual ghost coefficients on the GPU would involve a bisection search. Threads searching for different coefficients can take different branches, weakening the efficiency of their joint execution.
The authors therefore store the coefficient indices explicitly for ghost patches, while retaining the compressed indexing for patches that can use it cheaply. They perform the mapping for the ghost data during CPU setup. The resulting GPU calculation uses a little more device memory and avoids repeated searches during the solve. Distributed smoothing also needs a temporary vector for updates to ghost degrees of freedom under the rules of the vector implementation. That additional stage brings more communication into smoothing than into operator evaluation, creating a particular cost when there is little local work per device.
Experiments and results
Measuring convergence on a regular hierarchy
The experiments use discretized Poisson problems, with no training stage. The mesh, polynomial degree, and source define the discrete equations. The paper examines behavior in two and three dimensions. Its detailed comparison of the three smoothers solves the three-dimensional system with a constant source f ≡ 1 and a relative accuracy of 10⁻⁸. The tested polynomial spaces for this comparison run from Q₃ to Q₇, and the tables vary the finest grid level L from 2 through 7. A degree label specifies the cell polynomial space. A level label specifies how far the mesh hierarchy has been refined for the solve.
The convergence comparison uses GMRES preconditioned by the multigrid V-cycle. The authors report a fractional iteration count to make the comparison less sensitive to stopping just before or just after an integer iteration threshold. They first estimate the geometric mean residual reduction per iteration.
r̄ = (‖rₙ‖ / ‖r₀‖)^(1/n)
The symbol r̄ is the average reduction factor. The vectors rₙ and r₀ are the residual after n GMRES iterations and the initial residual, respectively. Double bars denote the Euclidean norm, which measures the size of a residual vector. The exponent 1/n distributes the observed reduction over the n steps as a geometric average.
ν = −8 / log₁₀(r̄)
The fractional iteration count is ν, and log₁₀ denotes the base-10 logarithm. The value −8 expresses the exponent of the target relative residual, 10⁻⁸. The formula gives the number of steps implied by the measured average factor for that reduction. Its decimal values should be read as a convergence measure. The actual solver advances in integer steps.
The full kernel has the lowest fractional iteration count among the three patch spaces in the tabulated convergence comparison. For example, with Q₃ its value is 3.7 at L = 3 and 2.8 at L = 7. With Q₇ it is 2.4 at L = 2 and 1.8 at L = 6. The latter case has no entry at L = 7 because of memory requirements. The table shows no steady increase in iterations as the mesh gets finer. At higher degree, the fractional counts are often around three or below, which is the basis for the authors’ comparison with a direct solve in terms of the few outer iterations needed. The algorithm still uses repeated preconditioner applications and a residual stopping criterion.
Patch smoothers on the three-dimensional Poisson problem at finest level L = 4, fractional GMRES iterations
The full patch gives the strongest convergence at either degree, and the clamped patch closes much of the gap at the higher degree.
The numbers
| System or setting | fractional iterations |
|---|---|
| Full Q₃ (this paper) | 3.6 |
| Dirichlet Q₃ | 5.6 |
| Clamped Q₃ | 21.7 |
| Full Q₇ | 2.2 |
| Dirichlet Q₇ | 6.4 |
| Clamped Q₇ | 4.8 |
The Dirichlet and clamped kernels are the baselines against which the cost of full residual evaluation can be understood. The Dirichlet row for Q₃ runs from 4.9 at L = 2 to 4.9 at L = 7, with higher counts at intermediate levels. For the clamped kernel with Q₃ the corresponding values are 18.6 and 16.4. At Q₇ the clamped kernel improves to 5.4 at L = 2 and 4.6 at L = 6. The differences across degrees are especially pronounced for the clamped kernel. The differences across mesh levels at a fixed degree are generally smaller, even in the clamped cases where the absolute iteration count remains high.
The runtime comparison tracks both a single smoothing step and the complete preconditioned solve. For the three-dimensional cases ranging from 134–453 million degrees of freedom, the paper reports a 4–5 times improvement in the cost of a smoothing step for the localized kernels relative to the full kernel. The complete solve also favors localization in that comparison. These measurements place the fractional counts in context. A smoother that gives the largest reduction in each step can still make the solver slower if it repeatedly reads more data and offers fewer independent updates. The timing figure tests the consequence at the level of the solve, including the additional work caused by slower convergence.
Measuring individual GPU operations
The single-GPU measurements use an NVIDIA Ampere A100 SXM4 with 80GB of HBM2e memory and a stated peak memory bandwidth of 2TB/s. The reported arithmetic reference for the component measurements is 8.7 TFlops/s in FP64 at 1.27 GHz. This reference puts the measured floating-point work rate in the context of the hardware. It is distinct from throughput measured in degrees of freedom per second, which describes how much of the discrete problem an operation processes in a given time.
The authors compare global and cell-wise numbering on the three-dimensional operator application. They report a slight throughput advantage for cell-wise numbering at both lower and higher orders in the comparison. The cell-wise ordering is also the one used in the subsequent implementation results. The numbering test concerns the cost of organizing and reading the same coefficients for the same operator.
The shared-memory comparison measures a more pronounced effect. The paper profiles bank conflicts per thread block, using an instruction-level measure of excess shared-memory wavefronts. The baseline uses the basic access order. The alternative permutes accesses to avoid distinct requests colliding in the same memory bank. The following comparison keeps the polynomial degree visible because the dimensions of the tensor operation change with degree.
Basic and permuted shared-memory access in three-dimensional operator evaluation, profiled conflicts per thread block
The permuted access pattern eliminates the profiled conflicts at every tested degree.
The numbers
| System or setting | bank conflicts per thread block |
|---|---|
| Basic Q₃ | 1824 |
| Permuted Q₃ (this paper) | 0 |
| Basic Q₄ | 1040 |
| Permuted Q₄ | 0 |
| Basic Q₅ | 3276 |
| Permuted Q₅ | 0 |
| Basic Q₆ | 2744 |
| Permuted Q₆ | 0 |
| Basic Q₇ | 64,974 |
| Permuted Q₇ | 0 |
The throughput curves for the two access patterns move in the direction suggested by the profile. The authors describe eliminating the conflicts as their most effective shared-memory optimization, with a nearly twofold acceleration. They also break down arithmetic throughput by operation. Operator application and smoothing attain their best reported performance at polynomial degree 4, reaching 39% of the theoretical double-precision peak. The transfer operators achieve a lower arithmetic rate. They have fewer tensor operations and their cost depends more heavily on moving values through memory. The result at 39% belongs to the individual operations measured against the device’s arithmetic capability, while the total solution time includes transfers and the other work of the V-cycle and GMRES.
Timing the mixed-precision solver
The reference for the mixed-precision experiment is a GMRES solve with a V-cycle run in double precision. The comparison keeps GMRES in double precision and uses single precision inside the V-cycle. The cycle uses one pre-smoothing and one post-smoothing step. The authors time the finest-level operator action and smoothing separately and compare the total runtime of GMRES. This shows how improvements in the inner operations translate into the quantity a solver user would observe.
For the higher-order cases, the finest-level operator application and smoothing can run at least twice as fast in the single-precision cycle, with some cases exceeding that speedup. The complete solve shows reported speedups of over 50% and up to 90%. The whole-solver percentages incorporate the work that stays in double precision and the cost of converting values at the preconditioner boundary. The paper reports smaller gains at low order, where the same block assignment gives lower occupancy. Thus the precision comparison measures both the effect of faster arithmetic and the suitability of the unchanged work assignment for feeding it.
The conclusion also reports a comparison with an optimized CPU counterpart on a cluster. According to the authors, a single GPU outperforms a CPU with 80 cores. That comparison is given as a qualitative performance result with the CPU core count. The conclusion supplies no corresponding runtime pair or speedup figure for it.
Scaling across GPUs
The distributed tests use a server with four A100 GPUs connected by NVLink. The timing analysis for Q₄ in three dimensions measures finest-level operator evaluation, a single smoothing step, and whole-solver performance. The strong-scaling comparison keeps the overall problem fixed and distributes it across more devices. Its reference lines show how runtimes would fall with perfect strong scaling. When the problem is large, each GPU still has substantial work to do after partitioning. When the problem is small, communication is more visible in each operation’s runtime. The authors observe this feature most strongly in smoothing.
The paper also compares throughput as problem size increases for Q₄ on four devices. Operator evaluation reaches its peak throughput at about 4 million degrees of freedom. The smoothing step requires a problem size exceeding 1 billion degrees of freedom to achieve optimal throughput in the reported experiment. Both thresholds refer to throughput measured in degrees of freedom per second for the named operation. The large separation reflects the distributed smoother’s additional updates and communication. It also explains why performance of operator evaluation alone gives an incomplete picture of the solver’s strong scaling.
The weak-scaling experiment grows the problem and adds GPUs while keeping the work per GPU fixed. Flat runtimes would indicate that the larger distributed problem added no time per operation. The authors report the time for the fine-grid operator, the time for a smoothing step, and the GMRES time per iteration for the Q₄ tests. Separately, they tabulate fractional iterations for a Q₃ vertex-patch variant labeled the local kernel. At finest level L = 2, the reported fractional count is 5.3 with one GPU and 5.9 with four. At L = 7, the corresponding values are 5.5 and 5.7. These Q₃ data address whether changing the distributed setup undermines convergence. The timing curves for Q₄ address the distinct question of how expensive the work becomes to execute.
What the ablations show
Locality and the size of the correction space
The comparison among the full, Dirichlet and clamped kernels changes the smoother while retaining the same type of discretization and outer solver. It shows the price of constructing a correction from a smaller local space. For Q₃, the dimensions given for the full, Dirichlet and clamped spaces are 8³, 6³ and 4³, respectively. These are dimensions of the patch spaces, rather than problem sizes for the entire mesh. The reduced space gives the update less freedom to represent the error. The clamped Q₃ iteration counts show how severe that restriction can be.
The higher-degree results distinguish the behavior of the two localized choices. The clamped kernel gains strongly from higher degree, and at Q₇ its fractional counts are below the Dirichlet counts on the computed levels. The authors associate the Dirichlet kernel’s convergence with the effect of its inconsistent residual. The extra polynomial degrees give the clamped kernel more room to correct errors within its boundary constraints. The Dirichlet kernel retains a residual error from omitting a face contribution, and its convergence does not show the same improvement as the degree increases.
The comparison changes several properties together. Full-to-localized comparisons change both which coefficients can be corrected and which cells must be read. Dirichlet-to-clamped changes both the test space and the residual used on that space. The experiments show how the implemented variants behave as packages. The observed iteration count for any given variant reflects the combined choices. The authors’ explanation of the residual term identifies a mechanism for the trends, while the comparison with the full kernel shows what is surrendered when the correction space is restricted.
The step timing and the end-to-end timing answer complementary questions about the same change. A smoothing-step measurement isolates the part of execution that the smaller data requirements and easier scheduling are intended to improve. The whole GMRES timing includes the extra steps required by the localized methods. The favorable runtime in the latter measurement shows that the savings can survive the convergence penalty. The degree dependence of the clamped kernel matters because a step measurement taken alone would miss the relatively high cost of reaching the stopping criterion at low degree.
Memory layout, precision, and distributed access
The numbering comparison changes the storage order while evaluating the same discrete operator. Both layouts support coordinate-based ordering, but at different scales. Cell-wise storage gives the measured throughput advantage even though the patch must translate to a tensor order. Its larger design advantage is that it supports automated partitioning while keeping each cell’s coefficient indices easy to reconstruct. The comparison checks whether adopting that organization imposes an operator throughput penalty in the tested cases.
The bank-conflict comparison changes the order of shared-memory accesses for the tensor multiplications. The profiler data attribute the difference directly to accesses in the same bank, and the throughput measurements show that these events matter to runtime. In the Q₃ example, some of the first requests can be broadcast because they share an address, while other requests reach different addresses in the same bank. The row-dependent offset changes when those requests occur. The experiment gives both a mechanism for the original delay and a check that the new access order removes it. Q₇ has the largest conflict count in the basic layout among the reported degrees. The same optimization principle applies there, while the appropriate permutation still depends on the dimensions of the tensor operation.
The mixed-precision comparison changes the precision used throughout the cycle. Keeping the outer GMRES work in double precision makes the timing comparison about how the preconditioner is executed and what effect that has on the whole solve. The higher-order cases benefit most because the component operations can use the faster arithmetic and reduced memory traffic. The lower-order cases show the importance of how much work resides in each block. The authors retain the same number of patches per block in the single-precision run, so the experiment measures the gain achievable with that assignment.
For ghost patches, the comparison changes how the implementation retrieves coefficient indices. One version uses compressed information and searches for the ghost mapping during execution. The other performs the mapping at setup and reads explicit indices. The Q₄ comparison in three dimensions favors the explicit scheme. Its rationale differs from the local patch compression. In an ordinary local cell, a known starting index makes the remaining indices inexpensive to recover. In a ghost cell, the lookup can divide the threads among different search branches. The time saved in that case justifies using more device memory for the affected patches.
Finally, the scaling analysis compares parts of the solver that place different demands on the distributed vector. The smoother modifies coefficients through patches that may cross a partition boundary. The operator also reads values across boundaries, but its throughput reaches a plateau at a much smaller problem size. The observed sensitivity of smoothing at small sizes is consistent with the authors’ account of the temporary vector and extra communication. The weak-scaling iteration results add a numerical check. Across the tabulated configurations, changes in runtime can be interpreted alongside fairly stable residual reduction.
Limitations
Limits stated by the authors
The implementation is specialized for Cartesian meshes, and the patch-wise optimization assumes axis alignment. The derivation of the inexpensive cell and patch operations relies on constant coefficients and on being able to separate the coordinate directions. The authors say the Poisson approach can extend to other symmetric, separable differential operators. Their results demonstrate it on Poisson problems. A change that couples the coordinate directions would also change the justification for the tensor representation and the local inverse used here.
The authors explicitly identify the inconsistency of the Dirichlet kernel. Because the test gradient can survive at the patch boundary, reading exclusively inside the patch leaves out a contribution to the restricted residual. The clamped kernel restores residual exactness for its chosen test space, at the cost of imposing further restrictions on the correction. The authors report the resulting convergence penalty, especially at lower degree, and distinguish it from the cheaper operation on the GPU. They give a practical reason for using global residual updates with the full kernel, whose dependence on adjacent cells is harder to organize in parallel.
The bank-conflict optimization requires different permutations when the precision or tensor layout changes. The authors illustrate the access pattern in double precision and explain that single precision changes the bank arrangement relevant to the calculation. The three-dimensional case also requires accounting for offsets associated with the additional coordinate. The study considers permutations of access order and excludes padding, which would add to shared-memory use. The reported comparison therefore evaluates the applied permutation against the basic layout.
The authors also note that the low-order mixed-precision kernels are held back by their work assignment. The smaller data representation does not automatically produce a proportional improvement when each block retains the same patch allocation. Their MPI analysis identifies the problem size needed to cover the latency of additional communication for smoothing. Some high-degree, fine-level entries in the convergence comparison are absent because of memory requirements. Those omissions restrict the scheduling and convergence evidence at the largest configurations.
Limits visible in the experimental setup
The convergence tables measure reduction of the algebraic residual for particular Poisson systems. This is evidence about solving the discrete system with the chosen preconditioner. Accuracy of the finite element approximation to the continuous solution is a different quantity, and the iteration count does not measure it. The source in the detailed three-dimensional convergence test is constant, and the hierarchy is built by regular refinement. The evidence for robustness across grid sizes and degrees is tied to those choices. It does not settle how the same patch strategy would behave when geometry, coefficient variation, refinement pattern, or boundary conditions change simultaneously.
The experiments also compare convergence and timing in several distinct settings. The iteration-count comparison varies degree and level. The single-step and full-solve timings use large three-dimensional problems, the shared-memory profile measures an operator kernel, and the distributed throughput results focus on Q₄. Together they describe how the approach behaves across the reported settings. They do not give a single degree or patch variant that can be taken as the fastest choice for every supported problem size. In particular, the cost of using a small correction space for Q₃ and the gain from using fewer reads occur on opposite sides of the balance that determines time to solution.
The arithmetic peak comparison is specific to the A100 and to the named kernels. Transfer, communication and outer iteration have their own costs. The four-GPU experiment takes place on a server with NVLink, so the measurements describe a setting with that communication capability. They do not establish the same scaling over a larger deployment or a different interconnect. Likewise, the conclusion’s statement about the 80-core CPU comparison supports the direction of the result, while the absence of corresponding runtimes leaves its magnitude unspecified.
Mixed precision is evaluated as a choice for the V-cycle within the tested GMRES solves. The resulting speedup and convergence behavior show that this division of precision works in those experiments. They do not establish its numerical behavior for more demanding right-hand sides, other operators, or tighter stopping criteria. The trials establish performance and convergence for the combinations they measure. They leave the stability and cost of broader applications open.
What came after
No later work is documented here that extends the localized DG patch smoother, the fast diagonalization implementation, or the multiple-GPU results. The paper identifies symmetric, separable differential operators as a possible extension of the approach. That is a direction proposed by the authors, with the experimental evidence confined to the Poisson problems they studied.
Cite
Cite as Cu Cui and Guido Kanschat. 2024. Multilevel Interior Penalty Methods on GPUs. arXiv:2405.18982 · ACM Trans. Math. Softw. 51, 3, Article 19, 2025.
@misc{cui2024multilevel,
title = {{Multilevel Interior Penalty Methods on GPUs}},
author = {Cu Cui and Guido Kanschat},
year = {2024},
doi = {10.1145/3765616},
eprint = {2405.18982},
archivePrefix = {arXiv},
url = {https://doi.org/10.1145/3765616}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/cui-2024-multilevel-interior-penalty-methods-gpus/