KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::CommunicationGraphLocalView Class Reference

Local view of a a distributed communication graph from the perspective of the current rank. Each vertex is a rank and the edges define possible communication links between the vertices. This view provides access to the (potentially weighted) in- and outgoing edges which are represented as a sequence of neighboring ranks. Note that MPI allows this to be a multi-graph. process' rank. More...

#include <distributed_graph_communicator.hpp>

Public Types

using SpanType = kamping::Span<int const>
 type to be used for views on ranks and weights
 

Public Member Functions

template<typename ContiguousRange >
 CommunicationGraphLocalView (ContiguousRange const &in_ranks, ContiguousRange const &out_ranks)
 Constructs a view of an unweighted communication graph.
 
template<typename ContiguousRange >
 CommunicationGraphLocalView (ContiguousRange const &in_ranks, ContiguousRange const &out_ranks, ContiguousRange const &in_weights, ContiguousRange const &out_weights)
 Constructs a view of an unweighted communication graph.
 
size_t in_degree () const
 Returns in degree of the rank, i.e. the number of in-going edges/communication links towards the rank.
 
int in_degree_signed () const
 Returns in degree of the rank, i.e. the number of in-going edges/communication links towards the rank.
 
size_t out_degree () const
 Returns out degree of the rank, i.e. the number of out-going edges/communication links starting at the rank.
 
int out_degree_signed () const
 Returns out degree of the rank, i.e. the number of out-going edges/communication links starting at the rank.
 
bool is_weighted () const
 Returns whether the communication graph is weighted or not.
 
SpanType in_ranks () const
 Returns view on the in-going edges.
 
SpanType out_ranks () const
 Returns view on the out-going edges.
 
std::optional< SpanTypein_weights () const
 Returns view on the in-going edge weights if present.
 
std::optional< SpanTypeout_weights () const
 Returns view on the out-going edge weights if present.
 
MPI_Comm create_mpi_graph_communicator (MPI_Comm comm) const
 Creates a distributed graph communicator based on the view of the given communication graph using MPI_Dist_graph_create_adjacent.
 

Detailed Description

Local view of a a distributed communication graph from the perspective of the current rank. Each vertex is a rank and the edges define possible communication links between the vertices. This view provides access to the (potentially weighted) in- and outgoing edges which are represented as a sequence of neighboring ranks. Note that MPI allows this to be a multi-graph. process' rank.

Constructor & Destructor Documentation

◆ CommunicationGraphLocalView() [1/2]

kamping::CommunicationGraphLocalView::CommunicationGraphLocalView ( ContiguousRange const & in_ranks,
ContiguousRange const & out_ranks )
inline

Constructs a view of an unweighted communication graph.

Template Parameters
ContiguousRangeType of the input range for in and out ranks.
Parameters
in_ranksNeighboring in ranks, i.e., ranks i for which there is an edge (i,own_rank).
out_ranksNeighboring out ranks, i.e., ranks i for which there is an edge (own_rank, i).

◆ CommunicationGraphLocalView() [2/2]

kamping::CommunicationGraphLocalView::CommunicationGraphLocalView ( ContiguousRange const & in_ranks,
ContiguousRange const & out_ranks,
ContiguousRange const & in_weights,
ContiguousRange const & out_weights )
inline

Constructs a view of an unweighted communication graph.

Template Parameters
ContiguousRangeType of the input range for in and out ranks.
Parameters
in_ranksNeighboring in ranks, i.e., ranks i for which there is an edge (i,own_rank).
out_ranksNeighboring out ranks, i.e., ranks i for which there is an edge (own_rank, i).
in_weightsWeights associcated to neighboring in ranks.
out_weightsWeights associcated to neighboring out ranks.

Member Function Documentation

◆ create_mpi_graph_communicator()

MPI_Comm kamping::CommunicationGraphLocalView::create_mpi_graph_communicator ( MPI_Comm comm) const
inline

Creates a distributed graph communicator based on the view of the given communication graph using MPI_Dist_graph_create_adjacent.

Parameters
commMPI comm on which the graph topology will be applied.
Returns
MPi comm with associated graph topology.

◆ in_degree()

size_t kamping::CommunicationGraphLocalView::in_degree ( ) const
inline

Returns in degree of the rank, i.e. the number of in-going edges/communication links towards the rank.

Returns
In degree of the rank.

◆ in_degree_signed()

int kamping::CommunicationGraphLocalView::in_degree_signed ( ) const
inline

Returns in degree of the rank, i.e. the number of in-going edges/communication links towards the rank.

Returns
Signed in degree of the rank.

◆ out_degree()

size_t kamping::CommunicationGraphLocalView::out_degree ( ) const
inline

Returns out degree of the rank, i.e. the number of out-going edges/communication links starting at the rank.

Returns
Out degree of the rank.

◆ out_degree_signed()

int kamping::CommunicationGraphLocalView::out_degree_signed ( ) const
inline

Returns out degree of the rank, i.e. the number of out-going edges/communication links starting at the rank.

Returns
Signed out degree of the rank.

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