Engineering Papers⌕ Search

SEARCH · Engineering Papers

Results for “Template Metaprogramming”

Search indexed NASA NTRS and DOE OSTI research on propulsion, heat transfer, battery materials and energy systems. Follow report and document links to the original sources.

Quote a phrase for an exact phrase match. Source license links do not imply unrestricted reuse.

KokkACC: Enhancing Kokkos with OpenACC

Template metaprogramming is gaining popularity as a high-level solution for achieving performance portability on heterogeneous computing resources. Kokkos is a representative approach that offers programmers high-level abstractions for generic programming while most of the device-specific code generation and optimizations are delegated to the compiler through template specializations. For this, Kokkos provides a set of device-specific code specializations in multiple back ends, such as CUDA and HIP. Unlike CUDA or HIP, OpenACC is a high-level and directive-based programming model. This descriptive model allows developers to insert hints (pragmas) into their code that help the compiler to parallelize the code. The compiler is responsible for the transformation of the code, which is completely transparent to the programmer. This paper presents an OpenACC back end for Kokkos: KokkACC. As an alternative to Kokkos’s existing device-specific back ends, KokkACC is a multi-architecture back end providing a high-productivity programming environment enabled by OpenACC’s high-level and descriptive programming model. Moreover, we have observed competitive performance; in some cases, KokkACC is faster (up to 9×) than NVIDIA’s CUDA back end and much faster than OpenMP’s GPU offloading back end. This work also includes implementation details and a detailed performance study conducted with a set of mini-benchmarks (AXPY and DOT product) and three mini-apps (LULESH, miniFE and SNAP, a LAMMPS proxy mini-app).

Valero Lara, Pedro↗

Performance on HPC Platforms Is Possible Without C++

Computing at large scales has become extremely challenging due to increasing heterogeneity in both hardware and software. More and more scientific workflows must tackle a range of scales and use machine learning and AI intertwined with more traditional numerical modeling methods, placing more demands on computational platforms. These constraints indicate a need to fundamentally rethink the way computational science is done and the tools that are needed to enable these complex workflows. The current set of C++-based solutions may not suffice, and relying exclusively upon C++ may not be the best option, especially because several newer languages and boutique solutions offer more robust design features to tackle the challenges of heterogeneity. In June 2023, we held a mini symposium that explored the use of newer languages and heterogeneity solutions that are not tied to C++ and that offer options beyond template metaprogramming and Parallel. For for performance and portability. In conclusion, we describe some of the presentations and discussion from the mini symposium in this article.

97 MATHEMATICS AND COMPUTING↗

Metamesh, Version 1.0

Metamesh is a general-purpose C++ language library for creating data structures that represent meshes. An important difference between Metamesh and other "mesh" libraries is that Metamesh does not provide a specific mesh format, in the usual sense, or tools or a GUI by which users build specific meshes. Rather, it provides a mechanism by which mesh formats themselves can be built, based on their constituent parts and the relationships between them.Consider that a mesh in up to three space dimensions can, in principle, contain nodes (0d entities, or points), edges (1d entities), faces (2d entities), and cells (3d, or volumetric, entities). A node might be defined in terms of (x), (x,y), or (x,y,z) in Cartesian coordinates; or perhaps something else, in a different coordinate system. An edge is typically defined from two nodes; say, "edge E goes from node A=(ax,ay) to node B=(bx,by)." Faces can reasonably be defined in terms of nodes or edges, and cells in terms of nodes, edges, or faces. Note also that someone might wish to support general faces or cells, or only specific variants - say, triangular faces and tetrahedral cells, or quadrilateral faces and hexahedral cells. Or, perhaps, both triangular and quadrilateral faces (but no others), with prisms for each cell. Consider also that a mesh can have the same or a lesser dimension than that of its enclosing space. In 3d, for example, one could have a full 3d mesh, a 2d "sheet" mesh with no cells, a 1d "parametrized curve" with neither faces nor cells, or even a 1d "point cloud." And, in addition to defining a mesh scheme, a user might wish to place additional data onto one or more mesh entities. Imagine, for example, a velocity at each node, a flux across each edge or face, and a mass or average density per cell. Metamesh supports all of this, through the use of C++ class and function templates, and template metaprogramming techniques. Programmers begin with constructs that Metamesh provides (or, users can define their own), and assemble them in particular ways in order to create particular mesh formats. Metamesh then provides functionality automatically to meshes that are constructed in this manner. Finally, Metamesh provides very general functions for spinning, extruding, visualizing, and performing input/output of whatever meshes a user builds with it.

Staley, Martin↗

DARMA v. Beta 0.5

DARMA is a portability layer for asynchronous many-task (AMT) runtime systems. AMT runtime systems show promise to mitigate challenges imposed by next generation high performance computing architectures. However, current runtime system technologies are not production-ready. DARMA is a portability layer that seeks to insulate application developers from idiosyncrasies of individual runtime systems, thereby facilitating application-developer use of these technologies. DARMA comprises a frontend application programming interface (API) for application developers, a backend API for runtime system developers, and a translation that translates frontend API calls into backend API calls. Application developers use C++ abstractions to annotate both data and tasks in their code. The DARMA translation layer uses C++ template metaprogramming to capture data-task dependencies, and provides this information to a potential backend runtime system via a series of backend API calls.

Hollman, David↗

Domain-Specific Type-Safe APIs for Hierarchical Scientific Data with Modern C++

General-purpose library application programming interfaces (APIs) for self-describing hierarchical scientific data storage, such as the HDF5 and NetCDF libraries, are traditionally of runtime nature. Runtime errors for entry existence and data types are typically caught later in the development process of higher-level application-specific APIs. In this paper, we propose exploiting modern C++ metaprogramming features to add compile-time type-safety to improve the interaction with a well-defined metadata-rich scientific schema in domain-specific hierarchical datasets. We tackle two aspects of common use: (i) direct data access, (ii) flexible “in-memory” index models for efficient search and data processing. The proposed APIs use C++17’s template type auto deduction features, C++11’s enum class for type-safety and C-style preprocessor macros for generative templated code. We showcase the pros and cons of our initial work on the standard NeXus schema used for annotating and storing experimental neutron scattering data at several facilities around the world on top of HDF5. Extendable compile-time type-safe APIs are a desirable feature that could be indexed by any modern integrated development environment (IDE). Hence, such APIs can help ease the learning curve for domain scientists using a less error-prone software interaction to enhance the findability of their data without resorting to a domain-specific language (DSL).

Godoy, William↗