libgrape-lite
A C++ library for parallel graph processing
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
grape::DefaultMessageManager Class Reference

Default message manager. More...

#include <default_message_manager.h>

Inheritance diagram for grape::DefaultMessageManager:
grape::MessageManagerBase grape::AutoParallelMessageManager< FRAG_T >

Public Member Functions

void Init (MPI_Comm comm) override
 Inherit.
 
void Start () override
 Inherit.
 
void StartARound () override
 Inherit.
 
void FinishARound () override
 Inherit.
 
bool ToTerminate () override
 Inherit.
 
void Finalize () override
 Inherit.
 
size_t GetMsgSize () const override
 Inherit.
 
void ForceContinue () override
 Inherit.
 
void ForceTerminate (const std::string &terminate_info) override
 Inherit.
 
const TerminateInfoGetTerminateInfo () const override
 Inherit.
 
template<typename MESSAGE_T >
void SendToFragment (fid_t dst_fid, const MESSAGE_T &msg)
 Send message to a fragment. More...
 
template<typename GRAPH_T , typename MESSAGE_T >
void SyncStateOnOuterVertex (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg)
 Communication by synchronizing the status on outer vertices, for edge-cut fragments. More...
 
template<typename GRAPH_T , typename MESSAGE_T >
void SendMsgThroughIEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg)
 Communication via a crossing edge a<-c. It sends message from a to c. More...
 
template<typename GRAPH_T , typename MESSAGE_T >
void SendMsgThroughOEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg)
 Communication via a crossing edge a->b. It sends message from a to b. More...
 
template<typename GRAPH_T , typename MESSAGE_T >
void SendMsgThroughEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg)
 Communication via crossing edges a->b and a<-c. It sends message from a to b and c. More...
 
template<typename MESSAGE_T >
bool GetMessage (MESSAGE_T &msg)
 Get a message from message buffer. More...
 
template<typename GRAPH_T , typename MESSAGE_T >
bool GetMessage (const GRAPH_T &frag, typename GRAPH_T::vertex_t &v, MESSAGE_T &msg)
 Get a message and its target vertex from message buffer. More...
 

Protected Member Functions

fid_t fid () const
 
fid_t fnum () const
 

Protected Attributes

std::vector< InArchiveto_send_
 

Private Member Functions

bool syncLengths ()
 

Private Attributes

std::vector< OutArchiveto_recv_
 
fid_t cur_
 
std::vector< size_t > lengths_out_
 
std::vector< size_t > lengths_in_
 
std::vector< MPI_Request > reqs_
 
MPI_Comm comm_
 
fid_t fid_
 
fid_t fnum_
 
CommSpec comm_spec_
 
size_t sent_size_
 
bool to_terminate_
 
bool force_continue_
 
bool force_terminate_
 
TerminateInfo terminate_info_
 

Detailed Description

Default message manager.

The send and recv methods are not thread-safe.

Member Function Documentation

◆ GetMessage() [1/2]

template<typename GRAPH_T , typename MESSAGE_T >
bool grape::DefaultMessageManager::GetMessage ( const GRAPH_T &  frag,
typename GRAPH_T::vertex_t &  v,
MESSAGE_T &  msg 
)
inline

Get a message and its target vertex from message buffer.

Template Parameters
GRAPH_T
MESSAGE_T
Parameters
frag
v
msg
Returns
Return true if got a message, and false if no message left.

◆ GetMessage() [2/2]

template<typename MESSAGE_T >
bool grape::DefaultMessageManager::GetMessage ( MESSAGE_T &  msg)
inline

Get a message from message buffer.

Template Parameters
MESSAGE_T
Parameters
msg
Returns
Return true if got a message, and false if no message left.

◆ SendMsgThroughEdges()

template<typename GRAPH_T , typename MESSAGE_T >
void grape::DefaultMessageManager::SendMsgThroughEdges ( const GRAPH_T &  frag,
const typename GRAPH_T::vertex_t &  v,
const MESSAGE_T &  msg 
)
inline

Communication via crossing edges a->b and a<-c. It sends message from a to b and c.

Template Parameters
GRAPH_T
MESSAGE_T
Parameters
frag
va
msg

◆ SendMsgThroughIEdges()

template<typename GRAPH_T , typename MESSAGE_T >
void grape::DefaultMessageManager::SendMsgThroughIEdges ( const GRAPH_T &  frag,
const typename GRAPH_T::vertex_t &  v,
const MESSAGE_T &  msg 
)
inline

Communication via a crossing edge a<-c. It sends message from a to c.

Template Parameters
GRAPH_T
MESSAGE_T
Parameters
frag
va
msg

◆ SendMsgThroughOEdges()

template<typename GRAPH_T , typename MESSAGE_T >
void grape::DefaultMessageManager::SendMsgThroughOEdges ( const GRAPH_T &  frag,
const typename GRAPH_T::vertex_t &  v,
const MESSAGE_T &  msg 
)
inline

Communication via a crossing edge a->b. It sends message from a to b.

Template Parameters
GRAPH_T
MESSAGE_T
Parameters
frag
va
msg

◆ SendToFragment()

template<typename MESSAGE_T >
void grape::DefaultMessageManager::SendToFragment ( fid_t  dst_fid,
const MESSAGE_T &  msg 
)
inline

Send message to a fragment.

Template Parameters
MESSAGE_TMessage type.
Parameters
dst_fidDestination fragment id.
msg

◆ SyncStateOnOuterVertex()

template<typename GRAPH_T , typename MESSAGE_T >
void grape::DefaultMessageManager::SyncStateOnOuterVertex ( const GRAPH_T &  frag,
const typename GRAPH_T::vertex_t &  v,
const MESSAGE_T &  msg 
)
inline

Communication by synchronizing the status on outer vertices, for edge-cut fragments.

Assume a fragment F_1, a crossing edge a->b' in F_1 and a is an inner vertex in F_1. This function invoked on F_1 send status on b' to b on F_2, where b is an inner vertex.

Template Parameters
GRAPH_T
MESSAGE_T
Parameters
frag
va
msg