torch-sla: Differentiable Sparse Linear Algebra with Adjoint Solvers and Sparse Tensor Parallelism for PyTorch
Mingyuan Chi
TL;DR
torch-sla addresses differentiable sparse linear algebra at industrial scale by fusing adjoint-based differentiation, distributed sparse tensor parallelism, and PyTorch integration. It achieves backward passes with $O(1)$ graph nodes and $O(\text{nnz})$ memory for linear, eigenvalue, and nonlinear problems, while enabling domain-decomposition with halo exchange that scales to $4\times 10^8$ DOF on $3$ GPUs. The experiments demonstrate GPU-accelerated solvers across backends and gradient verification showing high accuracy ($<10^{-5}$ relative error), enabling end-to-end differentiable simulations in PyTorch for unstructured sparse systems. The library provides a practical pathway to scalable physics-informed learning and neural operators on large sparse meshes and graphs.
Abstract
Industrial scientific computing predominantly uses sparse matrices to represent unstructured data -- finite element meshes, graphs, point clouds. We present \torchsla{}, an open-source PyTorch library that enables GPU-accelerated, scalable, and differentiable sparse linear algebra. The library addresses three fundamental challenges: (1) GPU acceleration for sparse linear solves, nonlinear solves (Newton, Picard, Anderson), and eigenvalue computation; (2) Multi-GPU scaling via domain decomposition with halo exchange, reaching \textbf{400 million DOF linear solve on 3 GPUs}; and (3) Adjoint-based differentiation} achieving $\mathcal{O}(1)$ computational graph nodes (for autograd) and $\mathcal{O}(\text{nnz})$ memory -- independent of solver iterations. \torchsla{} supports multiple backends (SciPy, cuDSS, PyTorch-native) and seamlessly integrates with PyTorch autograd for end-to-end differentiable simulations. Code is available at https://github.com/walkerchi/torch-sla.
