H2Opus: a distributed-memory multi-GPU software package for non-local operators

Stefano Zampini, Wajih Halim Boukaram, George Turkiyyah, Omar M. Knio, David E. Keyes

TL;DR

The H2Opus library introduces a high-performance, distributed-memory framework that brings the power of thousands of GPUs to non-local operators. By leveraging hierarchical $\mathcal{H}^2$-matrix representations and clever communication-hiding techniques, the researchers achieved near-ideal scalability on up to 1024 NVIDIA V100 GPUs, enabling the solution of massive scientific problems with millions of degrees of freedom in milliseconds.

What Problem Does This Paper Address?

Many critical problems in scientific computing—such as integral equations, spatial statistics, and fractional diffusion—involve "non-local" operators. Unlike local operators (like standard derivatives) that only care about neighboring points, non-local operators require every point to interact with every other point. Mathematically, this results in dense $N \times N$ matrices.

For large-scale simulations, these dense matrices are a nightmare: they require $O(N^2)$ memory and computation. Hierarchical matrices, specifically the $\mathcal{H}^2$ format, solve this by compressing the matrix into a tree-like structure with $O(N)$ complexity. However, implementing these on modern supercomputers is incredibly difficult. The irregular nature of tree-based data structures clashes with the massive, uniform parallelism of GPUs, and moving tree data between hundreds of GPUs often creates crippling communication bottlenecks.

Methods

The authors extend the H2Opus library to handle distributed-memory multi-GPU environments. Their approach rests on three pillars:

  1. Hierarchical Partitioning: The matrix is represented as a tree where "admissible" blocks (those representing long-range interactions) are stored as low-rank factorizations using a nested basis. This structure is illustrated in Figure 2, showing how the matrix is subdivided into dense (red) and low-rank (green) blocks. General partitioning of a hierarchical matrix
General partitioning of a hierarchical matrix
  1. GPU Marshaling: To keep GPUs busy, H2Opus uses "marshaling" kernels. These kernels act as fast static schedulers, gathering small, scattered tree nodes into uniform batches that can be processed by high-performance linear algebra libraries like MAGMA and KBLAS.
  2. Communication Hiding: The authors split the matrix-vector multiplication into three phases: Upsweep, Tree Multiplication, and Downsweep (see Figure 5). By separating local diagonal work from remote off-diagonal work, they use non-blocking MPI calls and dedicated communication threads to overlap data transfers with local GPU computation. The three phases of the distributed vector product
The three phases of the distributed vector product

Datasets

The implementation was evaluated using three primary benchmarks:

  • 2D Spatial Statistics: A covariance matrix generated from an exponential kernel on a 2D grid, scaled up to 536 million unknowns.
  • 3D Gaussian Process: A more memory-intensive set of matrices from a 3D grid, used to test the limits of communication overhead.
  • Fractional Diffusion Application: A real-world 2D variable diffusivity integral fractional diffusion problem with up to 16 million degrees of freedom.

Key Insights and Ideas

  • The "C-level" Threshold: The authors found that the most efficient way to distribute a tree is to process the top levels (the "root branch") on a single master GPU while distributing the lower, more numerous branches across the rest of the cluster.
  • Arithmetic Intensity is King: While single-vector multiplication is often bandwidth-limited, processing multiple vectors concurrently (the multi-vector case) significantly increases arithmetic intensity, allowing the GPUs to reach 85% of their peak theoretical efficiency.
  • Algebraic Recompression: The paper demonstrates that you don't just need to apply these matrices; you need to recompress them after operations like addition. They implemented a distributed downsweep/upsweep using batched QR and SVD to maintain the $O(N)$ footprint throughout a simulation.

Key Results

The performance results on the Summit supercomputer are striking:

  • Near-Ideal Scalability: The library demonstrated near-perfect weak scaling up to 1024 V100 GPUs.
  • High Throughput: For matrix-vector multiplication, the system exceeded 2.3 Tflop/s per GPU. At the largest scale (536M unknowns), a single vector multiplication took only 17 ms.
  • Compression Efficiency: The algebraic recompression module achieved 670 Gflops/s per GPU, compressing a 67M $\times$ 67M matrix by a factor of 6 in just 320 ms.
  • Application Success: They successfully solved a complex fractional diffusion problem on 64 GPUs, proving the library's utility for actual scientific discovery rather than just synthetic benchmarks.

Limitations and Future Work

Despite the impressive scaling, the authors noted that at 1024 GPUs, the "root tree" handled by the master process begins to become a bottleneck. Future iterations will need to coarsen the top levels of the tree more smoothly across multiple GPUs.

Planned future work includes:

  • Developing distributed-memory versions of matrix-matrix multiplication.
  • Implementing matrix inversion via Newton-Schulz iterations.
  • Integrating with the BEM++ library for boundary element methods.
  • Expanding portability to support AMD GPUs.

Summary updated

BibTeX
@article{zampini2022h,
  author = {Stefano Zampini and Wajih Halim Boukaram and George Turkiyyah and Omar M. Knio and David E. Keyes},
  title = {{H2Opus: a distributed-memory multi-GPU software package for non-local operators}},
  journal = {Adv. Comput. Math.},
  year = {2022},
  doi = {10.1007/s10444-022-09942-6},
}
Figure