GPU-accelerated test-field method for astrophysical magnetohydrodynamics and turbulence
Abstract
Context : The exact working mechanism of solar and stellar dynamos is still unknown. To shed light onto the problem, turbulent transport coefficients need to be determined to decide whether and which turbulent effects play a crucial role in stellar dynamo action. One common approach is to use mean-field electrodynamics and a data analysis tool based on this theory, referred to as the test-field method (TFM). Aims : The test-field method is a computationally heavy tool, and its proper application to high-resolution data over relevant parameter regimes requires the acceleration of the numerical methods with graphics processing units (GPUs). While efficient methods to accelerate magnetohydrodynamic (MHD) solvers themselves have already been developed, the TFM method poses additional challenges: increased memory footprint, added communication, and averaging over the vector fields -- all of which require special consideration when moved from CPUs to GPUs. In this work we present an efficient TFM tool accelerated with GPUs and the first physical results with it. Methods : We implemented the TFM within Astaroth, which is a framework for distributed stencil computations on graphics processors. The framework provides a domain-specific language, which we used to implement the test-field equations, and an optimizing code generator, which we extended to support TFM-specific features. For communication, we extended the communication module of Astaroth to support TFM-specific reductions, and we utilized it to implement a scalable pipeline for applying the TFM in large-scale computations. Results : Our implementation scales to 4096 devices at 93% efficiency and obtains a factor of ten speedup in per-node performance compared to the previous state of the art. We verified the physical results against a CPU solver, namely Pencil Code, in two separate test cases: Roberts flow and helically forced MHD turbulence. Additionally, we studied the magnetic Prandtl number (Pm) dependence of the turbulent transport coefficients with both low and high Pms. Conclusions : The GPU-accelerated TFM provides a leap in performance compared to previous state-of-the-art implementations for CPUs. This novel method can be utilized to extract useful information about dynamo-active flows in a more relevant parameter regime.