Elamur Research

Multi-GPU aggregation-based AMG preconditioner for iterative linear solvers

Paper · 2023 · Massimo Bernaschi, Alessandro Celestini, Pasqua D'Ambra et al.

Summary

A sparse linear system can have so many unknowns that its coefficients and working data exceed the memory of a single accelerator. Distributing the system across a cluster makes room for a larger calculation, but it also means that some of the values needed by each accelerator belong to another. Bernaschi and colleagues extend BootCMatchG, a sparse linear solver, from a single accelerator to distributed GPU parallel computing. They use algebraic multigrid to speed up an iterative solve for symmetric positive-definite systems. Their central design choice is to let each task build its own groups of unknowns while retaining the connections between tasks in the equations the solver works with.

Algebraic multigrid builds a hierarchy in which smaller systems help correct errors that are expensive to remove on the original system. BootCMatchG uses weighted graph matching to select pairs of unknowns for this hierarchy. In the distributed version, the matching uses only the part of the graph that a task owns. The resulting groups can vary with the partition, but every group belongs to a single task. This makes the transfers between levels local and removes one exchange from the matrix calculations used to build each coarse level. Other exchanges remain. The implementation overlaps some of them with GPU computation and adapts an existing sparse multiplication kernel so it can work with rows received from other tasks.

The authors test systems from a finite-difference discretization of the three-dimensional Poisson equation. On Piz Daint they solve a fixed problem of 27 × 10⁶ unknowns on up to 16 nodes, with BootCMatchG solve time falling from 5.14 seconds on 1 node to 0.95 seconds on 16 nodes. A second series grows the problem to approximately 2.2 × 10⁸ unknowns on 100 nodes. Against the selected aggregation-based AmgX configuration, BootCMatchG builds sparser hierarchies, takes fewer solver iterations, and delivers reported solve-phase speedups ranging from 1.6x to 2.0x. It spends more time setting up the hierarchy. In the fixed-size tests, its solve-time advantage is large enough to give it a lower combined setup and solve time at every tested node count.

Additional tests on Marconi-100 clarify the role of the comparison method. Classical multigrid configurations can complete the solve phase quickly with relatively few iterations, at the cost of denser hierarchies and more expensive setup. BootCMatchG comes close to classical AmgX in solve time and has the lowest reported total time in that series. The results make the case for evaluating the hierarchy through several measurements together. Its sparsity affects the cost of each iteration, its coarse approximations affect how many iterations are needed, and the work required to construct it can change which solver finishes first.

Deep dive: Multi-GPU aggregation-based AMG preconditioner for iterative linear solvers

How BootCMatchG uses algebraic multigrid to solve large sparse linear systems across GPUs, and what its scaling tests show about setup and solve time. · about 36 minutes to read

The problem and its context

A linear solve that has to fit somewhere

A numerical simulation frequently ends up asking for a collection of values that satisfy many equations at once. The known coefficients describe how those values depend on one another. For the Poisson problem in this paper, the discretization couples each interior grid point to its immediate neighbors. Even with this small neighborhood, a fine grid produces a large system. The saving is that most coefficients are zero. A sparse representation stores the entries that can contribute to an equation and the indices that tell the solver where to find the corresponding unknowns.

The paper considers real systems with symmetric positive-definite coefficient matrices. Symmetry means that the coefficient connecting a pair of indices is the same when their roles are reversed. Positive definiteness means that the quadratic form associated with the matrix is positive for every non-zero vector. These are the conditions under which the authors use conjugate gradient, an iterative method that repeatedly improves an approximate solution. The method is appropriate to the paper's setting because it can work through operations on the sparse matrix and vectors while targeting a specified residual tolerance.

The residual is the discrepancy between the right-hand side of the equations and the value produced by the current approximate solution. Repeated iterations can make this discrepancy smaller. The number of steps needed depends partly on the spectrum of the matrix, meaning the distribution of its eigenvalues. A preconditioner changes how the iterative method sees the system. It uses an operator that approximates the effect of the inverse, with the aim of making the error easier to remove. An effective preconditioner can improve convergence enough to justify the work of building and applying it.

That tradeoff has several parts on a distributed machine. A preconditioner can save iterations while making each iteration expensive. It can be cheap to apply while taking a long time to prepare. It can also work well numerically while requiring frequent exchanges between tasks that leave the accelerators idle. The authors use algorithmic scalability for the behavior of convergence as the problem grows and implementation scalability for the ability to perform the work efficiently with more parallel resources. The distinction matters because execution time depends on both.

Why sparse work is difficult to distribute

A GPU can perform many operations at once, which is especially useful when many threads execute similar instructions on data they can access efficiently. In a sparse operation, the stored indices determine which values to fetch. Different matrix rows may contain different numbers of entries, and adjacent rows may need values from very different places. This makes the memory access pattern irregular and can leave some threads with more work than others. The paper points out that a high degree of parallelism can make a simple relaxation method attractive on a GPU even when a method with stronger data dependencies would require fewer steps.

Moving from a single accelerator to many introduces another kind of irregularity. When a task owns a row of the matrix, every column index in that row refers to an unknown. Some of those unknowns will belong to other tasks. The owner of the row has to obtain their current values before it can finish evaluating the row. In a product of sparse matrices, it may need whole rows from the other operand. The sparsity pattern therefore determines both local memory accesses and which data cross the network.

The iterative method also has operations whose result depends on contributions from every task. An inner product pairs entries of two vectors, multiplies them, and sums the products. Each task can form its share, but the complete result entails a global reduction. The cost of this coordination is different from the cost of exchanging the neighbors required by a matrix row. A distributed solver needs to handle both. The variant of preconditioned conjugate gradient adopted in the paper reorganizes the inner products and vector updates to reduce synchronization overhead and exploit locality.

Where BootCMatchG fits

The authors place BootCMatchG alongside PETSc, Trilinos, hypre, and NVIDIA AmgX. They describe the first three as established sparse solver libraries that have evolved with computer architectures. AmgX provides algebraic multigrid methods tuned for GPU clusters and includes an aggregation approach based on local matching. This makes one of its configurations a natural point of comparison for the paper. The two implementations share the general idea of grouping unknowns, while the rules that select groups and the work required to form coarse matrices differ.

The earlier BootCMatchG implementation already used a numerical criterion based on weighted matching. It was designed for systems that fit on one GPU and already had kernels for the important sparse and vector operations. Scaling the method meant deciding which of these operations could retain their single-device form and where the algorithm itself had to change. In particular, the matching procedure could in principle negotiate pairs across task boundaries. Doing so would require repeated communication during the construction of a hierarchy. The distributed implementation keeps the existing local matcher and gives up cross-task pairs.

Independent aggregation within each task has precedents in distributed multigrid, as the paper notes. The authors' contribution lies in combining it with the weighted matching used by BootCMatchG and arranging the other components around the resulting transfer operators. The locality of an aggregate affects the calculations that follow it. A whole class of exchanges can disappear when transfers are local, even though the fine and coarse equations continue to couple unknowns across task boundaries. The paper builds its implementation around this distinction.

The method, step by step

From the input matrix to the solution

The program receives a sparse coefficient matrix and a right-hand side. Each MPI task owns a consecutive range of rows and the corresponding pieces of the vectors. MPI coordinates the distributed tasks, and CUDA runs operations on the NVIDIA accelerators. The layout assigns neighboring ranges of global row indices to successive MPI ranks. Within a task, sparse matrices use compressed sparse row storage, or CSR. It stores the column indices and numerical values of the entries row by row, with offsets that identify where each row begins.

The method has a setup phase followed by a solve phase. Setup makes a hierarchy of smaller matrices, defines how information moves between levels, and prepares the exchanges needed by the sparse products. During the solve, flexible preconditioned conjugate gradient uses that hierarchy to turn each current residual into a direction that helps improve the approximation. It continues until the residual meets the convergence criterion or the iteration cap is reached.

Building and applying the BootCMatchG preconditioner

The steps in order.

Building and applying the BootCMatchG preconditionerStep 1: Distribute matrix rows and vector entries1. Distribute matrix rows and vector entriesStep 2: Match strongly coupled unknowns within each task2. Match strongly coupled unknowns within each taskStep 3: Build transfers from the local aggregates3. Build transfers from the local aggregatesStep 4: Form successively smaller Galerkin matrices4. Form successively smaller Galerkin matricesStep 5: Prepare exchanges for sparse matrix-vector products5. Prepare exchanges for sparse matrix-vector productsStep 6: Apply multigrid cycles inside conjugate gradient6. Apply multigrid cycles inside conjugate gradientStep 7: Check the relative residual7. Check the relative residual

What the iterative solver computes

The input system is written as follows.

Ax = b

Here A is the known square coefficient matrix, x is the unknown solution vector, and b is the known right-hand-side vector. The product Ax evaluates all equations using the entries of x. The dimension of A is denoted by n, which is also the length of each vector.

The paper uses the following system to express the effect of left preconditioning.

BAx = Bb

Here B is the preconditioner, A is the system matrix, x is the solution, and b is the original right-hand side. Applying B to both sides changes the operator and the right-hand side seen by the iteration. In BootCMatchG, the multigrid cycle supplies the action of B on an input vector.

A preconditioner is expected to improve the conditioning of the problem. The paper expresses that objective with a norm-based condition number.

κ(BA) = ‖BA‖ ‖(BA)⁻¹‖ < κ(A)

Here κ denotes the condition number, ‖·‖ is a matrix norm, A is the coefficient matrix, and B is the preconditioner. The superscript ⁻¹ denotes an inverse. The inequality describes the desired improvement. The benchmark measures the practical consequences through iteration counts and timings.

The flexible conjugate gradient procedure starts from an approximation u₀. Its initial residual is the difference between the right-hand side and the equations evaluated at that approximation.

r₀ = b − Au₀

Here r₀ is the starting residual, b is the right-hand side, A is the matrix, and u₀ is the initial guess. The subscript 0 identifies the state before the solution has been updated. Using u for the successive approximations leaves x available for the exact unknown in the statement of the problem.

The method initializes the search direction with the preconditioned residual.

w₀ = d₀ = Br₀

Here w₀ is the result of applying the preconditioner B to the starting residual r₀, and d₀ is the first search direction. The two vectors begin with the same value. After initialization, the direction also depends on information retained from the previous iteration.

v₀ = q₀ = Aw₀

Here A is the coefficient matrix, w₀ is the first preconditioned residual, v₀ is its image under A, and q₀ is the image of the initial direction. Maintaining both a direction and its image lets the solver update the solution and the residual from related vectors.

α₀ = w₀ᵀr₀

Here α₀ is a scalar inner product, w₀ is the first preconditioned residual, and r₀ is the first residual. The superscript ᵀ means transpose. In the product of these real vectors, it indicates the sum of products of entries with matching indices.

β₀ = ρ₀ = w₀ᵀv₀

Here β₀ and ρ₀ are scalar quantities initialized with the same inner product. The factor w₀ᵀ is the transpose of the preconditioned residual, and v₀ is its image under the system matrix. The initialization supplies the starting denominator for the step along the first direction.

u₁ = u₀ + (α₀/ρ₀)d₀

Here u₁ is the first updated solution estimate, u₀ is the initial guess, d₀ is the first direction, and α₀/ρ₀ is the scalar step length. The operation scales the direction and adds it to the current estimate.

r₁ = r₀ − (α₀/ρ₀)q₀

Here r₁ is the updated residual, r₀ is the starting residual, α₀ and ρ₀ give the same step length as in the solution update, and q₀ is the matrix image of d₀. Moving the solution along d₀ changes the discrepancy in the equations along q₀.

The subsequent iterations repeat the preconditioner application and a sparse matrix-vector multiplication before forming the scalar quantities used by the direction update.

wᵢ = Brᵢ

Here i is the iteration index, rᵢ is the current residual, B is the preconditioner, and wᵢ is the resulting correction vector. This is where the outer iteration calls the multigrid cycle. The flexible conjugate gradient formulation supports variable preconditioners, while the benchmark uses the configured hierarchy and cycle described below.

vᵢ = Awᵢ

Here vᵢ is the image of the correction wᵢ under the original matrix A, and i is the current index. In the distributed implementation, evaluating this product requires the parts of wᵢ referred to by the stored matrix rows, including any remote entries.

αᵢ = wᵢᵀrᵢ

Here αᵢ is the current scalar formed from the preconditioned residual wᵢ and the residual rᵢ. The transpose ᵀ indicates an inner product. The subscript i identifies values from the same iteration.

βᵢ = wᵢᵀvᵢ

Here βᵢ is the inner product between the correction wᵢ and its matrix image vᵢ, and ᵀ denotes transpose. This provides the term from which the new denominator is formed.

γᵢ = wᵢᵀqᵢ₋₁

Here γᵢ is the scalar inner product between wᵢ and qᵢ₋₁, the image of the preceding search direction under the matrix. The superscript ᵀ denotes transpose, and the subscript i−1 selects the preceding iteration. This inner product accounts for the relationship between the new correction and the previous direction.

ρᵢ = βᵢ − γᵢ²/ρᵢ₋₁

Here ρᵢ is the updated scalar denominator, βᵢ and γᵢ are the current inner products, and ρᵢ₋₁ is the previous denominator. The superscript ² squares γᵢ. Computing the inner products together in the sequence described by the paper exposes opportunities to reuse data and reduce the overhead of distributed reductions.

dᵢ = wᵢ − (γᵢ/ρᵢ₋₁)dᵢ₋₁

Here dᵢ is the new search direction, wᵢ is the current preconditioned residual, dᵢ₋₁ is the preceding direction, and γᵢ/ρᵢ₋₁ scales its contribution. The search direction retains information across iterations, which is what distinguishes the update from simply applying the preconditioner at every step and using its output unchanged.

qᵢ = vᵢ − (γᵢ/ρᵢ₋₁)qᵢ₋₁

Here qᵢ is the matrix image of the new direction, vᵢ is the matrix image of wᵢ, and qᵢ₋₁ is the matrix image of the preceding direction. The factor γᵢ/ρᵢ₋₁ is the same scalar used in forming dᵢ. These relationships allow the solver to form qᵢ by combining vectors it already has.

uᵢ₊₁ = uᵢ + (αᵢ/ρᵢ)dᵢ

Here uᵢ₊₁ is the next approximate solution, uᵢ is the current one, dᵢ is the current search direction, and αᵢ/ρᵢ is the current step length. The subscript i+1 marks the state after the update.

rᵢ₊₁ = rᵢ − (αᵢ/ρᵢ)qᵢ

Here rᵢ₊₁ is the next residual, rᵢ is the current residual, and qᵢ represents how the current search direction appears in the equations. The factor αᵢ/ρᵢ matches the step taken in the solution. The vector updates have the form of a scaled addition, frequently called AXPY. The paper groups this kind of operation, as well as inner products, so data already accessed by a GPU can be used efficiently.

How graph matching builds a smaller system

The multigrid hierarchy is algebraic because its construction uses the coefficients of the input matrix. The authors describe an adjacency graph in which vertices represent unknowns and edges represent their connections in the matrix. A matching chooses edges with no shared endpoint. Each chosen edge supplies a pair of unknowns that can be represented by one aggregate in a smaller index space. The choice matters because a coarse correction can represent some patterns of error more faithfully than others.

The authors assign edge weights with a function of the coefficient entries and a smooth vector. In this context, a smooth vector represents a pattern that the coarse system should be able to capture after simple relaxation has done its work. Its role is numerical. A pairing that looks suitable based on graph connectivity alone may be less useful for representing that pattern. The paper describes the inputs to the weighting rule and refers to the authors' earlier work for its detailed mathematical construction.

An exact maximum-weight matching would seek the largest possible total weight of the selected edges. The paper describes exact methods as too costly and poorly suited to parallel execution for this setting. BootCMatchG instead uses the Suitor algorithm, an approximate matcher whose result has at least half the optimum weight for the graph it processes. Suitor uses local comparisons and a bidding process to resolve conflicts over possible partners. On a single GPU, the authors can reuse their existing implementation. Across GPUs, bidding over shared boundaries would have to move updates between tasks and between device and host memory.

The distributed method gives each task the subgraph formed by its own unknowns. An edge to a vertex owned by another task is omitted from the matching problem. This makes it possible for every task to finish its pairs independently. It also makes the quality of the matching conditional on the partition. A vertex with a suitable partner across a task boundary has to use the candidates available on its own task. The guarantee for Suitor applies to the graph passed to it, so it does not give a quality guarantee for a global matching formed by combining these local results.

Each round produces a prolongator, a sparse matrix that takes a vector defined on the coarse space and expresses it on the finer space. A basic pairwise transfer assigns each fine unknown to an aggregate. The prolongator has one entry per row, with a pair represented by entries in the same column. The numerical entries of the transfer depend on the smooth vector. Because each aggregate belongs entirely to a single task, the fine unknowns and the coarse unknown that represents them can be stored together.

The hierarchy begins at the given problem.

A₁ = A

Here A is the input matrix and A₁ is that same matrix at the first, finest level. The level index is denoted by k below. The number of rows at level k is nₖ, so the prolongator Pₖ has nₖ rows and nₖ₊₁ columns.

Rₖ = Pₖᵀ

Here Rₖ is the restrictor, Pₖ is the prolongator from level k+1 to level k, and ᵀ denotes transpose. Restriction takes fine-level information to the next coarse level. The transpose relation links that operation to the way the coarse unknowns are represented on the finer level.

Aₖ₊₁ = RₖAₖPₖ

Here Aₖ is the current system matrix, Aₖ₊₁ is the next coarse matrix, Pₖ expands a coarse vector into the finer space, and Rₖ transfers the resulting fine information back to the coarse space. This Galerkin product defines the equations seen by a coarse vector. In particular, an interaction between fine unknowns on different tasks can still contribute to an interaction in the coarse equations. Restricting which vertices can be paired does not discard those coefficients from the Galerkin product.

wₖ₊₁ = Rₖwₖ

Here wₖ is the smooth vector at level k, Rₖ is the restriction operator, and wₖ₊₁ is the smooth vector passed to the next round of matching. This w belongs to hierarchy construction. The vectors named w in conjugate gradient are outputs of the preconditioner during the solve. The context and the indices distinguish the two uses.

BootCMatchG can take larger steps through the hierarchy by composing consecutive pairwise prolongators. The product applies the coarser transfer first and continues toward the finer space. In the notation below, the transfer with a hat is the combined operator.

P̂ₖ = PₖPₖ₊₁ ⋯ Pₖ₊ₛ₋₁

Here P̂ₖ is a combined prolongator starting at fine level k, each P on the right is one of the consecutive pairwise prolongators, s is the number combined, and ⋯ denotes the intervening factors. The subscripts on the right refer to the basic pairwise hierarchy. The combined operator maps directly between the levels retained in the final hierarchy.

Maximum entries per column of P̂ₖ ≤ 2ˢ

Here the left side refers to the largest number of stored entries in a column of the combined transfer P̂ₖ, and s again counts pairwise steps. The bound is also a bound on the size of an aggregate produced by that composition. At each step a pairing can bring together groups created by the preceding step.

The paper denotes the number of levels in the basic construction by NL and the number in the final hierarchy by nl. It gives the following count for the composed transfers and coarse operators.

nl − 1 = ⌈NL/s⌉ − 1

Here nl − 1 counts transitions in the final hierarchy, NL is the level count before combining transfers, s is the number of pairwise steps grouped, and ⌈·⌉ rounds upward to an integer. The final Galerkin matrices are constructed with the composed transfers. The authors call these transfers plain or unsmoothed because the interpolation operators themselves are left in this sparse aggregate form. Relaxation of a vector during the cycle is a separate operation.

How the setup gets the rows it needs

The Galerkin formula requires sparse matrix–matrix multiplication, which the paper abbreviates as SpMM. To compute a row of a product, a task follows the non-zero column indices of its row in the left operand. Each such index selects a row of the right operand. The task uses entries from those selected rows to accumulate the result. Any selected row owned by another task has to be transferred before the complete product can be formed.

The paper illustrates the dependency with matrices distributed over a pair of GPUs. An entry in a row owned by the first GPU refers to the last row of the right operand, owned by the second GPU. The first accelerator needs the stored values and column indices from that row. Sending only a scalar at the referenced index would lose the information needed to determine which columns of the result receive contributions.

A sparse product has a further complication. Its output row lengths and column locations depend on the input patterns. The kernel generally has a symbolic stage that determines the structure of the output, followed by a numerical stage that fills in its entries. BootCMatchG uses nsparse, which the authors had already selected for the single-GPU solver. Its original implementation assumes both operands are available on the device executing the product. The distributed implementation preserves the idea of giving each call all the rows it needs.

The GPU first identifies the remote rows of the right operand referenced by its local rows of the left operand. The CPUs use MPI collectives to establish which rows have to move and how many non-zero entries they contain. This information determines buffer sizes. CPU tasks then exchange row entries, including both column indices and values, using nonblocking point-to-point MPI operations. The GPU prepares the received rows for the product. It then computes its assigned rows of the result from the local left operand and all the right-hand rows required by those indices.

Joining local and remote rows into a single conventional CSR matrix would entail reorganizing data that the GPU already has. The authors introduce segmented CSR to avoid that copying. The local portion remains in its existing CSR arrays. An auxiliary CSR structure holds the remote rows. Since the ownership range is contiguous, the multiplication kernel can decide which structure to use by checking whether a requested row index lies within the local interval. The change lets nsparse use an existing allocation for the resident rows while accessing received rows through the additional structure.

An alternative implementation could compute the local contributions while data were moving, then compute the remote contributions and add the partial products. The authors explain why they chose to assemble the needed rows first. Splitting would require separate symbolic work for the two products, separate kernel calls, and a further sparse addition. Their overlap instead uses work from another part of setup. The host can exchange data for the multiplication while the device works on matching, when the exchanged information and the matching work can proceed independently.

Local aggregation also changes which half of the Galerkin calculation needs MPI. The authors evaluate the following intermediate product.

C = AₖPₖ

Here Aₖ is the matrix at level k, Pₖ is the transfer that expresses a coarse vector at that level, and C is the intermediate result. A nonlocal column in an owned row of Aₖ can refer to a row of Pₖ on another task. This multiplication is where row exchange is needed.

Aₖ₊₁ = RₖC

Here Aₖ₊₁ is the new coarse matrix, Rₖ is the restrictor at level k, and C is the previously computed intermediate matrix. Every row of Rₖ refers only to the fine rows belonging to its task, since an aggregate cannot cross a task boundary. As a result, each task already owns the rows of C that it needs for this second product. Its result can still contain columns whose coarse unknowns are owned by other tasks.

How a cycle uses the hierarchy

At each visit to an intermediate level, the cycle first applies a simple relaxation to the current equations. This reduces components of the error that are easy to address locally. The remaining residual is restricted to a smaller system, where the cycle repeats. Once the coarse correction returns, the prolongator maps it back to the finer level. Post-smoothing then works on the updated approximation. The descent through the hierarchy followed by the return to the fine level gives the V-cycle its name.

The smoother used here is ℓ₁-Jacobi, a weighted Jacobi method. Each row has a diagonal scaling that accounts for its off-diagonal entries. Inverting that diagonal involves operations on individual entries, which suits fine-grained GPU parallelism. The formula for the diagonal at level k can be written as follows.

Mₖ,ᵢᵢ = aₖ,ᵢᵢ + ∑ⱼ≠ᵢ |aₖ,ᵢⱼ|

Here Mₖ,ᵢᵢ is the diagonal entry of the smoothing matrix Mₖ for row i. The quantity aₖ,ᵢᵢ is the corresponding diagonal coefficient of Aₖ; aₖ,ᵢⱼ is its entry in column j. The summation ∑ⱼ≠ᵢ runs over the off-diagonal locations of row i, and the vertical bars mean absolute value. Indices i and j in this formula refer to matrix positions on level k.

For the symmetric cycle with one pre-smoothing and one post-smoothing application used in the mathematical description, the paper writes the implicit operator as a sum of smoothing and coarse correction terms.

Bₖ = Mₖ⁻ᵀ + Mₖ⁻¹ − Mₖ⁻ᵀAₖMₖ⁻¹ + (I − Mₖ⁻ᵀAₖ)(PₖBₖ₊₁Pₖᵀ)(I − AₖMₖ⁻¹)

Here Bₖ is the preconditioner action starting on level k, Mₖ is the smoother matrix, and Aₖ is the system matrix at that level. The superscript ⁻¹ denotes inverse, ᵀ denotes transpose, and ⁻ᵀ denotes the transpose of the inverse. I is the identity on level k. The middle factor PₖBₖ₊₁Pₖᵀ takes information to level k+1, applies the next level's preconditioner, and returns its correction. The factors immediately to its right and left account for the residual after pre-smoothing and the effect of post-smoothing. The program applies these operations to vectors through the cycle.

Bₙₗ ≈ Aₙₗ⁻¹

Here nl is the index of the final level, Bₙₗ is the action used there, Aₙₗ is the coarsest matrix, ⁻¹ denotes its inverse, and ≈ indicates approximation. The benchmark implements the coarse action by performing a fixed number of Jacobi iterations. It also uses several smoothing sweeps on either side of the coarse correction at the intermediate levels.

The paper gives two reasons for the coarse-level choice. With few unknowns left at each task, communication can cost more than local arithmetic. A direct approach based on sparse triangular solves can also create dependencies that are hard to exploit efficiently on GPUs. The iterative coarse solver reuses the smoother's kernels and keeps the computational pattern similar to the rest of the cycle. The amount of work is fixed by configuration. The quality of the correction then depends on the coarse system and how far that work reduces its residual.

How the solve overlaps communication with arithmetic

In a sparse matrix–vector product, or SpMV, a task needs a vector entry for every column that occurs in its local rows. The MPI exchange transfers the entries themselves. The sparsity pattern of the matrix gives the indices, and the result has an entry at each owned row. That makes this operation different from SpMM, where even the structure of the output requires work.

The authors exploit the ability to split the vector product into a contribution from entries already on the GPU and a contribution from entries arriving from other tasks. The GPU starts calculating with the local entries. While that kernel runs, asynchronous copies and MPI calls handle the movement of the required numbers. The exchange involves copying outbound values to the CPU, communicating between tasks, and copying inbound values to the GPU. Once the remote entries are available, the GPU computes their contribution and completes its share of the output vector.

CUDA streams allow the device operations to be scheduled so copies and computation can overlap. Nonblocking MPI calls let communication progress without putting the whole sequence into a serial chain of waits. The authors start the local product early because the output vector has separate storage from the input. If the product instead wrote over its input, the communication or the local kernel could still need values at risk of being overwritten, and the paper says an additional copy would be needed.

The matrix structure stays fixed during the conjugate gradient iterations, so the tasks prepare the index lists and allocate the required space before the solve. The exchanged values change with the vector being multiplied. This preparation applies to the fine matrix and to each coarse matrix in the hierarchy. Products with the prolongators and restrictors use local vectors and local matrix entries because of the aggregate layout. As a consequence, the cycle alternates between operations that may exchange entries and transfers that can be completed by each task on its own.

The released solver is named BootCMatchGX in the source repository. The appendix describes an interface that accepts a locally generated or read CSR matrix, the corresponding right-hand side, and parameters read from a configuration file. The caller can request preconditioner setup or run the solver without preconditioning. The benchmark is an exercise in numerical construction and repeated solution. The hierarchy is derived from the coefficient matrix, and the test problem supplies the matrix and right-hand side.

Experiments and results

The Poisson test and how performance is measured

The main test solves a Poisson equation on the unit cube with homogeneous Dirichlet boundary conditions. This means the solution is fixed at zero on the boundary. The coefficient is uniform, and the forcing term is one throughout the interior. The equation is written in divergence form.

−∇·(K∇u) = f

Here u is the unknown scalar field, ∇u is its gradient, K is the coefficient that scales it, and ∇· takes the divergence. The minus sign gives the negative differential operator, and f is the prescribed forcing term. The paper sets K to 1 for the test. Its domain is written as [0, 1]³, where [0, 1] is the interval along each coordinate axis and the superscript ³ indicates the cube.

For the matrix, the authors use a 7-point finite-difference stencil. This is a rule that approximates the differential operator using the value at an interior grid point and the values at its immediate axial neighbors. The same rule determines the connections at every interior location, with boundary values set separately. The discrete equation takes the following form.

6uᵢ,ⱼ,ₖ/h² − (uᵢ₋₁,ⱼ,ₖ + uᵢ₊₁,ⱼ,ₖ + uᵢ,ⱼ₋₁,ₖ + uᵢ,ⱼ₊₁,ₖ + uᵢ,ⱼ,ₖ₋₁ + uᵢ,ⱼ,ₖ₊₁)/h² = fᵢ,ⱼ,ₖ ≡ 1

Here i, j, and k are grid indices, and uᵢ,ⱼ,ₖ is the unknown at the indexed point. Each u with a shifted index denotes a neighboring grid value. The coefficient 6 multiplies the central value, h is the spacing parameter in the stencil, h² is its square, and fᵢ,ⱼ,ₖ is the right-hand-side entry. The symbol ≡ indicates that all the forcing entries are set to 1. The parameter nd in the paper counts interior grid positions along a coordinate axis.

The main experiments run on Piz Daint, using its hybrid nodes with Intel Xeon processors and NVIDIA Tesla P100 accelerators. The nodes are connected through the Cray Aries network. The authors assign 1 MPI rank to each participating node, with 1 GPU per node. Both matrix rows and right-hand-side entries follow the contiguous rank-based distribution. The largest allowed coarsest matrix for BootCMatchG is specified as 40 · nd, where 40 is the configured multiplier and nd is the grid parameter. The experimental description also gives 40 as the cap on hierarchy levels.

BootCMatchG, labeled BCMG in the comparisons, uses plain aggregates with at most 8 entries per column in the final prolongator. The selected AmgX aggregation configuration, labeled AMGX for Piz Daint, uses aggregates of size 8. It uses a heuristic estimate of the strength of connections for matching. The authors give it the same number of hierarchy levels as BCMG at each test point. Both solvers apply 1 V-cycle per conjugate gradient iteration, using 4 sweeps of ℓ₁-Jacobi before the coarse correction and 4 after it at the intermediate levels. They perform 20 sweeps on the coarsest level. The stated stopping rule uses a relative residual in the 2-norm less than 10⁻⁶, with a limit of 1000 iterations. The 2-norm measures the length of the residual vector.

The paper reports setup time, solve time, time per iteration, and iteration count. Setup time measures the cost of constructing the preconditioner. Solve time covers the repeated work after setup. Time per iteration helps identify a speed advantage that arises from the cost of a step. Iteration count measures how frequently the solver has to pay that cost to reach its stopping condition. The authors also report the sum of setup and solve time to show the cost when the preconditioner must be built for the run being timed.

The hierarchy metric is operator complexity. In this formula the paper numbers the finest matrix from zero.

OPC = (∑ₖ₌₀ⁿˡ⁻¹ nnz(Aₖ)) / nnz(A₀)

Here OPC is operator complexity, A₀ is the finest matrix in this indexing, Aₖ is the matrix at level k, and nl is the total number of levels. The function nnz counts non-zero entries. The sum, written with ∑, includes all the level matrices, and the denominator is the fine matrix's non-zero count. Since the finest matrix is included in the numerator, the ratio expresses the storage of the hierarchy's system matrices relative to storing the input matrix alone. It also indicates the amount of matrix work associated with a cycle. Transfer storage, communication, and kernel overhead affect the actual time and memory requirements separately.

Holding the problem fixed

The strong-scaling series uses a system of 300³ = 27 × 10⁶ degrees of freedom. A degree of freedom is one unknown in the discretized system. The authors increase resources up to 16 nodes and use 5 hierarchy levels for both methods at every point. How much of the calculation each task owns changes with the node count. The requirement to solve the same linear system stays fixed.

BCMG's operator complexity is generally about 1.14. For AMGX it falls in the range [1.28, 1.34]. The authors report that this corresponds to an increase of 12% to 20% for AMGX in the hierarchy costs estimated by operator complexity, relative to BCMG. BCMG also takes fewer iterations at every tested node count. Its iteration count varies more with the number of nodes, which the authors connect to changes in the local aggregates near partition boundaries.

BootCMatchG solve time for the fixed-size Poisson system

The distributed run reduces solve time on the same matrix.

BootCMatchG solve time for the fixed-size Poisson systemBCMG on 1 node: 5.14BCMG on 1 node5.14BCMG on 16 nodes (this paper): 0.95BCMG on 16 nodes (this paper)0.95
The numbers
System or settingseconds
BCMG on 1 node5.14
BCMG on 16 nodes (this paper)0.95

The decrease from 5.14 seconds to 0.95 seconds gives BCMG a reported solve speedup of about 5.4. AMGX reaches about 5.60 on 16 nodes when measured against its own run on 1 node. Its one-node solve takes longer, so its larger speedup coexists with a longer absolute solve time in the comparison. The per-iteration measure orders the scaling differently. For that measure BCMG has the larger speedup between the same resource endpoints.

Per-iteration speedup on 16 nodes for the fixed-size Poisson system

BootCMatchG reduces iteration time more relative to its own single-node run.

Per-iteration speedup on 16 nodes for the fixed-size Poisson systemAggregation-based AMGX: 5.53Aggregation-based AMGX5.53BCMG (this paper): 7.5BCMG (this paper)7.5
The numbers
System or settingspeedup
Aggregation-based AMGX5.53
BCMG (this paper)7.5

The speedups in the chart are approximate. The per-iteration speedup and the full solve speedup answer different questions. The first describes how the implementation distributes one step of work. The full solve changes with the number of iterations as well. Under decoupled aggregation the partition can alter the numerical hierarchy even when the original system and the number of hierarchy levels are held constant.

BCMG spends more time on setup. Its matching kernel uses the numerical weights, and its coarse matrices come from explicit sparse products. The selected AmgX scheme uses binary prolongators and a simpler connection-strength heuristic. The authors explain that it can form the coarse matrices through local sums. BCMG achieves a setup speedup of about 3.7 on 16 nodes in the strong-scaling series. Its total elapsed time is lower than AMGX's at every measured point. This result includes the setup cost for a single solve.

Growing the problem with the machine

The weak-scaling series keeps the work assigned to each node roughly fixed by using a matrix size per node of 130³ ≈ 2.2 × 10⁶ unknowns. It extends from 1 node to 100 nodes and reaches systems of approximately 2.2 × 10⁸ unknowns. The question is how much the wall-clock time and convergence change when resources and the total problem size grow together.

The hierarchy changes depth during this test. It has 4 levels on 1 node, 5 levels from 2 to 16 nodes, and 6 levels from 32 through 100 nodes. The authors attribute the changes to the stopping criterion for coarsening. A sufficiently small coarse system keeps the cost of its iterative solution manageable. Reaching such a system from a larger starting matrix can require more rounds, adding transfers, smoothing, and sparse products to the hierarchy.

The reported operator complexity of BCMG stays about 1.14 throughout the weak-scaling series and remains lower than AMGX's. Both methods take more conjugate gradient iterations as the test grows, with an initial increase followed by more stable behavior. BCMG takes fewer iterations at every measured size. The relative increase over the full series is also smaller for BCMG.

Growth in conjugate gradient iterations from 1 to 100 nodes for the weak-scaling Poisson test

The iteration count grows less for BootCMatchG as the global problem expands.

Growth in conjugate gradient iterations from 1 to 100 nodes for the weak-scaling Poisson testAggregation-based AMGX: 50Aggregation-based AMGX50BCMG (this paper): 36BCMG (this paper)36
The numbers
System or settingiteration-count increase %
Aggregation-based AMGX50
BCMG (this paper)36

The percentages are approximate and are calculated in the paper against each solver's own count on 1 node. AMGX's iteration count rises by about 50%, while BCMG's rises by about 36%. BCMG also has a lower time per iteration throughout the series, and that time grows more slowly. The combination accounts for its shorter solve times. AMGX takes about twice as long in many cases, consistent with the paper's overall reported solve-phase advantage of 1.6x to 2.0x against the aggregation baseline.

AMGX again has the smaller setup time. The paper discusses the practical importance of this expense in calculations that solve repeatedly, such as a time-dependent computation or a sequence of nonlinear steps. If subsequent solves use the same matrix or a sequence of slowly varying matrices suitable for preconditioner reuse, the setup can serve multiple solves. The experiments show the cost of constructing and applying the hierarchy. The discussion of reuse explains how those measurements can matter differently in a repeated-solve application.

Other multigrid configurations on Marconi-100

The appendix reports a weak-scaling comparison on up to 32 GPUs on Marconi-100, the maximum allowed by the authors' allocation for those tests. It keeps the matrix size per GPU at 130³ ≈ 2.2 × 10⁶ unknowns. The comparisons include BCMG, the aggregation configuration of AmgX now labeled AMGX-A, the classical AmgX configuration labeled AMGX-C, and a classical hypre configuration labeled HYPRE. The AmgX version is 2.2.0 and the hypre version is 2.26.0.

Classical multigrid uses a different approach from plain aggregation to choose coarse unknowns and construct transfer operators. To construct the HYPRE hierarchy, the authors use Parallel Maximal Independent Set (PMIS) coarsening and keep HYPRE’s default hierarchy-building settings. They select it because it is the hypre option they identify as supporting the complete setup on GPUs in this comparison. The appendix describes the same V-cycle sweep counts as in the main experiments. It also documents the AmgX parameter files and names the AmgX Poisson example program that generates the test systems. The hypre tests use its distributed ij test program.

BCMG has the smallest operator complexity at the measured points, with AMGX-A closer to it than the classical configurations. The paper attributes the greater complexity of AMGX-C and HYPRE to their denser transfer operators. The classical methods take relatively few iterations, and these counts remain stable as resources increase. Their setup is more expensive. In the solve phase, that small iteration count lets classical methods compete strongly with the aggregation solvers. The authors describe BCMG's solve time as comparable to AMGX-C's, and report the lowest combined time for BCMG across the comparison.

There is a gap in the hypre series at 8 GPUs. That run exits with an MPI error, and the point shown in the figures uses a constant interpolation from the previous value. It is a plotting convention and should be read as a missing solver measurement. Together with the narrower scale of the appendix test, this makes it useful chiefly as a comparison of hierarchy designs on that benchmark. The larger Piz Daint series supplies the evidence for scaling to 100 nodes.

What the ablations show

The paper does not report a component-by-component ablation with the matching, transfer construction, storage format, or communication overlap switched on and off. It offers comparisons over node counts, a breakdown of setup time, and matched-cycle tests against other solvers. Together these analyses show where time and work accumulate and how those patterns change with scale. Their controls differ, which matters for interpreting what each result can establish.

What changes when a fixed matrix is partitioned

The strong-scaling test keeps the linear system and the depth of the hierarchy fixed while changing the number of partitions. Under decoupled matching, this changes which fine neighbors are eligible to become a pair. A solver iteration also changes in cost because each task owns less of the matrix while still participating in network exchanges and global reductions. The test reports per-iteration time and iteration count separately, providing some leverage to distinguish these effects.

BCMG's iteration count is less stable than AMGX's in this series. The authors attribute the variability to the coarse matrices constructed from local pairs. When more partitions cut the same graph, more of the original couplings can fall outside the part given to a local matching kernel. The coarse spaces may represent troublesome errors differently even when the overall hierarchy contains the same number of levels. The timing result shows that this variation is compatible with a shorter solve on the partitionings tested.

Both aggregation methods make local groups. The iteration curves compare two ways of constructing and using those groups, with different transfer weights and different implementations. They therefore show that BCMG's particular hierarchy is effective in the tested configurations. Measuring the difference attributable to matching across ownership boundaries would require comparing local and distributed matching with the rest of the hierarchy construction held fixed. The paper mentions implementing a multi-GPU Suitor variant for quality comparison, but gives no numerical comparison of that kind among its benchmark results.

Where setup time goes as the system grows

The weak-scaling setup breakdown distinguishes matching, sparse matrix multiplication, and the extra wall time associated with communication for the multiplication. This breakdown tests an important consequence of the implementation. Matching runs on the GPU while the host can handle exchanges of sparse rows. Transfers can be taking place even when their cost is hidden by the computation running concurrently.

The reported communication overhead becomes visible for GPU counts larger than 16. It grows as more GPUs are used. The paper relates this to the larger global problem, the increase in hierarchy depth, and the amount of work in the sparse products as coarsening proceeds. Host communication has a window in which it can be hidden by matching. When the time and dependencies of the multiplication path outgrow that window, some of the cost appears in the setup total.

The breakdown also makes clear why the matching kernel alone cannot explain setup performance. Forming coarse matrices requires numerical and symbolic sparse products, and the rows those products need can come from other tasks. Decoupled aggregation makes the restriction half of the Galerkin product local, while the other half still has to handle distributed dependencies. The figures show overall timings for this design. They provide no separate timing for the avoided exchange or for the use of segmented CSR with otherwise identical kernels.

Why fewer iterations can coexist with a more expensive solve step

The main comparison aligns the depth and cycle work of the two aggregation methods. Under that alignment, BCMG has both lower complexity and fewer iterations. The appendix changes the comparison by including classical multigrid. In that setting, a denser hierarchy accompanies the best iteration-count stability, and the classical configurations can exploit it to perform the solve phase quickly. The aggregate representation favored by BCMG reduces matrix work and storage, letting it compete in solve time despite taking more steps than those classical configurations.

These measurements make the total time easier to explain. Classical configurations pay for building and applying larger hierarchies. The tested AmgX aggregation configuration pays less for setup and more in the solve. BCMG sits between these approaches in terms of the work it is willing to spend during construction, while its fine and coarse sparse operations keep the solve competitive. Setup time, iteration count, and per-iteration time describe different sources of that outcome, and the appendix shows why a ranking based on any one of them can differ from the ranking by total time.

Limitations

Limits identified by the authors

Decoupled matching depends on how the input is partitioned and how many tasks participate. Unknowns at the task boundary may end up with aggregates of a different quality or shape from those in the interior, since some of their possible partners are unavailable. The authors accept this tradeoff to keep matching local. Their discussion of a distributed Suitor implementation emphasizes how repeated bidding would require communication and host–device copies. Designing a scalable distributed matcher for this purpose lies outside the work they undertake.

Communication overlap has a range in which it is effective. The setup breakdown shows exposed communication at larger GPU counts. Meanwhile, strong scaling eventually leaves individual tasks with less local work, which limits the time available to hide the exchanges still required by the computation. The use of contiguous CSR row blocks and the reliance on host-side MPI communication are part of the implementation whose scaling the tests describe.

The authors also identify the smoother and the coarse solver as areas for further work. The use of ℓ₁-Jacobi allows both operations to reuse parallel GPU kernels. On the coarsest level, the number of sweeps is fixed, so the quality of the result depends on how suitable that method is for the particular coarse matrix. Their conclusion proposes more robust parallel smoothers and coarse solvers as extensions. The appendix additionally reports the resource allocation limit on Marconi-100 and the missing HYPRE measurement at 8 GPUs.

Limits of the evidence

The benchmarks all use the same Poisson test family. The dimensions, partitions, and platforms vary, while the coefficients remain uniform and the stencil follows a regular spatial pattern. The paper motivates the software through other applications of sparse systems, but the measurements do not determine how local matching or communication overlap behaves on their matrices. A different sparsity pattern could change the fraction of useful matching edges crossing ownership boundaries, the volume of remote rows needed during setup, and the ease of balancing work across GPUs.

The strongest numerical conclusions concern the tested solvers and configurations. The main comparison selects an aggregation method from AmgX and deliberately aligns its cycle with BCMG's. The appendix shows that changing the form of AMG affects convergence, storage, and both timing phases. There is also a reproducibility detail in the stopping rules. The appendix prose describes relative residual stopping for the tests, while the displayed AMGX-C configuration specifies ABSOLUTE convergence. The aggregation configuration specifies RELATIVE_INI. The reported timing and iteration curves therefore come with an ambiguity about how closely the residual criteria were aligned in the classical comparison.

Two descriptions of the construction merit care when reproducing the setup. The general coarsening specification bounds aggregate size through the number of pairwise transfers composed. The experimental description refers to composing pairs of basic prolongators and separately states an upper bound of 8 on aggregate size and entries per column. It does not explain how that composition description yields the stated bound. The Poisson description also gives the spacing parameter as h = 1/(nd + 1)² while using h² in the stencil and ih, jh, and kh for grid coordinates. The named Poisson generator and the reported matrix sizes identify the benchmark, but the printed spacing convention is ambiguous as a recipe for reconstructing the grid.

Operator complexity is a count-based proxy. It indicates the relative burden of the hierarchy's system matrices and gives context for cycle cost. The actual storage includes transfer arrays and working data, and the distributed runtime depends on communication and coordination as well as arithmetic. The paper's direct timings cover those runtime effects for its configurations. They do not establish a memory limit for every problem with the same unknown count, since a different matrix can have a different number and layout of nonzeros.

Finally, the example of preconditioner reuse is a reason that setup and solve time may have different weights in an application. The timed experiments build and solve benchmark systems. They do not follow a time-dependent or nonlinear calculation through a sequence of changing coefficient matrices. In such a sequence, how long a hierarchy remains useful would determine how much of its initial construction cost can be spread over subsequent solves.

What came after

There are no later citing works documented for this article. The authors' conclusion points to more robust parallel smoothers and coarse solvers as future work. Their proposed direction concerns both ends of the cycle: relaxation on intermediate levels must run efficiently on the accelerators, while the coarse solve must still produce a useful correction when little local arithmetic is available to offset communication. Those are open extensions identified by the paper.

Cite

Cite as Massimo Bernaschi, Alessandro Celestini, Pasqua D'Ambra and Flavio Vella. 2023. Multi-GPU aggregation-based AMG preconditioner for iterative linear solvers. arXiv:2303.02352 · IEEE Transactions on Parallel and Distributed Systems (2023).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.1109/tpds.2023.3287238 · arXiv 2303.02352

@misc{bernaschi2023multi,
  title = {{Multi-GPU aggregation-based AMG preconditioner for iterative linear solvers}},
  author = {Massimo Bernaschi, Alessandro Celestini, Pasqua D'Ambra and Flavio Vella},
  year = {2023},
  doi = {10.1109/tpds.2023.3287238},
  eprint = {2303.02352},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1109/tpds.2023.3287238}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/bernaschi-2023-multi-gpu-aggregation-based-amg/