DOE OSTI · 3374485
A tool and a methodology to use macros for abstracting variations in code for different computational demands
Abstract
Scientific software used on high-performance computing platforms is in a phase of transformation because of the combined increase in the heterogeneity and complexity of models and hardware platforms. Having separate implementations for different platforms can easily lead to combinatorial explosions; therefore, the computational science community has been looking for mechanisms to express code through abstractions that can be specialized for different platforms. Most existing approaches use template meta-programming in C++, and are, therefore language specific. Here, we have developed a tool that uses customized expansion of macros to mimic some of C++ behavior in other languages. It enables unification of any code variants that may be necessary to run efficiently on different target architectures and different computational environments through use of macros with multiple alternative definitions and ability to arbitrate on definition selection for expansion. Combined with two other tools, a custom runtime, and a user specified recipe translator, our custom macroprocessor becomes a part of an overall performance portability solution that does not depend on any specific programming language. We also use macros as code-shorthand that lets code snippets become building blocks that allow variations in control flow to explore performance options. We demonstrate use of macros in Flash-X, a multiphysics multicomponent code with many Fortran legacy components derived from an earlier community code FLASH.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Dubey, Anshu, Lee, Youngjun, Klosterman, T., Vatai, Emil. 2023-07-18. A tool and a methodology to use macros for abstracting variations in code for different computational demands. https://doi.org/10.1016/j.future.2023.07.014
Cite the original work for its findings. Save a collection to share your selection of sources.