摘要
格子玻尔兹曼方法(Lattice Boltzmann Method,LBM)在计算流体力学领域中得到广泛应用,但传统的LBM计算程序耗时巨大,如何优化LBM的计算程序具有重要研究意义.现有的优化方法较少关注LBM计算程序中时间步迭代中潜在的大量数据重用收益,造成计算性能损失.本文通过对LBM计算程序核心循环代码进行循环优化,将其巨大的迭代空间划分成满足cache容量的分块,从而提高数据重用性,同时开发粗粒度循环并行性.分块大小在对迭代空间划分时起到了影响性能的关键作用.本文根据LBM的程序特征提出了一种混合的分块大小选择方法——LBM_TSS方法.该方法从LBM计算程序的访存行为、局部性收益、并行效率以及同步开销四个方面进行静态分析,在约束条件限定的搜索空间内进一步对分块大小寻优,从而计算出性能最优的分块大小.本文在一个共享内存多核系统上对LBM_TSS方法的有效性进行了全面的验证和分析.实验结果表明,在最优情况下,采用LBM_TSS方法计算的分块大小所实现的LBM循环优化方法,与其他3种LBM并行优化方法相比,将LBM程序性能提高了16.79%.
The Lattice Boltzmann Method(LBM)is widely used in the field of computational fluid dynamics.However,the traditional LBM computation is time-consuming.Therefore,it has great significance to optimize LBM computation program.The existing algorithms pay little attention to the potential large amount of data reuse benefits in time step iterations of the LBM computation program,resulting in the loss of performance.This paper performs loop optimizations on the core loops of LBM computation program to divide the huge iteration space into blocks or tiles that match the cache capacity,thereby improving data reuse and developing coarse-grained loop parallelism.The tile size has an important impact on program performance when partitioning the iteration space.A hybrid tile size selection method,LBM_TSS,is proposed,based on the program characteristics.LBM_TSS performs static analysis from the four aspects of LBM computation program’s memory access behavior,locality benefits,parallel efficiency and synchronization cost to construct constraints of tile sizes.Then,LBM_TSS performs empirical search to tune the best tile size in the constrained search space.The effectiveness of LBM_TSS is fully verified and analyzed on a shared memory multi-core system.Experimental results show that our loop optimization method with the tile size calculated by LBM_TSS improves the performance of LBM program by 16.79%at best,compared with other three LBM parallel optimization methods.
作者
崔元桢
刘松
王倩
伍卫国
CUI Yuan-Zhen;LIU Song;WANG Qian;WU Wei-Guo(School of Computer Science and Technology,Xi’an Jiaotong University,Xi’an 710049)
出处
《计算机学报》
EI
CSCD
北大核心
2020年第6期1086-1102,共17页
Chinese Journal of Computers
基金
国家重点研发计划(2017YFB0203003)
国家自然科学基金(91630206,61672423)资助.