🤖 AI Summary
Python’s scientific computing ecosystem has long lacked high-performance sparse linear algebra libraries optimized for modern CPU and GPU architectures. To address this gap, we introduce Ginkgo-Python: a lightweight, Pythonic sparse computing framework that natively wraps the high-performance Ginkgo C++ backend via Pybind11. It is the first Python library to provide unified sparse linear algebra support across CUDA, HIP, and OpenMP execution backends. Ginkgo-Python offers NumPy- and PyTorch-compatible APIs and fully supports sparse matrix–vector multiplication (SpMV) as well as mainstream iterative solvers. Experimental evaluation demonstrates that Ginkgo-Python significantly outperforms SciPy, CuPy, PyTorch, and TensorFlow in sparse matrix operations and iterative solver performance across diverse hardware platforms—while closely matching the performance of the native Ginkgo C++ library. This work bridges a critical gap in Python’s high-performance scientific computing stack for sparse linear algebra.
📝 Abstract
Sparse linear algebra is a cornerstone of many scientific computing and machine learning applications. Python has become a popular choice for these applications due to its simplicity and ease of use. Yet high performance sparse kernels in Python remain limited in functionality, especially on modern CPU and GPU architectures. We present pyGinkgo, a lightweight and Pythonic interface to the Ginkgo library, offering high-performance sparse linear algebra support with platform portability across CUDA, HIP, and OpenMP backends. pyGinkgo bridges the gap between high-performance C++ backends and Python usability by exposing Ginkgo's capabilities via Pybind11 and a NumPy and PyTorch compatible interface. We benchmark pyGinkgo's performance against state-of-the-art Python libraries including SciPy, CuPy, PyTorch, and TensorFlow. Results across hardware from different vendors demonstrate that pyGinkgo consistently outperforms existing Python tools in both sparse matrix vector (SpMV) product and iterative solver performance, while maintaining performance parity with native Ginkgo C++ code. Our work positions pyGinkgo as a compelling backend for sparse machine learning models and scientific workflows.