Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions
rabit::engine::IEngine Class Referenceabstract

interface of core Allreduce engine More...

#include <engine.h>

Inheritance diagram for rabit::engine::IEngine:
rabit::engine::AllreduceBase rabit::engine::MPIEngine rabit::engine::AllreduceMock

Public Types

typedef void() PreprocFunction(void *arg)
 Preprocessing function, that is called before AllReduce, used to prepare the data used by AllReduce.
 
typedef void() ReduceFunction(const void *src, void *dst, int count, const MPI::Datatype &dtype)
 reduce function, the same form of MPI reduce function is used, to be compatible with MPI interface In all the functions, the memory is ensured to aligned to 64-bit which means it is OK to cast src,dst to double* int* etc
 

Public Member Functions

 ~IEngine ()=default
 virtual destructor
 
virtual void Allgather (void *sendrecvbuf, size_t total_size, size_t slice_begin, size_t slice_end, size_t size_prev_slice)=0
 Allgather function, each node have a segment of data in the ring of sendrecvbuf, the data provided by current node k is [slice_begin, slice_end), the next node's segment must start with slice_end after the call of Allgather, sendrecvbuf_ contains all the contents including all segments use a ring based algorithm.
 
virtual void Allreduce (void *sendrecvbuf_, size_t type_nbytes, size_t count, ReduceFunction reducer, PreprocFunction prepare_fun=nullptr, void *prepare_arg=nullptr)=0
 performs in-place Allreduce, on sendrecvbuf this function is NOT thread-safe
 
virtual void Broadcast (void *sendrecvbuf_, size_t size, int root)=0
 broadcasts data from root to every other node
 
virtual int LoadCheckPoint ()=0
 
virtual void CheckPoint ()=0
 Increase internal version number. Deprecated.
 
virtual int VersionNumber () const =0
 
virtual int GetRingPrevRank () const =0
 gets rank of previous node in ring topology
 
virtual int GetRank () const =0
 gets rank of current node
 
virtual int GetWorldSize () const =0
 gets total number of nodes
 
virtual bool IsDistributed () const =0
 whether we run in distribted mode
 
virtual std::string GetHost () const =0
 gets the host name of the current node
 
virtual void TrackerPrint (const std::string &msg)=0
 prints the msg in the tracker, this function can be used to communicate progress information to the user who monitors the tracker
 

Detailed Description

interface of core Allreduce engine

Member Typedef Documentation

◆ PreprocFunction

typedef void() rabit::engine::IEngine::PreprocFunction(void *arg)

Preprocessing function, that is called before AllReduce, used to prepare the data used by AllReduce.

Parameters
argadditional possible argument used to invoke the preprocessor

◆ ReduceFunction

typedef void() rabit::engine::IEngine::ReduceFunction(const void *src, void *dst, int count, const MPI::Datatype &dtype)

reduce function, the same form of MPI reduce function is used, to be compatible with MPI interface In all the functions, the memory is ensured to aligned to 64-bit which means it is OK to cast src,dst to double* int* etc

Parameters
srcpointer to source space
dstpointer to destination reduction
counttotal number of elements to be reduced (note this is total number of elements instead of bytes) the definition of the reduce function should be type aware
dtypethe data type object, to be compatible with MPI reduce

Member Function Documentation

◆ Allgather()

virtual void rabit::engine::IEngine::Allgather ( void *  sendrecvbuf,
size_t  total_size,
size_t  slice_begin,
size_t  slice_end,
size_t  size_prev_slice 
)
pure virtual

Allgather function, each node have a segment of data in the ring of sendrecvbuf, the data provided by current node k is [slice_begin, slice_end), the next node's segment must start with slice_end after the call of Allgather, sendrecvbuf_ contains all the contents including all segments use a ring based algorithm.

Parameters
sendrecvbuf_buffer for both sending and receiving data, it is a ring conceptually
total_sizetotal size of data to be gathered
slice_beginbeginning of the current slice
slice_endend of the current slice
size_prev_slicesize of the previous slice i.e. slice of node (rank - 1) % world_size

Implemented in rabit::engine::AllreduceMock, rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ Allreduce()

virtual void rabit::engine::IEngine::Allreduce ( void *  sendrecvbuf_,
size_t  type_nbytes,
size_t  count,
ReduceFunction  reducer,
PreprocFunction  prepare_fun = nullptr,
void *  prepare_arg = nullptr 
)
pure virtual

performs in-place Allreduce, on sendrecvbuf this function is NOT thread-safe

Parameters
sendrecvbuf_buffer for both sending and receiving data
type_nbytesthe number of bytes the type has
countnumber of elements to be reduced
reducerreduce function
prepare_funcLazy preprocessing function, if it is not NULL, prepare_fun(prepare_arg) will be called by the function before performing Allreduce in order to initialize the data in sendrecvbuf. If the result of Allreduce can be recovered directly, then prepare_func will NOT be called
prepare_argargument used to pass into the lazy preprocessing function

Implemented in rabit::engine::AllreduceMock, rabit::engine::MPIEngine, and rabit::engine::AllreduceBase.

◆ Broadcast()

virtual void rabit::engine::IEngine::Broadcast ( void *  sendrecvbuf_,
size_t  size,
int  root 
)
pure virtual

broadcasts data from root to every other node

Parameters
sendrecvbuf_buffer for both sending and receiving data
sizethe size of the data to be broadcasted
rootthe root worker id to broadcast the data

Implemented in rabit::engine::MPIEngine, rabit::engine::AllreduceBase, and rabit::engine::AllreduceMock.

◆ CheckPoint()

virtual void rabit::engine::IEngine::CheckPoint ( )
pure virtual

Increase internal version number. Deprecated.

Implemented in rabit::engine::AllreduceBase, and rabit::engine::AllreduceMock.

◆ GetHost()

virtual std::string rabit::engine::IEngine::GetHost ( ) const
pure virtual

gets the host name of the current node

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ GetRank()

virtual int rabit::engine::IEngine::GetRank ( ) const
pure virtual

gets rank of current node

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ GetRingPrevRank()

virtual int rabit::engine::IEngine::GetRingPrevRank ( ) const
pure virtual

gets rank of previous node in ring topology

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ GetWorldSize()

virtual int rabit::engine::IEngine::GetWorldSize ( ) const
pure virtual

gets total number of nodes

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ IsDistributed()

virtual bool rabit::engine::IEngine::IsDistributed ( ) const
pure virtual

whether we run in distribted mode

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.

◆ LoadCheckPoint()

virtual int rabit::engine::IEngine::LoadCheckPoint ( )
pure virtual

◆ TrackerPrint()

virtual void rabit::engine::IEngine::TrackerPrint ( const std::string &  msg)
pure virtual

prints the msg in the tracker, this function can be used to communicate progress information to the user who monitors the tracker

Parameters
msgmessage to be printed in the tracker

Implemented in rabit::engine::MPIEngine, and rabit::engine::AllreduceBase.

◆ VersionNumber()

virtual int rabit::engine::IEngine::VersionNumber ( ) const
pure virtual
Returns
version number of the current stored model, which means how many calls to CheckPoint we made so far
See also
LoadCheckPoint, CheckPoint

Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.


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