arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2308.07487physics.comp-ph
收藏

使用 Tensor Core 在 Nvidia GPU 上进行原子自旋动力学模拟的内核融合

Kernel Fusion in Atomistic Spin Dynamics Simulations on Nvidia GPUs using Tensor Core

Hongwei Chen, Shiyang Chen, Joshua J. Turner, Adrian Feiguin

AI总结:

针对原子自旋动力学中自旋-自旋关联函数计算随自旋数二次增长的问题,本文利用 Nvidia GPU 与 Tensor Core,通过 CUTLASS 融合 GEMM 内核和逐元素操作并在 epilogue 中即时计算,实现最高 25 倍加速及 26%~33% 性能提升。

摘要:

在原子自旋动力学模拟中,在实空间中构造空间和时间位移的对关联函数的时间成本随自旋数 $N$ 呈二次方增长,导致巨大的计算量。可以采用 GEMM 子程序来加速动态自旋-自旋关联函数的计算,但在 CPU 上模拟大型自旋系统(超过 40000 个自旋)的计算成本仍然很高。在这项工作中,我们在图形处理器(GPU)上进行模拟,GPU 是一种被广泛用作科学计算和深度学习加速器的硬件解决方案。我们表明,当在多核 CPU 和 GPU 上都使用 GEMM 子程序时,与多核 CPU 相比,GPU 可将模拟加速最高达 25 倍。为了隐藏内存延迟,我们使用 CUTLASS 将逐元素操作融合到 GEMM 内核中,与基于 cuBLAS 的实现相比,这可将性能提高 26%~33%。此外,我们在 GEMM 子程序的 epilogue 中执行即时(on-the-fly)计算,以避免将中间结果保存在全局内存中,这使得大规模原子自旋动力学模拟变得可行且可负担。

英文摘要:

In atomistic spin dynamics simulations, the time cost of constructing the space- and time-displaced pair correlation function in real space increases quadratically as the number of spins $N$, leading to significant computational effort. The GEMM subroutine can be adopted to accelerate the calculation of the dynamical spin-spin correlation function, but the computational cost of simulating large spin systems ($>40000$ spins) on CPUs remains expensive. In this work, we perform the simulation on the graphics processing unit (GPU), a hardware solution widely used as an accelerator for scientific computing and deep learning. We show that GPUs can accelerate the simulation up to 25-fold compared to multi-core CPUs when using the GEMM subroutine on both. To hide memory latency, we fuse the element-wise operation into the GEMM kernel using $\mathtt{CUTLASS}$ that can improve the performance by 26% $\sim$ 33% compared to implementation based on $\mathtt{cuBLAS}$. Furthermore, we perform the on-the-fly calculation in the epilogue of the GEMM subroutine to avoid saving intermediate results on global memory, which makes the large-scale atomistic spin dynamics simulation feasible and affordable.

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

↑