Abstract
The Fast Multipole Method (FMM) is a cornerstone of modern computational physics, reducing the complexity of N-body problems from $O(N^2)$ to $O(N)$. However, the construction of the underlying hierarchical data structures, such as octrees and interaction lists, often becomes a bottleneck in dynamic simulations. This paper introduces a suite of parallel algorithms designed for GPUs and distributed clusters that leverage linear-time pseudo-sorting and efficient prefix sums. These methods achieve 20-100x speedups over traditional CPU implementations, ensuring that data structure setup remains a minor component of the overall simulation time.
Introduction: The Bottleneck of Spatial Bookkeeping
The Fast Multipole Method (FMM) is widely regarded as one of the most influential algorithms of the 20th century. By approximating long-range interactions, it reduces the computational complexity of N-body problems—essential in fields like astrophysics and molecular dynamics—from $O(N^2)$ to $O(N)$. However, this efficiency depends on a complex hierarchical spatial tree (typically an octree) and a set of "interaction lists" that define how different spatial regions interact.
In dynamic simulations where particles move at every time step, the overhead of rebuilding these data structures can become a significant bottleneck. Traditional $O(N \log N)$ serial algorithms for tree construction often fail to keep pace with the highly optimized FMM calculation itself. This paper addresses this gap by proposing parallel algorithms specifically designed for GPUs and distributed CPU-GPU clusters.
Methodology: Parallelizing the Bookkeeping
The authors introduce several strategies to offload the "bookkeeping" tasks of FMM to parallel architectures:
Linear-Time Pseudo-Sorting
A major innovation is the use of a "Fixed-Grid-Method" for particle assignment. Unlike standard $O(N \log N)$ sorting, this approach recognizes that the exact order of particles within a leaf box is irrelevant for FMM. By using GPU atomicAdd operations to build occupancy histograms, particles are assigned to boxes in $O(N)$ time, bypassing the sorting bottleneck.
Parallel Interaction List Construction
To handle non-uniform particle distributions efficiently, the system employs parallel "prefix sums" (scans). This allows for the rapid compression of arrays and the skipping of empty spatial boxes. The resulting data structures, such as the NeighborList and SrcBookMark arrays, provide a fast lookup mechanism for the FMM kernels.
Distributed Data Management
For large-scale simulations on clusters, the authors classify spatial boxes into five categories: Domestic, Export, Import, Root, and Other. This classification minimizes "halo" data exchange by precisely identifying which data must be communicated across the network, keeping communication overhead scalable at $O(P^{1/3})$.
Performance and Results
The proposed algorithms were evaluated on synthetic datasets, including uniform random distributions and sparse sphere-surface distributions, with problem sizes up to 16 million particles.
- Significant Speedups: On an NVIDIA GTX480, the parallel construction was 20 to 100 times faster than traditional CPU-based methods.
- Linear Scalability: The construction time scales linearly ($O(N)$) with the number of particles, matching the theoretical complexity of the FMM itself.
- Cluster Efficiency: On the 32-node "Chimera" cluster, data structure construction accounted for only 1% to 15% of the total execution time, demonstrating strong scalability.
Insights and Limitations
A key insight from this work is that "good enough" sorting is sufficient for FMM; deterministic ordering is an unnecessary expense. However, the histogram-based approach faces memory constraints at extreme tree depths (e.g., $l_{max} > 8$), as the memory required scales with $8^l$. Additionally, while the data structure setup is now highly efficient, the physical exchange of particle data across nodes remains the primary cost in distributed environments, suggesting a need for further research into locality-aware partitioning and data compression.
Summary updated