Table of Contents
Fetching ...

Concepts for designing modern C++ interfaces for MPI

C. Nicole Avans, Alfredo A. Correa, Sayan Ghosh, Matthias Schimek, Joseph Schuchart, Anthony Skjellum, Evan D. Suggs, Tim Niklas Uhl

TL;DR

The paper addresses designing modern C++ interfaces for MPI by proposing semantic guidelines that align MPI's object model, type system, and memory buffers with idiomatic C++ features. It surveys existing C++ bindings, argues for a Session Model-based object lifecycle, and introduces data-buffer concepts, committed datatype handling, and ownership transfer for non-blocking calls. Error handling via compile-time invariants and optional std::expected, plus support for serialization and type pools, are proposed to improve safety and usability. While not delivering a full standard, the work provides a blueprint to influence MPI language bindings and standardization, with practical implications for performance-portability and portability.

Abstract

Since the C++ bindings were deleted in 2008, the Message Passing Interface (MPI) community has revived efforts in building high-level modern C++ interfaces. Such interfaces are either built to serve specific scientific application needs (with limited coverage to the underlying MPI functionalities), or as an exercise in general-purpose programming model building, with the hope that bespoke interfaces can be broadly adopted to construct a variety of distributed-memory scientific applications. However, with the advent of modern C++-based heterogeneous programming models, GPUs and widespread Machine Learning (ML) usage in contemporary scientific computing, the role of prospective community-standardized high-level C++ interfaces to MPI is evolving. The success of such an interface clearly will depend on providing robust abstractions and features adhering to the generic programming principles that underpin the C++ programming language, without compromising on either performance and portability, the core principles upon which MPI was founded. However, there is a tension between idiomatic C++ handling of types and lifetimes and MPI's loose interpretation of object lifetimes/ownership and insistence on maintaining global states. Instead of proposing "yet another" high-level C++ interface to MPI, overlooking or providing partial solutions to work around the key issues concerning the dissonance between MPI semantics and idiomatic C++, this paper focuses on the three fundamental aspects of a high-level interface: type system, object lifetimes and communication buffers, also identifying inconsistencies in the MPI specification. Presumptive solutions can be unrefined, and we hope the broader MPI and C++ communities will engage with us in productive exchange of ideas and concerns.

Concepts for designing modern C++ interfaces for MPI

TL;DR

The paper addresses designing modern C++ interfaces for MPI by proposing semantic guidelines that align MPI's object model, type system, and memory buffers with idiomatic C++ features. It surveys existing C++ bindings, argues for a Session Model-based object lifecycle, and introduces data-buffer concepts, committed datatype handling, and ownership transfer for non-blocking calls. Error handling via compile-time invariants and optional std::expected, plus support for serialization and type pools, are proposed to improve safety and usability. While not delivering a full standard, the work provides a blueprint to influence MPI language bindings and standardization, with practical implications for performance-portability and portability.

Abstract

Since the C++ bindings were deleted in 2008, the Message Passing Interface (MPI) community has revived efforts in building high-level modern C++ interfaces. Such interfaces are either built to serve specific scientific application needs (with limited coverage to the underlying MPI functionalities), or as an exercise in general-purpose programming model building, with the hope that bespoke interfaces can be broadly adopted to construct a variety of distributed-memory scientific applications. However, with the advent of modern C++-based heterogeneous programming models, GPUs and widespread Machine Learning (ML) usage in contemporary scientific computing, the role of prospective community-standardized high-level C++ interfaces to MPI is evolving. The success of such an interface clearly will depend on providing robust abstractions and features adhering to the generic programming principles that underpin the C++ programming language, without compromising on either performance and portability, the core principles upon which MPI was founded. However, there is a tension between idiomatic C++ handling of types and lifetimes and MPI's loose interpretation of object lifetimes/ownership and insistence on maintaining global states. Instead of proposing "yet another" high-level C++ interface to MPI, overlooking or providing partial solutions to work around the key issues concerning the dissonance between MPI semantics and idiomatic C++, this paper focuses on the three fundamental aspects of a high-level interface: type system, object lifetimes and communication buffers, also identifying inconsistencies in the MPI specification. Presumptive solutions can be unrefined, and we hope the broader MPI and C++ communities will engage with us in productive exchange of ideas and concerns.

Paper Structure

This paper contains 16 sections, 6 figures.

Figures (6)

  • Figure 1: Example of the proposed object model using the MPI Session Model
  • Figure 2: Interpretation of const-ness in a MPI C++ interface
  • Figure 3: Example for constructing a type for a C++ type and committing it
  • Figure 4: Concept definition for a data buffer
  • Figure 5: Exemplary communication calls using the data buffer concept when MPI procedures are implemented as member functions.
  • ...and 1 more figures