Abstract
Solving massive sparse linear systems is a cornerstone of scientific computing, powering critical applications from weather forecasting to petroleum reservoir simulations. While Algebraic Multigrid (AMG) methods are considered the gold standard for these problems, they often incur a significant "performance tax" when applied to structured grids due to the overhead of general sparse matrix formats. This paper presents StructMG, a high-performance structured algebraic multigrid solver designed to bridge the gap between the flexibility of algebraic methods and the efficiency of structured-grid optimizations. By utilizing symbolic code generation and a novel parallel triangular solver framework, StructMG achieves speedups of 5.5x to 15.5x over the industry-standard hypre library while maintaining robust scalability on modern multicore architectures.
1. Introduction
Many physical simulations rely on structured grids—regular meshes where each point has a fixed number of neighbors. When solving the resulting linear systems, researchers typically face a trade-off between two approaches. Unstructured AMG solvers, such as BoomerAMG, are highly robust but suffer from slow execution on structured grids because they utilize Compressed Sparse Row (CSR) formats. These formats necessitate indirect memory access and additional index storage, which wastes memory bandwidth. Conversely, existing structured AMG solvers (e.g., SMG, PFMG) use efficient stencil-based mathematics but often struggle with scalability or robustness when encountering complex 3D problems with high anisotropy.
StructMG addresses this "multigrid seesaw" by balancing the complexity of the grid hierarchy (coarsening) with the strength of the error-reduction method (smoothing) specifically for modern multicore processors.
2. The StructMG Framework
StructMG is built upon three core design principles (P1–P3) that optimize performance without sacrificing the algebraic flexibility required for complex partial differential equations (PDEs).
2.1 Stencil-Based Triple-Matrix Product (P1)
Instead of relying on general matrix multiplication to build the grid hierarchy (Galerkin coarsening), StructMG employs symbolic derivation and automatic code generation. The framework derives exact formulas for how fine-grid points influence coarse-grid points and generates optimized C++ kernels. This approach maintains a "structured-grid-diagonal" (SG-DIA) format, eliminating the overhead of integer indices and achieving memory bandwidth utilization close to the theoretical STREAM benchmark limit.
2.2 Multi-dimensional Coarsening (P2)
Unlike traditional methods that may coarsen in only one direction at a time, StructMG performs simultaneous multi-dimensional coarsening. This strategy significantly reduces operator complexity, resulting in less data movement and fewer levels in the multigrid hierarchy, which directly improves communication efficiency during parallel execution.
2.3 Unified Parallel SpTRSV Framework (P3)
To handle difficult anisotropic problems, StructMG implements robust smoothers such as Gauss-Seidel and ILU. These are traditionally difficult to parallelize due to strict data dependencies. StructMG introduces a novel level-based task scheduling and point-to-point (P2P) synchronization strategy. This allows multiple threads to process these smoothers simultaneously without compromising the convergence speed of the solver.
3. Experimental Evaluation
The performance of StructMG was evaluated against six representative problems across various domains, including Laplace benchmarks, radiation hydrodynamics (rhd, rhd-3T), atmospheric dynamics (weather), petroleum reservoir simulation (oil-4C), and solid mechanics (solid-3D). These problems range from 2.1 million to 637 million unknowns and feature varying degrees of anisotropy and irregular topography.
Tests were conducted on both ARM (Kunpeng 920) and X86 (AMD EPYC) platforms, using the hypre library as the primary baseline for comparison.
4. Key Results and Discussion
StructMG consistently outperformed the hypre library across all test cases:
- Execution Speed: On average, StructMG is 15.5x faster than SMG, 5.5x faster than PFMG, and 7.3x faster than BoomerAMG.
- Scalability: In strong scaling tests, StructMG maintained high efficiency where other solvers plateaued. For the
rhdproblem, StructMG achieved 46% efficiency at maximum parallelism, whereas SMG efficiency dropped to 6.2%. - Convergence Robustness: Due to its advanced parallel smoothers, StructMG often requires significantly fewer iterations than PFMG to reach target accuracy, particularly in highly anisotropic scenarios like the "weather" dataset.
By strictly respecting the structured nature of the grid while determining coefficients algebraically, StructMG provides a framework that can automatically build hierarchies for complex PDEs that traditional geometric multigrid (GMG) methods would struggle to handle.
5. Conclusion and Future Work
StructMG demonstrates that specialized code generation and optimized parallel scheduling can drastically improve the performance of algebraic multigrid methods on structured grids. While currently focused on single-block structured grids and specific stencil patterns (3d7 to 3d27), future development aims to extend the framework to multi-block "semi-structured" grids. Additionally, while this work focuses on multicore CPUs, the authors are currently developing a GPU-accelerated version to further push the boundaries of large-scale scientific simulation.
Summary updated