...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::mpi::graph_communicator — An MPI communicator with a graph topology.
// In header: <boost/mpi/graph_communicator.hpp> class graph_communicator : public boost::mpi::communicator { public: // construct/copy/destruct graph_communicator(const MPI_Comm &, comm_create_kind); template<typename Graph> graph_communicator(const communicator &, const Graph &, bool = false); template<typename Graph, typename RankMap> graph_communicator(const communicator &, const Graph &, RankMap, bool = false); };
A graph_communicator
is a communicator whose topology is expressed as a graph. Graph communicators have the same functionality as (intra)communicators, but also allow one to query the relationships among processes. Those relationships are expressed via a graph, using the interface defined by the Boost Graph Library. The graph_communicator
class meets the requirements of the BGL Graph, Incidence Graph, Adjacency Graph, Vertex List Graph, and Edge List Graph concepts.
graph_communicator
public
construct/copy/destructgraph_communicator(const MPI_Comm & comm, comm_create_kind kind);
Build a new Boost.MPI graph communicator based on the MPI communicator comm
with graph topology.
comm
may be any valid MPI communicator. If comm
is MPI_COMM_NULL, an empty communicator (that cannot be used for communication) is created and the kind
parameter is ignored. Otherwise, the kind
parameter determines how the Boost.MPI communicator will be related to comm:
If kind
is comm_duplicate
, duplicate comm
to create a new communicator. This new communicator will be freed when the Boost.MPI communicator (and all copies of it) is destroyed. This option is only permitted if the underlying MPI implementation supports MPI 2.0; duplication of intercommunicators is not available in MPI 1.x.
If kind
is comm_take_ownership
, take ownership of comm
. It will be freed automatically when all of the Boost.MPI communicators go out of scope.
If kind
is comm_attach
, this Boost.MPI communicator will reference the existing MPI communicator comm
but will not free comm
when the Boost.MPI communicator goes out of scope. This option should only be used when the communicator is managed by the user.
template<typename Graph> graph_communicator(const communicator & comm, const Graph & graph, bool reorder = false);
Create a new communicator whose topology is described by the given graph. The indices of the vertices in the graph will be assumed to be the ranks of the processes within the communicator. There may be fewer vertices in the graph than there are processes in the communicator; in this case, the resulting communicator will be a NULL communicator.
Parameters: 

template<typename Graph, typename RankMap> graph_communicator(const communicator & comm, const Graph & graph, RankMap rank, bool reorder = false);
Create a new communicator whose topology is described by the given graph. The rank map (rank
) gives the mapping from vertices in the graph to ranks within the communicator. There may be fewer vertices in the graph than there are processes in the communicator; in this case, the resulting communicator will be a NULL communicator.
Parameters: 
