Enhancement of GPU-accelerated smoothed particle hydrodynamics (SPH) method with dynamic parallelism
Enhancement of GPU-accelerated smoothed particle hydrodynamics (SPH) method with dynamic parallelism

Abstract: This study introduces an innovative GPU programming architecture utilizing CUDA Dynamic Parallelism (CDP), aimed at improving the computational efficiency of smoothed particle hydrodynamics (SPH) simulations.Compared with the traditional CPU-GPU collaborative framework, dynamic parallelism enables dynamic device-side kernel launches and synchronization, effectively mitigating the latency caused by CPU-GPU communication bottlenecks, thereby improving the end-to-end computational throughput of the SPH solver.Within this framework, the neighboring particle search and particle interaction computations in SPH are parallelized on the GPU architecture. In addition, dynamic parallelism employs fine-grained task management through CUDA streams, enabling direct device-side data synchronization and concurrent task scheduling, thereby bypassing the traditional CPU/GPU control barriers that hinder computational efficiency. Through two benchmark tests conducted on an NVIDIA GeForce RTX 4080 SUPER GPU,the proposed dynamic-parallelism SPH implementation demonstrates a speedup of approximately 1.5x to 3.0x compared with the traditional CPU-GPU SPH solver in large-scale and dynamically evolving particle systems.Furthermore, the root mean square error between the SPH simulations and experimental data is 0.03-0.12 m/s for the dam-break flow and 0.004-0.008 m/s for the water-entry problem. Under the same SPH algorithm, the CDP architecture can achieve higher computational efficiency than conventional CUDA techniques. Currently, no other well-known SPH software uses this CDP concept, and this should be the first application of CDP in GPU-based SPH simulations. Introduction: To resolve fine surface features and achieve high-fidelity accuracy in meshless smoothed particle hydrodynamics (SPH) simulations, the number of particles required must grow exponentially. Physically accurate large-scale real-time fluid animations with high spatial resolution typically require million-level particle systems, which impose strict constraints on computational resources and require high-performance computing (HPC) techniques. Since its first application in computational fluid dynamics (CFD), SPH modeling technology has been widely used in various engineering fields. The rapid development of GPU computing technology has made GPU-accelerated SPH algorithms a key research topic in computational mechanics. Foundational work began to emerge when Kipfer et al. and Kolb et al. respectively proposed GPU-compatible decoupled particle systems for macroscopic fluid simulation. Subsequently, Kolb and Cuntz introduced a GPU-native implementation of a dynamic particle coupling scheme. Then, Harada et al. proposed a GPU-based SPH neighboring particle search algorithm, marking the first GPU-native SPH implementation. Before the introduction of the Compute Unified Device Architecture framework, the above methods encountered severe limitations in achieving efficient spatial scheduling of GPU threads and systematic utilization of memory resources, so their computational efficiency was far below theoretical expectations. NVIDIA innovatively introduced CUDA technology in 2007 and applied it to particle simulation in 2008, and it was subsequently further refined in Green. Hérault et al. proposed the earliest CUDA-based SPH method implementation, and at the same time, Goswami et al. proposed a method for optimizing SPH using CUDA shared memory. Dominguez et al. proposed several improved optimization strategies for CPU/GPU implementations of SPH, and two years later, Crespo et al. proposed the pioneering open-source code Dual-SPHysics for performing SPH computations on the CUDA architecture. Xia and Liang proposed a neighboring particle search method using a quadtree instead of a grid-based linked list in shallow water flow computations. However, due to the lack of dynamic parallelism, their algorithm failed to fully exploit the parallelization advantages of the GPU. Another open-source SPH solver, gpuSPHASE, attempted to optimize the use of shared memory rather than global memory. However, their system loaded only the primary particles, so the performance improvement was not fully realized. In addition, Huang et al. developed a more general GPGPU acceleration framework, mainly for neighboring particle search in SPH, and fully utilized GPU caches (such as shared memory and register memory). In recent years, significant progress has also been made in the field of GPU-based SPH. For example, Yang et al. implemented GPU with adaptive particle refinement into the SPH framework to study multiphase flow and fluid-structure interaction applications. Zha Overall, apart from algorithmic aspects, the performance barriers of GPU implementations in SPH over the years remain memory usage, load balancing, and high-latency communication between the central processing unit (CPU) and the GPU. The ultimate solution to this bottleneck may be achieved through so-called dynamic parallelism.CUDA Dynamic Parallelism (CDP), as an architectural innovation, significantly enhances the computational capability of GPUs and has shown great potential in recent years in applications involving complex tasks and large-scale problems. The CDP principle was first proposed by Jones et al., and its core lies in allowing various GPU threads to dynamically launch child threads, thereby enabling more flexible and parallelized designs. Initial research focused on the performance of CDP in clustering algorithms and unstructured GPU applications. Subsequently, Zhang et al. introduced CDP into graph optimization, while Neelima et al. studied its effectiveness in recursive sorting. Plauth et al. [24] evaluated the performance of CDP in handling fine-grained irregular workloads and showed that CDP can theoretically improve computational performance. On the other hand, to address the performance issues of CDP in terms of kernel launch frequency and thread branch efficiency, various researchers have proposed a series of optimization schemes. For example, El Hajj et al. developed the Kernel Launch Aggregation and Promotion (KLAP) technique, which significantly reduces kernel launch overhead and thereby improves throughput. Tang et al. further optimized the scheduling efficiency of CDP by controlling kernel launches, and Jarzabek and Czarnul applied CUDA Unified Memory (UM) technology to more complex recursive algorithms. Recently, Bozorgmehr et al. achieved a 128x performance improvement by dynamically parallelizing a 3D red-black successive over-relaxation (SOR) wind field solver. Wu applied CDP to large-scale N-body simulations of the Barnes-Hut algorithm, and Kento et al. proposed a CUDA graph-based adaptive kernel execution method that improves resource utilization for dynamic applications. Consistent with efforts to continuously improve the computational efficiency of simulation and detection tasks, recent research in computer vision and deep learning—such as Sarhadi et al. [31] using the SWIN U-Net architecture for optimized concrete crack detection—has highlighted the role of attention mechanisms and architecture-level enhancements in achieving high-performance results. This study explores the implementation of CDP2 (CUDA Dynamic Parallelism 2) in SPH simulations to achieve breakthrough progress in GPU-accelerated computational efficiency. Leveraging the architectural features of CDP2, this study aims to develop two innovative paradigms for SPH particle systems.Compared with traditional CUDA implementations that assign single-thread execution to each particle computation, the proposed CDP2 supports multi-thread collaboration.In addition, the current work also proposes an in-kernel stream framework to coordinate data synchronization and computational scheduling of dynamically generated child kernels, thereby enabling CPU-independent control logic in SPH parallel computing and further eliminating CPU-GPU synchronization latency.Moreover, the CDP2 architecture can inherently optimize GPU workload balancing through demand-driven thread block configuration. This requires only local resource allocation within blocks and therefore shows enhanced compatibility with iterative operations. The structure of the full text is as follows. Section 2 describes the fundamentals of the SPH method and the traditional CUDA GPU implementation. Section 3 is specifically devoted to the innovative parallelization strategy of CDP2 with the SPH solver. Section 4 introduces two selected benchmark cases for evaluating computational speedup. Finally, Section 5 summarizes the results and proposes future research directions. Figures:
Fig. 1 Schematic diagram of the CUDA program framework

Fig. 2 Schematic diagram of the GPU scheduling mechanism

Fig. 3 Memory configuration model of the NVIDIA GeForce RTX 4080 SUPER

Fig. 4 Thread utilization in GPU-SPH with the traditional CUDA implementation

Fig. 5 Parent-child kernel launch nesting relationship in CUDA Dynamic Parallelism

Fig. 6 Block mode and grid mode in CDP2-SPH child kernel computation

Fig. 7 Neighboring particle search in the CDP2-SPH framework

Fig. 8 Numerical setup of the 2D dam-break flow configuration

Fig. 9 Particle distribution of the dam-break flow at multiple time instants computed by CDP2-SPH

Fig. 10 Comparison of computation time between CDP2 and CUDA in the 2D dam-break flow

Fig. 11 Comparison of the time-varying front position between SPH simulation and experimental data

Fig. 12 Numerical setup of the 3D dam-break flow configuration

Fig. 13 Comparison of computation time between CDP2 and CUDA in the 3D dam-break flow

Fig. 14 Geometry of the wedge model used in the experiment

Fig. 15 Velocity field and pressure field during wedge water entry computed by CDP2-SPH

Fig. 16 Comparison of computation time between CDP2 and CUDA in the 2D wedge water-entry problem

Fig. 17 Comparison of the time-varying velocity profile between SPH simulation and experimental data

Fig. 18 Comparison of computation time between CDP2 and CUDA in the 3D wedge water-entry problem
Conclusion: This study proposes a CDP2-accelerated GPU-SPH computational framework that enhances the task parallelism of traditional CUDA through two SPH-oriented programming techniques—block-level and grid-level configurations.The block-level optimization architecture improves the SPH model by utilizing CUDA streams to achieve parallelization among child kernels, while the grid-level optimization provides a multi-thread-block platform for particles and supplies additional threads when needed. We enhance the SPH code only in block mode by utilizing streams to optimize kernel function parallelization among various child kernels. Grid mode is proposed only as a conceptual framework because it requires different child kernels to compute particles. This mode is not recommended for scenarios involving a large number of particles, and its potential should be further explored. It should be noted that under the same SPH algorithm, the CDP architecture can achieve higher computational efficiency than traditional CUDA techniques. Currently, no other well-known SPH software uses this CDP concept, and this should be the first application of CDP in GPU-based SPH simulations. Through two benchmark tests conducted on an NVIDIA GeForce RTX 4080 SUPER GPU, the speedup of the proposed CDP SPH implementation compared with CUDA is 1.76x-2.88x in the 2D dam-break flow and 1.78x-2.32x in the 3D dam-break flow; while in the wedge water-entry problem, the speedups for 2D and 3D are 1.42x-2.58x and 1.60x-1.81x, respectively. In addition, the root mean square error between the SPH simulations and experimental data is 0.03-0.12 m/s for the dam-break flow and 0.004-0.008 m/s for the wedge water entry in the 2D configuration. It is worth noting that the speedup advantage of CDP decreases noticeably in the 3D wedge water-entry scenario. This is not a defect of the basic CDP architecture, but is related to unresolved multi-thread atomic summation conflicts in the rigid-body tracking scheme, which cause an unavoidable latency pipeline in both CDP2 and CUDA implementations. To fully exploit the potential of CDP in 3D SPH fluid-structure interaction, a further optimized GPU closed-loop architecture should be developed for the two-way fluid-structure interaction process. The speedup of CDP2 relative to CUDA decreases as the number of particles increases. This trend stems from the fundamental mechanism of the CDP architecture:One of the acceleration principles of CDP is to parallelize the serial weighted computation of neighboring particles and thereby use GPU hardware resources more effectively, thus enhancing the parallelism of CUDA-based SPH computations.This means that within the same number of particles and the same time range, CDP can utilize more GPU resources and achieve high-load operations. However, as the number of particles increases, GPU resources become saturated, so the advantage of CDP weakens accordingly. It should be noted, however, that CDP also has a load-balancing function and therefore still has an advantage over CUDA in this respect. On the other hand, for large-scale particle computations,compared with the traditional CUDA architecture, CDP can still maintain a relatively high speedup at higher particle counts.That is, although the speedup advantage decreases as the number of particles increases, this actually refers to all CDP computations themselves. Compared with CUDA computations, CDP is consistently more efficient across the entire range of data resolutions. However, it should also be recognized that the CDP2 scheme introduces additional performance overhead, such as overhead related to control logic, data synchronization, and resource allocation. In addition, although this study focuses on the coupling of CDP2 with SPH, the related methods and techniques can also be extended to other scientific computing fields where efficient parallel processing dominates. References:
[1]Xue L, Gu S, Shao S. Enhancement of GPU-Accelerated Smoothed Particle Hydrodynamics (SPH) Method with Dynamic Parallelism[J]. Results in Engineering, 2025: 106799.
Copyright statement:
This article is intended solely for academic exchange and sharing, and the copyright belongs to the original author/publisher. The translated text represents only the editor's personal understanding. If there are errors, omissions, or infringement, please contact the editor for correction or deletion.
评论 (0)