Task-Based Programming for Adaptive Mesh Refinement in Compressible Flow Simulations DOI: XXXXXXX.XXXXXXX Conference: Make sure to enter the correct conference title from your rights confirmation email; June 03–05, 2018; Woodstock, NY ISBN: 978-1-4503-XXXX-X/2018/06

Anjiang Wei, Hang Song, Mert Hidayetoglu, Elliott Slaughter, Sanjiva K. Lele, Alex Aiken · 2025

Read Task-Based Programming for Adaptive Mesh Refinement in Compressible Flow Simulations DOI: XXXXXXX.XXXXXXX Conference: Make sure to enter the correct conference title from your rights confirmation email; June 03–05, 2018; Woodstock, NY ISBN: 978-1-4503-XXXX-X/2018/06 by Anjiang Wei, Hang Song, Mert Hidayetoglu, Elliott Slaughter, Sanjiva K. Lele, Alex Aiken (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-05020.txt.

Introduction

Anjiang Wei and five co-authors speed flow sims that zoom mesh detail where it counts by using task based code. Fine flow solvers cost much, and zoom cuts waste by adding detail only in hot zones. They build the solver in a high level tongue for task systems.

Hard parts include patch growth and shrink, mesh truth checks, and launch cost. Merging tasks gave a huge speed gain, and auto made chip code gave a near ten fold gain on one key kernel. Two classic flow cases show the method in action. Big sims can thus run leaner.

Catalog record

CREATORAnjiang Wei, Hang Song, Mert Hidayetoglu, Elliott Slaughter, Sanjiva K. Lele, Alex Aiken
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE36 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2508-05020

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Task-Based Programming for Adaptive Mesh Refinement in Compressible Flow Simulations DOI: XXXXXXX.XXXXXXX Conference: Make sure to enter the correct conference title from your rights confirmation email; June 03–05, 2018; Woodstock, NY ISBN: 978-1-4503-XXXX-X/2018/06 Anjiang Wei, Hang Song, Mert Hidayetoglu, Elliott Slaughter, Sanjiva K. Lele, Alex Aiken Abstract . High-order solvers for compressible flows are vital in scientific applications. Adaptive mesh refinement (AMR) is a key technique for reducing computational cost by concentrating resolution in regions of interest. In this work, we develop an AMR-based numerical solver using Regent, a high-level programming language for the Legion programming model. We address several challenges associated with implementing AMR in Regent. These include dynamic data structures for patch refinement/coarsening, mesh validity enforcement, and reducing task launch overhead via task fusion. Experimental results show that task fusion achieves 18× speedup, while automated GPU kernel generation via simple annotations yields 9.7× speedup for the targeted kernel. We demonstrate our approach through simulations of two canonical compressible flow problems governed by the Euler equations. 1. Introduction In simulations of fluid flows, adaptive mesh refinement (AMR) offers significant computational savings by concentrating mesh resolution on fine-scale features that must be accurately resolved or captured, while coarsening the mesh in regions of no interest ( Berger and Oliger 1984 ; Berger and Colella 1989 ) . In computational fluid dynamics (CFD), this capability makes AMR particularly effective for simulating compressible flows, multiphase flows, and related phenomena, where structures such as shock waves and interfaces are present and interact with the flow motion ( Garnier et al. 2009 ; Fuster et al. 2009 ) . Large-scale simulations with AMR require a robust and efficient infrastructure. Several open-source AMR frameworks, such as Chombo ( Colella et al. 2009 ) , AMReX ( Zhang et al. 2019 ) , SAMRAI ( Gunney and Anderson 2016 ) , and Enzo ( Bryan et al. 2014 ) , have been developed using the traditional MPI+X programming model and are widely used in scientific computing. This work demonstrates the use of a task-based parallel programming model to develop an AMR-based numerical solver for compressible flow simulations. Task-based programming systems ( Slaughter et al. 2015 ; Bauer et al. 2012 ; Augonnet et al. 2009 ; Chamberlain et al. 2007 ) have recently emerged as a performant and productive paradigm for programming modern supercomputers. These systems model computations as user-defined tasks and lift data into abstract representations that enable automated analysis and optimization. In contrast to the MPI+X programming model, task-based systems allow users to express applications at a higher level of abstraction. Regent ( Slaughter et al. 2015 ) , the framework adopted in this work, is a high-level programming language for the Legion programming model ( Bauer et al. 2012 ) , further streamlining application development and performance tuning. Several challenges arise in this setting. First, the dynamic nature of adaptive mesh refinement complicates the design of data structures for AMR-based numerical solvers. Since patches, which are portions of the mesh assigned to individual processors, can be dynamically allocated (refined) and deallocated (coarsened) at runtime rather than defined statically, the data structures must flexibly represent the parent and child relationships among patches. Second, this dynamic behavior necessitates well-defined rules for refinement and coarsening to ensure the validity of the mesh structure and the correctness of the computations. Finally, task-based systems pose unique performance challenges, particularly the runtime overhead incurred by frequent task launches ( Slaughter et al. 2020 ) . Our work addresses the aforementioned challenges. We design data structures within the Legion programming model that support the dynamic behavior of adaptive mesh refinement. We also establish and formalize the rules required to ensure correctness and present algorithms that enforce these constraints during runtime. Finally, we observe that in task-based systems, overly fine-grained tasks can incur substantial runtime overhead, a challenge that has been systematically analyzed and quantified in prior work ( Slaughter et al. 2020 ) . Regent provides a mechanism to mitigate this overhead through automatic task fusion ( Sundram et al. 2022 ; Yadav et al. 2025 ) , enabled by simple compiler directives, eliminating the need for manual code modifications. Our results (shown in Section 4 ) demonstrate that compiler-directed task fusion achieves up to 18× speedup, effectively amortizing the runtime overhead associated with task-based systems. Moreover, Regent, as a high-level programming language, enables GPU offloading through simple compiler annotations, significantly reducing the effort required to develop high-performance kernels. This automated GPU code generation yields up to 9.7× speedup compared to CPU execution for the targeted kernel. We present the physical and mathematical formulations of the application in Section 2 . The numerical solver targets the compressible Euler equations under the assumption of a calorically perfect gas, and implements a Riemann solver algorithm ( Shu and Osher 1988 ) . Demonstrative simulations of two canonical compressible flow problems involving inviscid calorically perfect gas are shown in Section 5 . In summary, this paper makes the following contributions: • Design. We design and implement a numerical solver within a task-based programming model that supports dynamic refinement and coarsening. • Performance. We demonstrate that Regent, a high-level programming language, enables effective performance tuning through simple annotations, achieving up to 18× speedup via task fusion and up to 9.7× speedup through automated GPU kernel generation. • Application. We present the physical and mathematical formulations of the compressible Euler equations and showcase demonstrative simulations of two canonical compressible flow problems. 2. Physical and Mathematical Formulations The solver numerically solves the compressible Euler equations assuming calorically perfect gas. The physical and mathematical models are described in Section 2.1 , and the elementary numerical schemes used in the solver and detailed solution process in each time advancement is illustrated in Section 2.2 . 2.1. Governing Equations The compressible Euler equations contain the conservation of mass, momentum, and total energy. (1) \displaystyle\frac{\partial\rho}{\partial t}+\frac{\partial\rho u_{j}}{\partial x_{j}} \displaystyle=0 (2) \displaystyle\frac{\partial\rho u_{i}}{\partial t}+\frac{\partial}{\partial x_{j}}\left(\rho u_{i}u_{j}+p\delta_{ij}\right) \displaystyle=0 (3) \displaystyle\frac{\partial\rho e}{\partial t}+\frac{\partial}{\partial x_{j}}\left(\rho hu_{j}\right) \displaystyle=0 The equations are expressed using the Einstein index notation following the summation convention, where t and x_{j} represent the time and space coordinate vector, respectively; \rho is density; u_{i} is the velocity vector; p is pressure; \delta_{ij} is the identity tensor; e is the specific total energy; and h is the specific total enthalpy. The specific total energy includes two components representing the specific internal energy, e_{\mathrm{th}} , and kinetic energy, u_{j}u_{j}/2 , respectively. (4) e=e_{\mathrm{th}}+u_{j}u_{j}/2 The specific total enthalpy, h , is calculated as (5) h=e+p/\rho The equation system is closed by the equation-of-state (EOS) model of a calorically perfect gas parameterized by a specific gas constant, R , and the ratio of specific heats, \gamma . R is not explicitly involved in the equation system since the temperature is not included in the formulation. According to the EOS model, the internal energy, density, and pressure yields the following relation. (6) p=\rho e_{\mathrm{th}}(\gamma-1) The speed of sound, c , which is used in the numerical solver to determine the time advancement step size and the approximate Riemann solver, is calculated consistent with the calorically perfect gas EOS model. (7) c=\sqrt{\gamma p/\rho} 2.2. Basic Numerical Schemes and Solution Process The numerical solution approach yields high-order finite difference

Read the complete text