GPU Optimization for High-Quality Kinetic Fluid Simulation

Yixin Chen, Wei Li, Rui Fan, Xiaopei Liu

TL;DR

This paper presents a suite of GPU optimizations for high-quality kinetic fluid simulations, specifically addressing the challenges of simulating complex solid-fluid interactions. By introducing novel data layouts, load-balancing techniques, and a parametric cost model, they achieve significant speedups (5-10x) over baseline kinetic solvers and outperform state-of-the-art Navier-Stokes solvers in both performance and visual fidelity.

What Problem Does This Paper Address?

Simulating fluid dynamics is crucial in computer graphics for realistic visual effects. Traditional methods often rely on solving the incompressible Navier-Stokes equations (INSE), which leads to computationally expensive sparse linear systems that are difficult to parallelize efficiently, especially on GPUs. While kinetic methods, like the Lattice Boltzmann Equation (LBE), offer a more local and thus parallelizable approach, earlier models suffered from accuracy and stability issues, leading to visual artifacts. The recent ACM-MRT model improves quality but still faces performance bottlenecks when simulating complex scenarios, particularly those involving solid objects immersed in the fluid. These challenges include inefficient data handling, load imbalance when dealing with solids, and suboptimal GPU utilization.

Methods

The authors introduce several key GPU optimization techniques:

  • Communication-Efficient Data Layout: A new parametric data layout (CSOA) is proposed to maximize data access contiguity for both fluid and solid data, improving memory performance and reducing warp divergence.
  • Load-Balanced Immersed Boundary (IB) Method: Instead of traditional bounce-back schemes that can cause warp divergence, they employ an IB method. To address load imbalance inherent in IB, they propose a "scattering" approach where threads are parallelized over solid samples, redistributing forces to fluid nodes. This significantly improves load balancing.
  • Multi-Kernel Launch and Simplified Collision: To mitigate low GPU occupancy caused by lengthy ACM-MRT collision calculations, they break down the computation into multiple kernel launches and simplify the mathematical expressions. This reduces register pressure and improves execution efficiency.
  • Parametric Cost Model: A novel framework is introduced to automatically search for optimal parameters (data layout parameters l and a) that balance simulation cost and performance for different geometries and simulation scenarios.
  • Multi-GPU Extension: The optimizations are extended to multi-GPU systems, enabling large-scale simulations by subdividing the domain and managing inter-GPU communication.

Datasets

The paper does not explicitly mention training datasets. Instead, it focuses on evaluating its method using various simulation scenarios with different grid resolutions and complex solid geometries (e.g., a ball, a dragon, an airplane, a car). The performance and visual quality are compared against existing solvers using these simulation setups.

Key Insights and Ideas

  • Kinetic Solvers are Viable for High-Quality Graphics: The ACM-MRT model, when properly optimized, can achieve visual quality comparable to or even surpassing state-of-the-art INSE solvers, but with significantly better performance.
  • Data Layout is Paramount for GPU Performance: The choice of data layout (CSOA) is critical for memory coalescing and reducing warp divergence, especially when dealing with complex data structures like those in IB methods.
  • Parallelizing over Solids for IB: Shifting from parallelizing IB over fluid nodes to parallelizing over solid samples is a key insight for achieving better load balancing and reducing warp divergence.
  • Automated Parameter Tuning is Essential: The performance of kinetic solvers with IB is highly sensitive to parameters related to data layout. An automated parametric cost model is crucial for finding optimal settings, especially for complex geometries.
  • Trade-offs in GPU Optimization: Techniques like multi-kernel launches improve occupancy but increase memory access. The paper demonstrates how to find an optimal balance through parameter tuning.

Key Results

  • Performance Speedup: The optimized solver achieves a 5-10x speedup over a baseline GPU implementation and is significantly faster (up to an order of magnitude) than state-of-the-art GPU-based INSE solvers at similar grid resolutions.
  • Visual Quality: The ACM-MRT model, with the proposed optimizations, produces high-quality, visually appealing simulations, capturing turbulent flows with less diffusion and dispersion than older kinetic models.
  • Scalability: The method demonstrates good scalability on multi-GPU systems, with near-perfect scaling observed from 1 to 2 GPUs for certain configurations.
  • Parameter Optimization Impact: The parametric cost model can lead to significant performance improvements (several times faster) compared to using suboptimal parameters.
  • Reduced Grid Resolution: Due to its higher convergence rate, the solver can achieve visual quality comparable to INSE solvers using a significantly lower grid resolution, leading to a two-order-of-magnitude performance improvement in some cases.

Limitations and Future Work

  • Memory Usage: The optimized solver requires more memory (approximately 3x) than some INSE solvers due to the nature of kinetic methods and the use of multiple kernel launches.
  • Liquid Simulations: The current GPU optimizations are not directly suitable for liquid simulations, which would require modifications like a volume-of-fluid method and a revised memory layout.
  • Multi-GPU Communication: While multi-GPU support is implemented, communication currently occurs through the CPU, which can limit performance. Future work could explore direct GPU-to-GPU communication for better scaling.
  • Dynamic Solids and Memory: For dynamic solids, all solid samples are stored on each GPU to avoid communication, leading to increased memory usage.
  • Further Optimization: The authors suggest further research into more versatile and memory-efficient GPU-based kinetic solvers.

Summary updated

Abstract

Fluid simulations are often performed using the incompressible Navier-Stokes equations (INSE), leading to sparse linear systems which are difficult to solve efficiently in parallel. Recently, kinetic methods based on the adaptive-central-moment multiple-relaxation-time (ACM-MRT) model [1], [2] have demonstrated impressive capabilities to simulate both laminar and turbulent flows, with quality matching or surpassing that of state-of-the-art INSE solvers. Furthermore, due to its local formulation, this method presents the opportunity for highly scalable implementations on parallel systems such as GPUs. However, an efficient ACM-MRT-based kinetic solver needs to overcome a number of computational challenges, especially when dealing with complex solids inside the fluid domain. In this article, we present multiple novel GPU optimization techniques to efficiently implement high-quality ACM-MRT-based kinetic fluid simulations in domains containing complex solids. Our techniques include a new communication-efficient data layout, a load-balanced immersed-boundary method, a multi-kernel launch method using a simplified formulation of ACM-MRT calculations to enable greater parallelism, and the integration of these techniques into a parametric cost model to enable automated prameter search to achieve optimal execution performance. We also extended our method to multi-GPU systems to enable large-scale simulations. To demonstrate the state-of-the-art performance and high visual quality of our solver, we present extensive experimental results and comparisons to other solvers.
BibTeX
@article{chen2022gpu,
  author = {Yixin Chen and Wei Li and Rui Fan and Xiaopei Liu},
  title = {{GPU Optimization for High-Quality Kinetic Fluid Simulation}},
  journal = {IEEE Trans. Vis. Comput. Graph.},
  year = {2022},
  url = {https://openreview.net/forum?id=ldrxtg71Xu},
}
Figure