Introduction
Real-time signal processing applications, such as live Magnetic Resonance Imaging (MRI) reconstruction, operate under stringent computational constraints. These systems must process fixed problem sizes within strict operational deadlines—mathematical operations must be completed before the next frame of data arrives. To meet these demands, developers increasingly rely on multi-GPU configurations. However, existing programming models often fall short: they either target single GPUs, requiring significant manual effort to manage multiple devices, or are designed for massive clusters, focusing on weak scaling rather than the strong scaling required for real-time tasks.
This paper introduces MGPU, a C++ template library designed to bridge this gap. By providing a high-level abstraction for single-node, multi-GPU systems, MGPU simplifies the development of high-performance, real-time applications.
The MGPU Library: Segmented Containers and Communication
MGPU is modeled after the C++ Standard Template Library (STL) and sits atop the CUDA framework. Its primary innovation is the segmented container abstraction, specifically the segmented_vector.
As shown in the figure above, the segmented_vector allows a programmer to treat data as a single logical entity. Under the hood, the library automatically partitions the data into segments and distributes them across the local memory of all available GPUs. This abstraction allows developers to scale algorithms with minimal changes to their existing single-GPU code.
Beyond data structures, MGPU implements MPI-like communication primitives—such as copy, scatter/gather, broadcast, and reduce—optimized for the PCIe bus. Where hardware support is available, the library utilizes direct peer-to-peer (P2P) memory transfers between GPUs, bypassing the CPU to minimize latency.
Hardware Topology and Performance Constraints
A critical insight from the development of MGPU is that hardware topology dictates performance. In multi-GPU desktop systems, the physical connection between devices (the PCIe topology) determines the available bandwidth and latency for inter-GPU communication.
Benchmarking on an 8-GPU system reveals that GPUs connected to the same I/O hub (IOH) can achieve high-speed P2P transfers. Conversely, data moving between GPUs on different hubs must route through the host CPU's main memory, creating a significant bottleneck. As illustrated in the bandwidth measurements, paths (a) and (b) represent local memory access, while paths (c) through (f) show the varying performance of inter-device communication. This "topology-aware" reality means that while batched operations (like FFTs) scale linearly, operations requiring global data reduction (like dot products) are limited by the slowest communication path.
Real-World Application: MRI Reconstruction
To demonstrate the library's efficacy, the authors parallelized an iteratively regularized Gauss-Newton method for non-linear MRI reconstruction. By distributing MRI coil sensitivity maps across GPUs using segmented vectors, the application achieved:
- 1.7x speedup with 2 GPUs.
- 2.1x speedup with 4 GPUs.
- Peak performance of 11.4 frames per second, reaching the clinically viable range of 5–30 Hz.
Interestingly, power efficiency analysis showed that using 2 or 3 GPUs is the most energy-efficient configuration. While 4 GPUs draw more instantaneous power, the reduced computation time results in total energy consumption comparable to a single-GPU setup.
Conclusion and Future Work
MGPU successfully simplifies multi-GPU programming for real-time systems, enabling significant speedups in complex algorithms like MRI reconstruction. However, scaling beyond 4 GPUs remains a challenge due to I/O hub bottlenecks in current hardware architectures. Future work will focus on implementing an OpenCL backend to support a wider range of hardware and exploring alternative data decomposition schemes to further reduce inter-GPU communication overhead.
Summary updated