Skip to main content
U.S. Department of Energy
Office of Scientific and Technical Information

CG-Kit: Code Generation Toolkit for performant and maintainable variants of source code applied to Flash-X hydrodynamics simulations

Journal Article · · Future Generations Computer Systems
 [1];  [2];  [3];  [4];  [5];  [2];  [6]
  1. Virginia Polytechnic Inst. and State Univ. (Virginia Tech), Blacksburg, VA (United States); Argonne National Laboratory (ANL), Argonne, IL (United States)
  2. Argonne National Laboratory (ANL), Argonne, IL (United States)
  3. Virginia Polytechnic Inst. and State Univ. (Virginia Tech), Blacksburg, VA (United States)
  4. RIKEN Center for Computational Science, Kobe (Japan)
  5. Univ. of Chicago, IL (United States)
  6. Argonne National Laboratory (ANL), Argonne, IL (United States); Univ. of Chicago, IL (United States)

CG-Kit is a new Code Generation tool-Kit that we have developed as a part of the solution for portability and maintainability for multiphysics computing applications. The development of CG-Kit is rooted in the urgent need created by the shifting landscape of high-performance computing platforms and the algorithmic complexities of a particular large-scale multiphysics application: Flash-X. To efficiently use computing resources on a heterogeneous node, an application must have a map of computation to resources and a mechanism to move the data and computation to the resources according to the map. Most existing performance portability solutions are focussed on abstracting the expression of computations so that a unified source code can be specialized to run on different resources. However, such an approach is insufficient for a code like Flash-X, which has a multitude of code components that can be assembled in various permutations and combinations to form different instances of applications. Similar challenges apply to any code that has composability, where a single specified way of apportioning work among devices may not be optimal. Additionally, use cases arise where the optimal control flow of computation may differ for different devices while the underlying numerics remain identical. This combination leads to unique challenges including handling an existing large code base in Fortran and/or C/C++, subdivision of code into a great variety of units supporting a wide range of physics and numerical methods, different parallelization techniques for distributed and shared memory systems and accelerator devices, and heterogeneity of computing platforms requiring coexisting variants of parallel algorithms. All of these challenges demand that scientific software developers apply existing knowledge about domain applications, algorithms, and computing platforms to determine custom abstractions and granularity for code generation. There is a critical lack of tools to tackle those problems. CG-Kit is designed to fill this gap by providing a user with the ability to express their desired control flow and computation-to-resource map in the form a pseudocode-like recipe. It consists of standalone tools that can be combined into highly specific and, we argue, highly effective portability and maintainability toolchains. Here we present the design of our new tools: parametrized source trees, control flow graphs, and recipes. The tools are implemented in Python. They are agnostic to the programming language of the source code targeted for code generation. In conclusion, we demonstrate the capabilities of the toolkit with two examples, first, multithreaded variants of the basic AXPY operation, and second, variants of parallel algorithms within a hydrodynamics solver, called Spark, from Flash-X that operates on block-structured adaptive meshes.

Research Organization:
Argonne National Laboratory (ANL), Argonne, IL (United States)
Sponsoring Organization:
USDOE Office of Science (SC), Advanced Scientific Computing Research (ASCR). Scientific Discovery through Advanced Computing (SciDAC); USDOE National Nuclear Security Administration (NNSA); USDOE Office of Science (SC), Nuclear Physics (NP)
Grant/Contract Number:
AC02-06CH11357; SC0023472
OSTI ID:
2999865
Alternate ID(s):
OSTI ID: 2446737
Journal Information:
Future Generations Computer Systems, Journal Name: Future Generations Computer Systems Vol. 163; ISSN 0167-739X
Publisher:
ElsevierCopyright Statement
Country of Publication:
United States
Language:
English

References (27)

Application of the ParalleX execution model to stencil-based problems journal May 2012
A Proposal to Extend the OpenMP Tasking Model with Dependent Tasks journal April 2009
TXL: A rapid prototyping system for programming language dialects journal January 1991
PARAMESH: A parallel adaptive mesh refinement community toolkit journal April 2000
A tool and a methodology to use macros for abstracting variations in code for different computational demands journal July 2023
Kokkos: Enabling manycore performance portability through polymorphic memory access patterns journal December 2014
Nebo: An efficient, parallel, and portable domain-specific language for numerically solving partial differential equations journal March 2017
Extensible component-based architecture for FLASH, a massively parallel, multiphysics simulation code journal October 2009
Towards performance portability in the Spark astrophysical magnetohydrodynamics solver in the Flash-X simulation framework journal December 2021
Flash-X: A multiphysics simulation software instrument journal July 2022
Advanced Newton Methods for Geodynamical Models of Stokes Flow With Viscoplastic Rheologies journal September 2020
Array programming with NumPy journal September 2020
Total variation diminishing Runge-Kutta schemes journal January 1998
OpenMP: an industry standard API for shared-memory programming journal January 1998
Cython: The Best of Both Worlds journal March 2011
PaRSEC: Exploiting Heterogeneity to Enhance Scalability journal November 2013
Weighted BFBT Preconditioner for Stokes Flow Problems with Highly Heterogeneous Viscosity journal January 2017
Halide: a language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines journal June 2013
A Survey of CPU-GPU Heterogeneous Computing Techniques journal July 2015
Co-array Fortran for parallel programming journal August 1998
The CLAW DSL: Abstractions for Performance Portable Weather and Climate Models conference January 2018
Stateful dataflow multigraphs: a data-centric model for performance portability on heterogeneous architectures
  • Ben-Nun, Tal; de Fine Licht, Johannes; Ziogas, Alexandros N.
  • SC '19: The International Conference for High Performance Computing, Networking, Storage, and Analysis, Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis https://doi.org/10.1145/3295500.3356173
conference November 2019
HPC Forecast: Cloudy and Uncertain journal January 2023
Dms conference May 2002
Parallel Programmability and the Chapel Language journal August 2007
AMReX: a framework for block-structured adaptive mesh refinement journal May 2019
Exploring Network Structure, Dynamics, and Function using NetworkX conference June 2008