...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This section provides tables that map from the functions and constants of the standard C MPI to their Boost.MPI equivalents. It will be most useful for users that are already familiar with the C or Fortran interfaces to MPI, or for porting existing parallel programs to Boost.MPI.
Note that this is not a perfect one to one mapping, the Boost.MPI will sometime
use function from the C API in a way that is transparent for the end user.
For example, MPI_Probe and friends
can be used to implement
asynchronous send/recv.
Table 24.1. Point-to-point communication
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
|
|
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
Boost.MPI automatically maps C and C++ data types to their MPI equivalents. The following table illustrates the mappings between C++ types and MPI datatype constants.
Table 24.2. Datatypes
C Constant |
Boost.MPI Equivalent |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unused |
|
used internally for serialized data types |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boost.MPI does not provide direct wrappers to the MPI derived datatypes functionality.
Instead, Boost.MPI relies on the Boost.Serialization
library to construct MPI datatypes for user-defined classes. The section on
user-defined data types
describes this mechanism, which is used for types that marked as "MPI
datatypes" using is_mpi_datatype
.
The derived datatypes table that follows describes which C++ types correspond to the functionality of the C MPI's datatype constructor. Boost.MPI may not actually use the C MPI function listed when building datatypes of a certain form. Since the actual datatypes built by Boost.MPI are typically hidden from the user, many of these operations are called internally by Boost.MPI.
Table 24.3. Derived datatypes
C Function/Constant |
Boost.MPI Equivalent |
---|---|
used automatically in Boost.MPI for MPI version 1.x |
|
used automatically in Boost.MPI for MPI version 2.0 and higher |
|
used automatically in Boost.MPI |
|
arrays |
|
used automatically in Boost.MPI |
|
used automatically in Boost.MPI |
|
any type used as a subobject |
|
unused |
|
any type used as a subobject |
|
unsupported |
|
used automatically in Boost.MPI |
|
user-defined classes and structs with MPI 1.x |
|
user-defined classes and structs with MPI 2.0 and higher |
|
unsupported |
|
used automatically in Boost.MPI |
MPI's packing facilities store values into a contiguous buffer, which can later
be transmitted via MPI and unpacked into separate values via MPI's unpacking
facilities. As with datatypes, Boost.MPI provides an abstract interface to
MPI's packing and unpacking facilities. In particular, the two archive classes
packed_oarchive
and packed_iarchive
can be used to pack or unpack a contiguous buffer using MPI's facilities.
Boost.MPI supports a one-to-one mapping for most of the MPI collectives. For each collective provided by Boost.MPI, the underlying C MPI collective will be invoked when it is possible (and efficient) to do so.
Table 24.5. Collectives
C Function |
Boost.MPI Equivalent |
---|---|
most uses supported by |
|
most uses supported by |
|
most uses supported by |
|
unsupported |
|
most uses supported by |
|
supported implicitly by |
Boost.MPI uses function objects to specify how reductions should occur in its
equivalents to MPI_Allreduce
,
MPI_Reduce
, and MPI_Scan
. The following table illustrates
how predefined
and user-defined
reduction operations can be mapped between the C MPI and Boost.MPI.
Table 24.6. Reduction operations
C Constant |
Boost.MPI Equivalent |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsupported |
|
|
|
unsupported |
|
used internally by Boost.MPI |
|
used internally by Boost.MPI |
|
|
|
|
MPI defines several special communicators, including MPI_COMM_WORLD
(including all processes that the local process can communicate with), MPI_COMM_SELF
(including only the local process),
and MPI_COMM_EMPTY
(including
no processes). These special communicators are all instances of the communicator
class in Boost.MPI.
Table 24.7. Predefined communicators
C Constant |
Boost.MPI Equivalent |
---|---|
|
a default-constructed |
|
a |
|
a |
Boost.MPI supports groups of processes through its group
class.
Table 24.8. Group operations and constants
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
a default-constructed |
memberref boost::mpi::group::rank |
|
memberref boost::mpi::group::translate_ranks |
|
operators |
|
|
operators |
|
operators |
|
operators |
operator |
|
operator |
|
operator |
|
unsupported |
|
unsupported |
|
used automatically in Boost.MPI |
Boost.MPI provides manipulation of communicators through the communicator
class.
Table 24.9. Communicator operations
C Function |
Boost.MPI Equivalent |
---|---|
operators |
|
|
|
|
|
used automatically in Boost.MPI |
Boost.MPI currently provides support for inter-communicators via the intercommunicator
class.
Table 24.10. Inter-communicator operations
C Function |
Boost.MPI Equivalent |
---|---|
|
|
|
|
Boost.MPI currently provides no support for attribute caching.
Table 24.11. Attributes and caching
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
unsupported |
|
unsupported |
|
unsupported |
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
|
unsupported |
Boost.MPI will provide complete support for creating communicators with different topologies and later querying those topologies. Support for graph topologies is provided via an interface to the Boost Graph Library (BGL), where a communicator can be created which matches the structure of any BGL graph, and the graph topology of a communicator can be viewed as a BGL graph for use in existing, generic graph algorithms.
Table 24.12. Process topologies
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
unnecessary; use |
|
unnecessary; use |
|
|
|
|
|
|
unsupported |
|
unsupported |
Boost.MPI supports environmental inquires through the environment
class.
Table 24.13. Environmental inquiries
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
unnecessary; use |
|
unnecessary; use |
|
unnecessary; use |
Boost.MPI translates MPI errors into exceptions, reported via the exception
class.
Table 24.14. Error handling
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
unused; errors are translated into Boost.MPI exceptions |
|
unused; errors are translated into Boost.MPI exceptions |
unused; errors are translated into Boost.MPI exceptions |
|
unused; errors are translated into Boost.MPI exceptions |
|
unused; errors are translated into Boost.MPI exceptions |
|
unused; errors are translated into Boost.MPI exceptions |
|
used internally by Boost.MPI |
|
The MPI timing facilities are exposed via the Boost.MPI timer
class, which provides an
interface compatible with the Boost
Timer library.
Table 24.15. Timing facilities
C Function/Constant |
Boost.MPI Equivalent |
---|---|
|
unnecessary; use |
use |
|
MPI startup and shutdown are managed by the construction and destruction of
the Boost.MPI environment
class.
Table 24.16. Startup/shutdown facilities
C Function |
Boost.MPI Equivalent |
---|---|
|
|
|
|
Boost.MPI does not provide any support for the profiling facilities in MPI 1.1.