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

Public Member Functions

void Init (MPI_Comm comm) override
 Initialize message manager. More...
 
void Start () override
 This function will be called before Init step of applications.
 
void StartARound () override
 This function will be called before each evaluation step of applications.
 
void FinishARound () override
 This function will be called after each evaluation step of applications.
 
bool ToTerminate () override
 This function will be called by worker after a step to determine whether evaluation is terminated. More...
 
void Finalize () override
 This function will be called after the evaluation of applications.
 
void ForceContinue () override
 Force continue to evaluate one more round even if all workers stop sending message. More...
 
void ForceTerminate (const std::string &terminate_info="") override
 Force all workers terminate after this round of evaluation. More...
 
const TerminateInfoGetTerminateInfo () const override
 This function is called to get gathered termination info after evaluation finished. More...
 
size_t GetMsgSize () const override
 Get size of messages sent by this message manager instance. The return value is valid only after FinishARound is called. StartARound will reset the value to zero. More...
 
template<typename FRAG_T , typename MESSAGE_T >
void AllocateGatherBuffers (const FRAG_T &frag)
 
template<typename GRAPH_T , typename MESSAGE_T , typename AGGR_T >
void GatherMasterVertices (const GRAPH_T &frag, const typename GRAPH_T::template both_vertex_array_t< MESSAGE_T > &input, typename GRAPH_T::template vertex_array_t< MESSAGE_T > &output)
 
template<typename GRAPH_T , typename MESSAGE_T >
void ScatterMasterVertices (const GRAPH_T &frag, const typename GRAPH_T::template vertex_array_t< MESSAGE_T > &input, typename GRAPH_T::template both_vertex_array_t< MESSAGE_T > &output)
 

Private Member Functions

bool takeFromPool (std::vector< char > &buffer, size_t size)
 
void returnToPool (std::vector< char > &&buffer)
 

Private Attributes

fid_t fid_
 
fid_t fnum_
 
CommSpec comm_spec_
 
MPI_Comm comm_
 
int round_
 
size_t sent_size_
 
bool force_terminate_
 
TerminateInfo terminate_info_
 
bool vote_terminate_
 
std::map< size_t, std::queue< std::vector< char > > > gather_pools_
 

Member Function Documentation

◆ ForceContinue()

void grape::GatherScatterMessageManager::ForceContinue ( )
inlineoverridevirtual

Force continue to evaluate one more round even if all workers stop sending message.

This function can be called by applications.

Implements grape::MessageManagerBase.

◆ ForceTerminate()

void grape::GatherScatterMessageManager::ForceTerminate ( const std::string &  info = "")
inlineoverridevirtual

Force all workers terminate after this round of evaluation.

This function can be called by applications.

Parameters
infoTermination info.

Implements grape::MessageManagerBase.

◆ GetMsgSize()

size_t grape::GatherScatterMessageManager::GetMsgSize ( ) const
inlineoverridevirtual

Get size of messages sent by this message manager instance. The return value is valid only after FinishARound is called. StartARound will reset the value to zero.

Returns
Size of messages sent by this message manager instance.

Implements grape::MessageManagerBase.

◆ GetTerminateInfo()

const TerminateInfo& grape::GatherScatterMessageManager::GetTerminateInfo ( ) const
inlineoverridevirtual

This function is called to get gathered termination info after evaluation finished.

Returns
Termination info.

Implements grape::MessageManagerBase.

◆ Init()

void grape::GatherScatterMessageManager::Init ( MPI_Comm  comm)
inlineoverridevirtual

Initialize message manager.

Parameters
commMPI_Comm object.

Implements grape::MessageManagerBase.

◆ ToTerminate()

bool grape::GatherScatterMessageManager::ToTerminate ( )
inlineoverridevirtual

This function will be called by worker after a step to determine whether evaluation is terminated.

Returns
Whether evaluation is terminated.

Implements grape::MessageManagerBase.