arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.03378cs.DCcs.NAmath.NA
收藏

CG-Kit:应用于Flash-X流体动力学模拟的源代码高性能与可维护变体代码生成工具包

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

AI总结:

针对Flash-X等多物理场应用在高性能计算中的可移植性与可维护性挑战,提出基于Python的代码生成工具包CG-Kit,通过参数化源树等工具生成并行算法变体,使源代码量减少逾60%。

摘要:

CG-Kit是我们提出的一种新型代码生成工具包,作为科学计算应用程序可移植性和可维护性的解决方案。CG-Kit的开发源于高性能计算平台格局不断变化,以及特定大规模多物理场应用Flash-X的算法复杂性所带来的迫切需求。这种结合带来了独特的挑战,包括处理现有的Fortran和/或C/C++大型代码库,将代码细分为支持广泛物理和数值方法的多种单元,针对分布式和共享内存系统及加速器设备采用不同的并行化技术,以及需要并行算法共存变体的计算平台异构性。这些挑战要求开发者确定代码生成的自定义抽象和粒度。CG-Kit通过独立工具解决这一问题,这些工具可组合成高度特定且我们认为高效的移植性和可维护性工具链。在此,我们展示了新工具的设计:参数化源树、控制流图和配方。这些工具使用Python实现。尽管这些工具与源代码的编程语言无关,但我们重点关注C/C++和Fortran。代码生成实验展示了并行算法变体的生成:首先,基础AXPY操作(标量向量加法和向量向量乘法)的多线程变体,用于介绍CG-Kit工具链的应用;其次,Flash-X中名为Spark的流体动力学求解器内并行算法的变体,该求解器在块结构自适应网格上运行。总而言之,CG-Kit生成的代码使原始C/C++/Fortran源代码减少了60%以上。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑