TRIQS/mpi 1.3.0
C++ interface to MPI
Loading...
Searching...
No Matches

#include <mpi/communicator.hpp>

Detailed Description

C++ wrapper around MPI_Comm that is a result of the mpi::communicator::split_shared operation.

In the plain MPI C API it is not distinguishable whether an MPI_Comm is local to a shared memory island or not. Thus we introduce an extra type for that whose only purpose is to make that distinction on the type-level to prevent wrong usage of the shared memory APIs.

Definition at line 216 of file communicator.hpp.

Inheritance diagram for mpi::shared_communicator:
mpi::communicator

Public Member Functions

 shared_communicator ()
 Construct a shared communicator with MPI_COMM_NULL.
 communicator ()=default
 Construct a communicator with MPI_COMM_WORLD.
 communicator (MPI_Comm c)
 Construct a communicator with a given MPI_Comm object.
Public Member Functions inherited from mpi::communicator
 communicator ()=default
 Construct a communicator with MPI_COMM_WORLD.
 communicator (MPI_Comm c)
 Construct a communicator with a given MPI_Comm object.
void abort (int error_code) const
 If mpi::has_env is true, MPI_Abort is called with the given error code, otherwise it calls std::abort.
void barrier (long poll_msec=1) const
 Barrier synchronization.
communicator duplicate () const
 Duplicate the communicator.
void free ()
 Free the communicator.
MPI_Comm get () const noexcept
 Get the wrapped MPI_Comm object.
bool is_null () const noexcept
 Check if the contained MPI_Comm is MPI_COMM_NULL.
int rank () const
 Get the rank of the calling process in the communicator.
int size () const
 Get the size of the communicator.
communicator split (int color, int key=0) const
 Split the communicator into disjoint subgroups.
shared_communicator split_shared (int split_type=MPI_COMM_TYPE_SHARED, int key=0) const
 Partition the communicator into subcommunicators according to their type.

Member Function Documentation

◆ communicator()

mpi::communicator::communicator ( MPI_Comm c)
inline

Construct a communicator with a given MPI_Comm object.

The MPI_Comm object is copied without calling MPI_Comm_dup.

Parameters
cMPI_Comm object to wrap.

Definition at line 58 of file communicator.hpp.


The documentation for this class was generated from the following file: