Abstract
Dense and sparse tensors allow the representation of most bulk data structures in computational science applications. We show that sparse tensor algebra can also be used to express many of the transformations on these datasets, especially those which are parallelizable. Tensor computations are a natural generalization of matrix and graph computations. We extend the usual basic operations of tensor summation and contraction to arbitrary functions, and further operations such as reductions and mapping. The expression of these transformations in a high-level sparse linear algebra domain specific language allows our framework to understand their properties at runtime to select the preferred communication-avoiding algorithm. To demonstrate the efficacy of our approach, we show how key graph algorithms as well as common numerical kernels can be succinctly expressed using our interface and provide performance results of a general library implementation.
Introduction
In high-performance computing (HPC), developers often face a persistent trade-off between code succinctness and execution performance. While dense matrix operations benefit from highly optimized libraries like BLAS and LAPACK, irregular sparse data—where most entries are zero—remains difficult to abstract efficiently. Traditionally, programmers have had to write complex, low-level loops and manually manage data distribution to handle sparse tensors, a process that is both error-prone and difficult to optimize for communication between processors.
This paper introduces a high-level parallel programming model that treats sparse tensor algebra as a foundation for diverse computing tasks. By providing a domain-specific language (DSL) that abstracts data layout and automatically selects communication-avoiding algorithms, the authors bridge the gap between high-level expression and low-level performance across massively parallel systems.
Methodology: Extending the Cyclops Tensor Framework
The authors extend the Cyclops Tensor Framework (CTF), originally designed for dense tensors in electronic structure calculations, to support two major new features: sparsity and generalized algebraic structures.
Sparsity-Oblivious Mapping
Instead of employing complex hypergraph partitioning, the framework uses a "sparsity-oblivious" cyclic distribution. This strategy randomizes and load-balances non-zero elements across processors, which the authors found to be surprisingly effective for many "random-like" sparse structures without the overhead of expensive partitioning algorithms.
Generalized Algebraic Structures
A core innovation is the support for arbitrary algebraic structures beyond standard addition and multiplication. By supporting semirings, rings, and groups, the framework can express a wide variety of algorithms. For instance, a shortest-path graph algorithm can be expressed as a tensor contraction over a "tropical semiring" (where addition is min and multiplication is +).
The interface utilizes Einstein summation notation (e.g., C["ij"] = A["ik"] * B["kj"]), allowing complex multidimensional operations to be written in a single line. The framework then handles the heavy lifting of data redistribution and parallel execution using strategies like nested SUMMA algorithms.
Applications and Insights
The framework's utility was evaluated across three primary computational benchmarks:
- Sparse Matrix-Matrix Multiplication (SPMM): Using synthetic matrices to test performance across varying sparsity levels (1% to 16%).
- Quantum Chemistry (MP3): Simulating third-order Møller-Plesset perturbation theory to test high-order contractions.
- All-Pairs Shortest Paths (APSP): Utilizing dense graphs to compare standard path doubling against complex sparse algorithms like Tiskin’s algorithm.
A key insight from this work is the unification of graphs and tensors. By allowing user-defined element-wise functions and algebraic structures, graph traversals are treated as standard tensor operations. This allows graph algorithms to benefit from the decades of optimization research in linear algebra. Furthermore, the framework's "communication-avoiding" logic dynamically selects between 1D, 2D, or 3D parallel decomposition strategies based on non-zero counts and available hardware.
Key Results
The implementation demonstrated significant performance and scalability across various domains:
- Performance Gains: The sparse implementation achieved a 9.9x speedup over dense versions for 1% sparse SPMM problems on 384 cores. In quantum chemistry (MP3) benchmarks, the sparse approach yielded a nearly 6x speedup compared to dense methods.
- Scalability: The framework showed strong weak-scaling properties, effectively handling larger problems as more processors were added, particularly for highly sparse data.
- Flexibility: Mathematically complex algorithms, such as Tiskin’s path-doubling for APSP, were expressed succinctly using the framework's "sparsify" and "transform" primitives.
Limitations and Future Directions
While the framework provides a powerful abstraction, several areas for improvement remain. Currently, the system is optimized primarily for contractions between a sparse and a dense tensor; full "sparse-sparse" contraction optimization is a target for future work. Additionally, the framework assumes user-defined transforms are distributive, and performance remains partially dependent on the efficiency of underlying sequential kernels like Intel MKL. Future iterations may explore custom-tuned sequential sparse kernels and more advanced partitioning schemes for highly structured (e.g., block-sparse) data.
Summary updated