Skip to main content
QUICK REVIEW

[Paper Review] Bonsai: A GPU Tree-Code

Jeroen Bédorf, Evghenii Gaburov|arXiv (Cornell University)|Apr 10, 2012
Algorithms and Data Compression2 references3 citations
TL;DR

Bonsai is a fully GPU-accelerated gravitational tree-code that executes all algorithmic components—tree construction, multipole moment computation, and tree traversal—entirely on the GPU, eliminating CPU-GPU data transfers. It achieves over 2.8 million particles per second on a GTX480, delivering a 20x performance gain over optimized CPU code by leveraging GPU parallelism and efficient memory access patterns in hierarchical N-body simulations.

ABSTRACT

We present a gravitational hierarchical N-body code that is designed to run efficiently on Graphics Processing Units (GPUs). All parts of the algorithm are executed on the GPU which eliminates the need for data transfer between the Central Processing Unit (CPU) and the GPU. Our tests indicate that the gravitational tree-code outperforms tuned CPU code for all parts of the algorithm and show an overall performance improvement of more than a factor 20, resulting in a processing rate of more than 2.8 million particles per second.

Motivation & Objective

  • To eliminate CPU-GPU data transfer bottlenecks in N-body simulations by executing the entire Barnes-Hut tree-code on the GPU.
  • To achieve superior performance for large-scale gravitational N-body simulations using GPU parallelism.
  • To enable efficient block time-step integration by minimizing redundant tree reconstruction and focusing computation on active particles.
  • To demonstrate that GPU-optimized tree algorithms can scale linearly with particle count while maintaining accuracy.
  • To provide a general-purpose GPU-accelerated tree-structure framework applicable beyond gravitational N-body problems.

Proposed method

  • All components of the Barnes-Hut tree-code—particle sorting, tree construction, multipole moment computation, and tree traversal—are implemented directly on the GPU using CUDA kernels.
  • Particles are sorted along a space-filling Morton curve to improve memory coalescing and cache efficiency during tree construction.
  • Tree construction uses a parallel prefix scan and atomic operations to build an octree data structure entirely on the GPU.
  • Multipole moments are computed in parallel using reduction kernels to sum particle contributions within each cell.
  • Tree traversal employs the multipole acceptance criterion (MAC) with θ = 0.75, allowing adaptive opening of cells based on angular size and distance.
  • The block time-step method reduces computation by only updating active particles, with tree reconstruction triggered only when performance degrades due to cell size growth.

Experimental results

Research questions

  • RQ1Can a complete gravitational tree-code be implemented efficiently on a GPU without CPU-GPU data transfers?
  • RQ2How does GPU-optimized tree construction and traversal scale with increasing particle count N?
  • RQ3What performance gain does full GPU execution provide over hybrid CPU-GPU implementations?
  • RQ4To what extent does the average number of particle-cell interactions affect tree-traversal scaling?
  • RQ5Can the GPU-based tree structure be reused across time steps to minimize reconstruction overhead?

Key findings

  • The GPU-optimized Bonsai code achieves a processing rate of 2.8 million particles per second on a GTX480 GPU with θ = 0.75.
  • The GPU implementation outperforms optimized CPU code by more than a factor of 20 across all algorithmic components.
  • Tree-construction and multipole computation scale linearly with N for N ≥ 10^6, indicating efficient GPU utilization.
  • Tree traversal scales almost linearly with N, despite theoretical O(N log N) complexity, due to a nearly constant average number of interactions per particle.
  • More than 90% of the wall-clock time is spent on tree traversal, enabling significant speedups via block time-stepping.
  • The algorithm remains efficient even for N < 10^6, though scaling is sub-linear due to underutilization of GPU resources.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.