Abstract

Abstract The M series of chips produced by Apple has proven a capable and power-efficient alternative to mainstream Intel and AMD ×86 processors for everyday tasks. In addition, the unified design integrating the central processing and graphics processing unit (GPU), have allowed these M series chips to excel at many tasks with heavy graphical requirements without the need for a discrete GPU) 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 important, we show how the usage of MSL avoids the typical complexity of compute unified device architecture (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 1D and 2D array operations such as array addition, single-precision A·X plus Y, 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++) while retaining all CPU and OpenMP functionality without modification. The resulting performance gain of simulating the wave equation is near an order of magnitude for large domain sizes. 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.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call