节点文献
基于众核架构的并行SPH算法的研究与实现
Research and Implementation of the Smoothed Particle Hydrodynamics Algorithm Based on Multi-core Architecture
【作者】 徐锋;
【导师】 李明禄;
【作者基本信息】 上海交通大学 , 计算机应用技术, 2013, 硕士
【摘要】 流体运动现象是周围环境的一个重要组成部分,对该现象在计算机上快速的模拟仿真,是航空航天、海洋船舶等许多行业领域所迫切需要的。目前对混合介质的流体运动模拟较为理想的方法是光滑粒子动力学(SPH)方法,它是一种无网格的纯Lagrange方法,以粒子理论为基础,通过计算整合各个粒子的状态来得到整个流场运动的规律。但是该方法在实际应用时需要用到大量的计算,以至于模拟速度缓慢。至今为止,已有一些在SPH并行方法上的研究成果,但大部分实现模型过于简化或者仅将部分算法移植到GPU上实现,未能充分利用GPU的计算能力。本文首先对SPH方法的串行程序代码做了详细分析,了解该算法的具体流程。同时对算法中的两个关键步骤(相邻粒子对构建以及粒子属性值计算)做了深入研究,归纳整合出了具体的执行过程。然后通过对串行代码的热点分析,找到程序性能瓶颈所在,寻找方法加以改善。为充分利用GPU众核架构强大的计算能力,作者对SPH的并行算法的实现主要做了如下几点贡献:将SPH算法的整体过程,包括相邻粒子对构建以及粒子物理属性值计算,移植到GPU众核架构上实现在相邻粒子对存储过程中,利用对存储空间下标的原子操作,代替使用临界区锁定整个存储空间,实现存储器的写并行,加快模拟速度。在粒子属性值计算过程中,利用共享存储器作为中间变量减少对全局存储器的访问次数,加速计算过程。利用不同线程维度,以及对GPU资源使用的分析找到最合适的并行粒度,取得最佳性能。在本文实验中,我们使用CUDA作为GPU的编程语言。在性能测试对比实验中,分别使用NVIDIA Tesla C2050以及NVIDIA Tesla K20分别作为GPU硬件设备,进行并行算法性能测试,使用Intel至强CPU W3520进行串行算法的性能测试。将并行程序的性能与串行程序作对比得到加,使用C2050GPU单卡加速可以取得相对于串行程序8倍的加速比,而使用K20GPU显卡可以取得20倍的加速比。
【Abstract】 The phenomenon of fluid motion is an important partition of theenvironment. How to simulate the fluid phenomenon fast on computer isurgently needed in aerospace, ocean ships and many other industry fields.Currently, Smoothed Particle Hydrodynamics(SPH) is an ideal method ofsimulation hybrid medium fluid motion. It is a meshless Lagrange methodand based on the particle theory. SPH method gets the law of fluid motion byintegrating all the particles’ attributes. But this method needs large quantitiesof computation, if being applied to simulation the speed will be slow.Until now, there already have some achievements on SPH parallelism.But most of them are either using simple model or just putting partition ofSPH algorithm on GPU. Thus they can’t take full advantages of GPU’scomputing capability.This paper analyses the code of the SPH serial program in detail tounderstand the whole process well. Meanwhile, this paper focus on two keyprocedures, namely building neighbor particle pairs and particles’ attributecalculation, concluding the implementation. Afterwards, in order to find theperformance bottleneck we make the hotspots analysis of the serial SPHprogram.In order to take full use of the powerful computing capability of GPU,this paper makes some contributions as following:Realize Whole SPH algorithm on GPU, include building neighborparticle pairs and calculating particle attribute values.In the process of neighbor particle pair storage, replacing the criticalarea with atomic operation to make the store procedure parallel.In the process of calculating particle attribute values, takingadvantage of shared memory to reduce the times of accessing the global memory.Combining the analysis to GPU resources and testing by differentthread dimensions to find the most proper parallel granularity.In the experiment, we use CUDA as GPU programming language. In thecomparative performance test, we use NVIDIA Tesla C2050and NVIDIATesla K20as GPU device to run parallel program separately and use IntelXRON CPU W3520to run serial program. By comparison, it is shown thatby using C2050GPU we get8X speedup and by using K20GPU we get20Xspeedup.