Abstract
The rapid diversification of high-performance computing (HPC) hardware, characterized by a variety of many-core accelerators from different vendors, poses a significant challenge for software sustainability and performance portability. Ginkgo is a next-generation C++ library designed to address these challenges in the domain of sparse linear algebra. By abstracting mathematical operations as "linear operators" and decoupling high-level solver logic from hardware-specific kernels, Ginkgo enables seamless execution across NVIDIA GPUs, AMD GPUs, and multi-core CPUs without sacrificing performance.
Introduction
The modern HPC landscape is currently experiencing a "hardware explosion." Researchers no longer rely solely on traditional CPUs; they must now target a diverse array of accelerators, including NVIDIA GPUs (via CUDA) and AMD GPUs (via HIP). Historically, achieving high performance on these platforms required rewriting entire solver algorithms for each specific backend. This approach leads to significant maintenance overhead and "code rot" as libraries struggle to keep pace with hardware evolution.
Furthermore, traditional linear algebra libraries often treat matrices and vectors as passive data containers, complicating the composition of nested or hybrid solvers. Ginkgo addresses these issues by providing a software framework that is both performance-portable and architecturally extensible, treating all components as composable linear operators.
Methodology and Architectural Design
The core innovation of Ginkgo lies in its Linear Operator Algebra design, which emphasizes composition over inheritance.
The LinOp Abstraction
In Ginkgo, every mathematical component—including matrix formats (e.g., CSR, ELL, Hybrid), solvers (e.g., CG, GMRES), and preconditioners—is implemented as a LinOp. This unified interface allows users to compose complex solver chains as modular blocks. For example, an iterative refinement solver can easily incorporate a CG solver as an inner component, which in turn utilizes a Block-Jacobi preconditioner.
The Executor Model
Ginkgo strictly separates the high-level algorithm (the "Core") from the low-level hardware execution (the "Kernels"). This is managed through an Executor object, which specifies the target architecture and manages data movement. This design ensures that the same C++ solver code can run on diverse hardware—such as an NVIDIA V100, an AMD Radeon VII, or an Intel EPYC processor—by simply swapping the executor.
Software Engineering Principles
The library leverages modern C++ features to ensure robustness and developer productivity. RAII (Resource Acquisition Is Initialization) and smart pointers are used for automatic memory management. Additionally, Ginkgo employs "mixins" via the Curiously Recurring Template Pattern (CRTP) to minimize boilerplate code. To ensure long-term sustainability, the project integrates unit testing, automated Doxygen documentation, and a continuous benchmarking framework to detect performance regressions.
Performance Evaluation
The performance of Ginkgo was evaluated using the SuiteSparse Matrix Collection, a standard benchmark for sparse linear algebra.
- Kernel Efficiency: Ginkgo’s sparse matrix-vector product (SpMV) kernels demonstrate performance that is competitive with, and often superior to, vendor-specific libraries such as NVIDIA’s cuSPARSE and AMD’s hipSPARSE.
- Bandwidth Utilization: Given that sparse solvers are typically memory-bound, Ginkgo's efficiency is reflected in its high memory bandwidth utilization, achieving over 70% of peak bandwidth on AMD hardware and over 80% on NVIDIA hardware.
- Overhead Analysis: A critical concern in object-oriented HPC frameworks is the overhead of runtime polymorphism. Ginkgo minimizes this, with the cost of selecting the appropriate kernel at runtime measuring approximately 1.5 microseconds per iteration—a negligible fraction of the total computation time in production workloads.
Conclusion and Future Work
Ginkgo provides a robust, future-proof framework for sparse linear algebra in the era of heterogeneous computing. By successfully decoupling algorithm logic from hardware implementation, it offers a sustainable path for HPC software development. While current implementations focus on single-node performance across various backends, future development aims to extend Ginkgo to distributed memory environments via MPI and to incorporate emerging standards like Intel’s oneAPI/SYCL.
Summary updated