Researchers from ETH Zurich and the Swiss National Supercomputing Centre (CSCS) have introduced COSMA, a parallel matrix-matrix multiplication (MMM) algorithm that achieves near-optimal communication costs across diverse hardware configurations and matrix dimensions.
The Communication Bottleneck in MMM
Matrix-Matrix Multiplication is a cornerstone of scientific computing, essential for fields ranging from machine learning to computational chemistry. In the era of exascale computing, the primary performance bottleneck has shifted from computational throughput to data movement—both "horizontal" I/O between processors and "vertical" I/O within the memory hierarchy.
Historically, algorithms have evolved to minimize this I/O cost. 2D algorithms like SUMMA are effective for square matrices but fail to utilize extra available memory. 2.5D and 3D algorithms use that memory but often impose rigid constraints on processor grids (e.g., requiring perfect cubes). Recursive algorithms like CARMA offer asymptotic optimality but struggle with irregular processor counts or non-power-of-two dimensions.
Methodology: A Bottom-Up Design
COSMA departs from the traditional "top-down" approach of partitioning a global matrix. Instead, it employs a bottom-up strategy rooted in the mathematical framework of the red-blue pebble game.
- Optimal Sequential Schedule: COSMA first determines the most efficient sequential execution pattern for a single processor, maximizing data reuse within the constraints of local memory.
- Parallelization via S-partitions: The algorithm then tiles these optimal sequential steps across the available processors. This ensures that every processor operates at its local I/O lower bound.
- Handling Irregularity: By avoiding recursive bisection, COSMA maintains optimality for any number of processors (including primes) and any matrix shape (square, tall-and-skinny, or wide).
The implementation leverages MPI one-sided communication (RDMA) to overlap computation with data transfers, ensuring high efficiency on modern interconnects.
Performance and Results
The authors benchmarked COSMA on the Piz Daint supercomputer against industry standards including ScaLAPACK (Intel MKL), the Cyclops Tensor Framework (CTF), and CARMA.
Key findings include:
- Peak Efficiency: COSMA achieved up to 88% of the theoretical peak performance of Piz Daint nodes.
- Significant Speedups: It outperformed competitors by an average of 2.2x, with speedups reaching 12.8x for highly non-square matrices.
- Robustness: Unlike CTF or CARMA, COSMA's performance remains stable across "awkward" processor counts and matrix dimensions, effectively bridging the gap between 2D and 3D algorithmic behaviors as memory availability changes.
Conclusion
COSMA represents a significant step forward in high-performance linear algebra. By prioritizing data reuse patterns over fixed processor grids, it provides a "one size fits all" solution for parallel MMM. Future work aims to extend this bottom-up tiling logic to other critical kernels, such as LU and Cholesky decompositions.
Summary updated