arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2206.01791physics.comp-phphysics.geo-ph
收藏

在苹果M系列统一芯片上通过Metal着色语言实现基于C++的物理计算的无缝GPU加速

Seamless GPU acceleration for C++ based physics with the Metal Shading Language on Apple's M series unified chips

Lars Gebraad, Andreas Fichtner

AI总结:

本研究利用Metal着色语言在苹果M系列统一芯片上实现C++物理计算的无缝GPU加速,通过统一内存降低编程复杂度,在数组运算和弹性波方程求解中实现近一个数量级的性能提升,为科研人员利用GPU加速提供了低门槛方案。

摘要:

苹果生产的M系列芯片已被证明是主流英特尔和AMD x86处理器在日常任务中的一种高性能且高能效的替代方案。此外,其集成了中央处理器和图形处理器的统一设计,使得这些M系列芯片无需独立图形处理器(GPU)就能出色完成许多有高图形需求的任务,在某些情况下性能甚至优于独立GPU。\n在本研究中,我们展示了如何利用Metal着色语言(MSL)在M系列芯片上加速C++中的典型数组运算。更重要的是,我们展示了MSL的使用如何通过允许中央处理器(CPU)和GPU在统一内存中工作,规避了CUDA或OpenACC内存管理的典型复杂性。我们对比了串行CPU代码和OpenMP加速的CPU代码,验证了M系列芯片在标准一维和二维数组运算(如数组加法、SAXPY和有限差分模板)上的性能表现。MSL实现复杂度的降低,还让我们能够以最小的工作量,使用MSL加速现有的弹性波方程求解器(最初基于OpenMP加速的C++开发),同时保留所有CPU和OpenMP功能。\n在特定设置下,波方程模拟的性能提升接近一个数量级。使用MSL获得的这一增益,与其他GPU加速的波传播代码相对于其CPU版本的增益相近,但不会带来过高的编程复杂度——这种复杂度通常会阻碍普通科研人员利用这些加速器。这一结果表明,统一处理单元对地震学家和广义上的计算科学家而言是一种有价值的工具,降低了编写可利用现代GPU的高性能代码的门槛。

英文摘要:

The M series of chips produced by Apple have proven a capable and power-efficient alternative to mainstream Intel and AMD x86 processors for everyday tasks. Additionally, the unified design integrating the central processing and graphics processing unit, have allowed these M series chips to excel at many tasks with heavy graphical requirements without the need for a discrete graphical processing unit (GPU), and in some cases even outperforming discrete GPUs. In this work, we show how the M series chips can be leveraged using the Metal Shading Language (MSL) to accelerate typical array operations in C++. More importantly, we show how the usage of MSL avoids the typical complexity of CUDA or OpenACC memory management, by allowing the central processing unit (CPU) and GPU to work in unified memory. We demonstrate how performant the M series chips are on standard one-dimensional and two-dimensional array operations such as array addition, SAXPY and finite difference stencils, with respect to serial and OpenMP accelerated CPU code. The reduced complexity of implementing MSL also allows us to accelerate an existing elastic wave equation solver (originally based on OpenMP accelerated C++) using MSL, with minimal effort, while retaining all CPU and OpenMP functionality. The resulting performance gain of simulating the wave equation is near an order of magnitude for specific settings. This gain attained from using MSL is similar to other GPU-accelerated wave-propagation codes with respect to their CPU variants, but does not come at much increased programming complexity that prohibits the typical scientific programmer to leverage these accelerators. This result shows how unified processing units can be a valuable tool to seismologists and computational scientists in general, lowering the bar to writing performant codes that leverage modern GPUs.

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

↑