libgrape-lite
A C++ library for parallel graph processing
|
A optimized version of parallel message manager. More...
#include <parallel_message_manager_opt.h>
Public Member Functions | |
void | Init (MPI_Comm comm) override |
Inherit. | |
MessageBufferPool & | GetPool () |
void | Start () override |
Inherit. | |
void | StartARound () override |
Inherit. | |
void | FinishARound () override |
Inherit. | |
bool | ToTerminate () override |
Inherit. | |
void | Finalize () override |
Inherit. | |
void | ForceContinue () override |
Inherit. | |
void | ForceTerminate (const std::string &terminate_info) override |
Inherit. | |
const TerminateInfo & | GetTerminateInfo () const override |
Inherit. | |
size_t | GetMsgSize () const override |
Inherit. | |
void | InitChannels (int channel_num=1, size_t block_size=default_msg_send_block_size, size_t block_cap=default_msg_send_block_capacity) |
Init a set of channels, each channel is a thread local message buffer. | |
std::vector< ThreadLocalMessageBufferOpt< ParallelMessageManagerOpt > > & | Channels () |
void | SendMicroBufferByFid (fid_t fid, MicroBuffer &&arc) |
Send a buffer to a fragment. | |
template<typename MESSAGE_T > | |
void | SendToFragment (fid_t dst_fid, const MESSAGE_T &msg, int channel_id=0) |
Send message to a fragment. | |
template<typename GRAPH_T , typename MESSAGE_T > | |
void | SyncStateOnOuterVertex (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg, int channel_id=0) |
SyncStateOnOuterVertex on a channel. | |
template<typename GRAPH_T > | |
void | SyncStateOnOuterVertex (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, int channel_id=0) |
template<typename GRAPH_T , typename MESSAGE_T > | |
void | SendMsgThroughIEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg, int channel_id=0) |
SendMsgThroughIEdges on a channel. | |
template<typename GRAPH_T , typename MESSAGE_T > | |
void | SendMsgThroughOEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg, int channel_id=0) |
SendMsgThroughOEdges on a channel. | |
template<typename GRAPH_T , typename MESSAGE_T > | |
void | SendMsgThroughEdges (const GRAPH_T &frag, const typename GRAPH_T::vertex_t &v, const MESSAGE_T &msg, int channel_id=0) |
SendMsgThroughEdges on a channel. | |
bool | GetMessageInBuffer (MessageInBuffer &buf) |
Get a bunch of messages, stored in a MessageInBuffer. | |
template<typename GRAPH_T , typename MESSAGE_T , typename FUNC_T > | |
void | ParallelProcess (int thread_num, const GRAPH_T &frag, const FUNC_T &func) |
Parallel process all incoming messages with given function of last round. | |
template<typename GRAPH_T , typename MESSAGE_T , typename FUNC_T > | |
size_t | ParallelProcessCount (int thread_num, const GRAPH_T &frag, const FUNC_T &func) |
template<typename MESSAGE_T , typename FUNC_T > | |
void | ParallelProcess (int thread_num, const FUNC_T &func) |
Parallel process all incoming messages with given function of last round. | |
Private Attributes | |
fid_t | fid_ |
fid_t | fnum_ |
CommSpec | comm_spec_ |
MPI_Comm | comm_ |
std::vector< MicroBuffer > | to_self_ |
std::vector< ThreadLocalMessageBufferOpt< ParallelMessageManagerOpt > > | channels_ |
int | round_ |
BlockingQueue< std::pair< fid_t, MicroBuffer > > | sending_queue_ |
std::thread | send_thread_ |
std::array< BlockingQueue< MicroBuffer >, 2 > | recv_queues_ |
std::array< MessageBuffer, 2 > | recv_bufs_ |
std::array< size_t, 2 > | recv_bufs_loc_ |
std::array< std::vector< MessageBuffer >, 2 > | recv_bufs_stash_ |
std::thread | recv_thread_ |
bool | force_continue_ |
size_t | sent_size_ |
size_t | total_sent_size_ |
bool | force_terminate_ |
TerminateInfo | terminate_info_ |
MessageBufferPool | pool_ |
Static Private Attributes | |
static constexpr size_t | default_msg_send_block_size = 2 * 1023 * 1024 |
static constexpr size_t | default_msg_send_block_capacity = 2 * 1024 * 1024 |
A optimized version of parallel message manager.
ParallelMessageManagerOpt support multi-threads to send messages concurrently with channels. Each channel contains a thread local message buffer.
For each thread local message buffer, when accumulated a given amount of messages, the buffer will be sent through MPI.
After a round of evaluation, there is a global barrier to determine whether the fixed point is reached.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inline |
Get a bunch of messages, stored in a MessageInBuffer.
buf | Message buffer which holds a grape::OutArchive. |
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inline |
Init a set of channels, each channel is a thread local message buffer.
channel_num | Number of channels. |
block_size | Size of each channel. |
block_cap | Capacity of each channel. |
|
inline |
Parallel process all incoming messages with given function of last round.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
FUNC_T | Function type. |
thread_num | Number of threads. |
frag | |
func |
|
inline |
Parallel process all incoming messages with given function of last round.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
FUNC_T | Function type. |
thread_num | Number of threads. |
frag | |
func |
|
inline |
Send a buffer to a fragment.
fid | Destination fragment id. |
arc | Message buffer. |
|
inline |
SendMsgThroughEdges on a channel.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
frag | Source fragment. |
v | Source vertex. |
msg | |
channel_id |
|
inline |
SendMsgThroughIEdges on a channel.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
frag | Source fragment. |
v | Source vertex. |
msg | |
channel_id |
|
inline |
SendMsgThroughOEdges on a channel.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
frag | Source fragment. |
v | Source vertex. |
msg | |
channel_id |
|
inline |
Send message to a fragment.
MESSAGE_T | Message type. |
dst_fid | Destination fragment id. |
msg | |
channelId |
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.
|
inline |
SyncStateOnOuterVertex on a channel.
GRAPH_T | Graph type. |
MESSAGE_T | Message type. |
frag | Source fragment. |
v | Source vertex. |
msg | |
channel_id |
|
inlineoverridevirtual |
Inherit.
Implements grape::MessageManagerBase.