Using Code Generation to Enhance Performance and Portability of Supernova Simulations
ORAL
Abstract
The prevalent trend in the rapidly evolving high-performance computing (HPC) landscape is heterogeneity in platform architecture. The diversity in hardware platforms, comprising various accelerators such as GPUs, TPUs, and FPGAs, poses a significant challenge for scientific software developers aiming to harness optimal performance across different computing platforms while maintaining the quality of solutions. The emergence of heterogeneous architectures has introduced software development and maintenance complexities, requiring tailored optimizations for each hardware platform, which makes code maintenance very challenging.
Code generation provides a mechanism to mitigate this challenge. For Flash-X, a multiphysics software system for the simulation of various astrophysical phenomena, we have developed a methodology where suitable variants of solvers or time-steppers can be expressed in the form of a high-level pseudo-code-like recipe. CG-kit, a new code generation toolkit, parses the recipe that generates compilable code for the corresponding solver/time-stepper. We have applied this approach to Spark, the hydrodynamics solver in Flash-X, where optimal control flow varies for different platforms, even though the basic algorithm and computations remain identical. We maintain three different recipes instead of complete code for these variants, which are succinct. CG-Kit is used to generate the most suitable code for the target platform by selecting the appropriate recipe. An added advantage is that the generated code has a simpler control flow because the need for alternative branches is obviated. In this presentation, we describe our approach and its application to Spark.
Code generation provides a mechanism to mitigate this challenge. For Flash-X, a multiphysics software system for the simulation of various astrophysical phenomena, we have developed a methodology where suitable variants of solvers or time-steppers can be expressed in the form of a high-level pseudo-code-like recipe. CG-kit, a new code generation toolkit, parses the recipe that generates compilable code for the corresponding solver/time-stepper. We have applied this approach to Spark, the hydrodynamics solver in Flash-X, where optimal control flow varies for different platforms, even though the basic algorithm and computations remain identical. We maintain three different recipes instead of complete code for these variants, which are succinct. CG-Kit is used to generate the most suitable code for the target platform by selecting the appropriate recipe. An added advantage is that the generated code has a simpler control flow because the need for alternative branches is obviated. In this presentation, we describe our approach and its application to Spark.
–
Publication: J. Rudi, Y. Lee, A. H. Chadha, M. Wahib, K. Weide, J. O'Neal, A. Dubey, CG-Kit: Code Generation Toolkit for Performant and Maintainable Variants of Source Code Applied to Flash-X Hydrodynamics Simulations [Manuscript submitted for publication], 2024
Presenters
-
Youngjun Lee
Argonne National Laboratory
Authors
-
Youngjun Lee
Argonne National Laboratory
-
Johann Rudi
Virginia Tech
-
Aidan H Chadha
Virginia Tech
-
Mohamed Wahib
Riken
-
Klaus Weide
University of Chicago
-
Jared O'Neal
Argonne National Laboratory
-
Anshu Dubey
Argonne National Laboratory