CG-Kit: Code Generation Toolkit for Performant and Maintainable Variants of Source Code Applied to Flash-X Hydrodynamics Simulations

Johann Rudi, Youngjun Lee, Aidan H. Chadha, Mohamed Wahib, Klaus Weide, Jared P. O'Neal, Anshu Dubey
{"title":"CG-Kit: Code Generation Toolkit for Performant and Maintainable Variants of Source Code Applied to Flash-X Hydrodynamics Simulations","authors":"Johann Rudi, Youngjun Lee, Aidan H. Chadha, Mohamed Wahib, Klaus Weide, Jared P. O'Neal, Anshu Dubey","doi":"arxiv-2401.03378","DOIUrl":null,"url":null,"abstract":"CG-Kit is a new code generation toolkit that we propose as a solution for\nportability and maintainability for scientific computing applications. The\ndevelopment of CG-Kit is rooted in the urgent need created by the shifting\nlandscape of high-performance computing platforms and the algorithmic\ncomplexities of a particular large-scale multiphysics application: Flash-X.\nThis combination leads to unique challenges including handling an existing\nlarge code base in Fortran and/or C/C++, subdivision of code into a great\nvariety of units supporting a wide range of physics and numerical methods,\ndifferent parallelization techniques for distributed- and shared-memory systems\nand accelerator devices, and heterogeneity of computing platforms requiring\ncoexisting variants of parallel algorithms. The challenges demand that\ndevelopers determine custom abstractions and granularity for code generation.\nCG-Kit tackles this with standalone tools that can be combined into highly\nspecific and, we argue, highly effective portability and maintainability tool\nchains. Here we present the design of our new tools: parametrized source trees,\ncontrol flow graphs, and recipes. The tools are implemented in Python. Although\nthe tools are agnostic to the programming language of the source code, we focus\non C/C++ and Fortran. Code generation experiments demonstrate the generation of\nvariants of parallel algorithms: first, multithreaded variants of the basic\nAXPY operation (scalar-vector addition and vector-vector multiplication) to\nintroduce the application of CG-Kit tool chains; and second, variants of\nparallel algorithms within a hydrodynamics solver, called Spark, from Flash-X\nthat operates on block-structured adaptive meshes. In summary, code generated\nby CG-Kit achieves a reduction by over 60% of the original C/C++/Fortran source\ncode.","PeriodicalId":501061,"journal":{"name":"arXiv - CS - Numerical Analysis","volume":"37 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-01-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Numerical Analysis","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2401.03378","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

CG-Kit is a new code generation toolkit that we propose as a solution for portability and maintainability for scientific 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. 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. The challenges demand that developers determine custom abstractions and granularity for code generation. CG-Kit tackles this with standalone tools that can be combined into highly specific and, we argue, highly effective portability and maintainability tool chains. Here we present the design of our new tools: parametrized source trees, control flow graphs, and recipes. The tools are implemented in Python. Although the tools are agnostic to the programming language of the source code, we focus on C/C++ and Fortran. Code generation experiments demonstrate the generation of variants of parallel algorithms: first, multithreaded variants of the basic AXPY operation (scalar-vector addition and vector-vector multiplication) to introduce the application of CG-Kit tool chains; and second, variants of parallel algorithms within a hydrodynamics solver, called Spark, from Flash-X that operates on block-structured adaptive meshes. In summary, code generated by CG-Kit achieves a reduction by over 60% of the original C/C++/Fortran source code.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
CG-Kit:适用于 Flash-X 流体动力学模拟的代码生成工具包,用于源代码的性能和可维护变量
CG-Kit 是一种新的代码生成工具包,是我们为科学计算应用的可移植性和可维护性提出的解决方案。CG-Kit 的开发源于高性能计算平台不断变化的环境和特定大规模多物理场应用算法复杂性所带来的迫切需求:这种组合带来了独特的挑战,包括处理现有的大量 Fortran 和/或 C/C++ 代码库、将代码细分为支持各种物理和数值方法的大量单元、针对分布式和共享内存系统及加速器设备的不同并行化技术,以及需要并行算法现有变体的计算平台的异质性。这些挑战要求开发人员为代码生成确定自定义抽象和粒度。CG-Kit 通过独立工具解决了这一问题,这些工具可以组合成高度特定的、我们认为是高度有效的可移植性和可维护性工具链。在此,我们将介绍新工具的设计:参数化源代码树、控制流图和配方。这些工具是用 Python 实现的。虽然这些工具与源代码的编程语言无关,但我们将重点放在 C/C++ 和 Fortran 上。代码生成实验展示了并行算法变体的生成:首先是基本AXPY操作(标量-向量加法和向量-向量乘法)的多线程变体,以介绍 CG-Kit 工具链的应用;其次是 Flash-X 流体力学求解器(称为 Spark)中并行算法的变体,该求解器在块结构自适应网格上运行。总之,由 CG-Kit 生成的代码比原始 C/C++/Fortran 源代码减少了 60% 以上。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Analysis of the SQP Method for Hyperbolic PDE-Constrained Optimization in Acoustic Full Waveform Inversion Detection of a piecewise linear crack with one incident wave Randomized quasi-Monte Carlo and Owen's boundary growth condition: A spectral analysis Energy stable gradient flow schemes for shape and topology optimization in Navier-Stokes flows Exponential time propagators for elastodynamics
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1