SoAx:一个通用的C++数组结构,用于处理HPC代码中的粒子
SoAx: A generic C++ Structure of Arrays for handling Particles in HPC Codes
摘要:
物理问题的数值研究通常需要根据给定的一组方程对大量粒子的动力学进行积分。粒子的特征在于它们携带的信息,如身份,位置其他。一般来说,在高性能计算(HPC)代码中处理粒子有两种不同的可能性。结构数组(AoS)的概念是在面向对象编程(OOP)范式的精神,在粒子信息实现为一个结构。在这里,一个对象(结构的实现)代表一个粒子,一组多个粒子存储在一个数组中。相比之下,使用阵列结构(SoA)的概念,单个结构包含几个阵列,每个阵列代表整个粒子集的一个属性(例如身份)。AoS方法由于其简便性和灵活性而经常在HPC代码中实现。然而,对于一类问题,SoA的性能要比AoS好得多。我们证实了我们的粒子问题的观察。使用基准测试,我们表明,在现代英特尔至强处理器上,SoA实现通常比AoS快几倍。在英特尔的MIC协处理器上,性能差距甚至达到了十倍。GPU计算也是如此,使用计算和多用途GPU。结合性能和易用性,我们提出了具有最佳性能(CPU,MIC和GPU)的SoAx库,同时提供与AoS相同的易用性。为此,SoAx使用现代C++设计技术,例如模板Meta编程,允许为用户定义的异构数据结构自动生成代码。
英文摘要:
The numerical study of physical problems often require integrating the dynamics of a large number of particles evolving according to a given set of equations. Particles are characterized by the information they are carrying such as an identity, a position other. There are generally speaking two different possibilities for handling particles in high performance computing (HPC) codes. The concept of an Array of Structures (AoS) is in the spirit of the object-oriented programming (OOP) paradigm in that the particle information is implemented as a structure. Here, an object (realization of the structure) represents one particle and a set of many particles is stored in an array. In contrast, using the concept of a Structure of Arrays (SoA), a single structure holds several arrays each representing one property (such as the identity) of the whole set of particles. The AoS approach is often implemented in HPC codes due to its handiness and flexibility. For a class of problems, however, it is know that the performance of SoA is much better than that of AoS. We confirm this observation for our particle problem. Using a benchmark we show that on modern Intel Xeon processors the SoA implementation is typically several times faster than the AoS one. On Intel's MIC co-processors the performance gap even attains a factor of ten. The same is true for GPU computing, using both computational and multi-purpose GPUs. Combining performance and handiness, we present the library SoAx that has optimal performance (on CPUs, MICs, and GPUs) while providing the same handiness as AoS. For this, SoAx uses modern C++ design techniques such template meta programming that allows to automatically generate code for user defined heterogeneous data structures.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。