arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1806.05713cs.MScs.CE
收藏

用AVX2和AVX-512指令实现Lennard-Jones势的SIMD矢量化

SIMD Vectorization for the Lennard-Jones Potential with AVX2 and AVX-512 instructions

Hiroshi Watanabe, Koh M. Nakagawa

摘要:

本文介绍了采用Intel AVX2和AVX-512指令集对Lennard-Jones势的力计算进行SIMD矢量化。由于分子动力学方法的力计算核心涉及间接访问内存,因此数据布局是矢量化中最重要的因素之一。我们发现,填充的数组结构(AoS)表现出更好的性能比数组结构(SoA)与适当的向量化和优化。特别是,具有512位宽的AoS在架构中表现出最好的性能。虽然AoS和SoA之间的性能差异对于AVX2的矢量化来说很明显,但AVX-512的差异很小。其他优化技术,如软件流水线与向量化的效果,也进行了讨论。我们提出了三种CPU架构的基准测试结果:英特尔Haswell(HSW),骑士登陆(KNL)和Skylake(SKL)。与未进行矢量化优化的代码相比,在HSW上矢量化优化的代码性能提高约42%.在KNL上,手工矢量化的代码比Intel编译器自动矢量化的代码性能提高了34%。在SKL上,用AVX2矢量化的代码表现出比矢量化的AVX-512略好的性能。

英文摘要:

This work describes the SIMD vectorization of the force calculation of the Lennard-Jones potential with Intel AVX2 and AVX-512 instruction sets. Since the force-calculation kernel of the molecular dynamics method involves indirect access to memory, the data layout is one of the most important factors in vectorization. We find that the Array of Structures (AoS) with padding exhibits better performance than Structure of Arrays (SoA) with appropriate vectorization and optimizations. In particular, AoS with 512-bit width exhibits the best performance among the architectures. While the difference in performance between AoS and SoA is significant for the vectorization with AVX2, that with AVX-512 is minor. The effect of other optimization techniques, such as software pipelining together with vectorization, is also discussed. We present results for benchmarks on three CPU architectures: Intel Haswell (HSW), Knights Landing (KNL), and Skylake (SKL). The performance gains by vectorization are about 42\% on HSW compared with the code optimized without vectorization. On KNL, the hand-vectorized codes exhibit 34\% better performance than the codes vectorized automatically by the Intel compiler. On SKL, the code vectorized with AVX2 exhibits slightly better performance than that with vectorized AVX-512.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑