Medial Code Documentation
|
interface of core Allreduce engine More...
#include <engine.h>
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 | |
interface of core Allreduce engine
typedef void() rabit::engine::IEngine::PreprocFunction(void *arg) |
Preprocessing function, that is called before AllReduce, used to prepare the data used by AllReduce.
arg | additional possible argument used to invoke the preprocessor |
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
src | pointer to source space |
dst | pointer to destination reduction |
count | total 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 |
dtype | the data type object, to be compatible with MPI reduce |
|
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.
sendrecvbuf_ | buffer for both sending and receiving data, it is a ring conceptually |
total_size | total size of data to be gathered |
slice_begin | beginning of the current slice |
slice_end | end of the current slice |
size_prev_slice | size 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.
|
pure virtual |
performs in-place Allreduce, on sendrecvbuf this function is NOT thread-safe
sendrecvbuf_ | buffer for both sending and receiving data |
type_nbytes | the number of bytes the type has |
count | number of elements to be reduced |
reducer | reduce function |
prepare_func | Lazy 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_arg | argument used to pass into the lazy preprocessing function |
Implemented in rabit::engine::AllreduceMock, rabit::engine::MPIEngine, and rabit::engine::AllreduceBase.
|
pure virtual |
broadcasts data from root to every other node
sendrecvbuf_ | buffer for both sending and receiving data |
size | the size of the data to be broadcasted |
root | the root worker id to broadcast the data |
Implemented in rabit::engine::MPIEngine, rabit::engine::AllreduceBase, and rabit::engine::AllreduceMock.
|
pure virtual |
Increase internal version number. Deprecated.
Implemented in rabit::engine::AllreduceBase, and rabit::engine::AllreduceMock.
|
pure virtual |
gets the host name of the current node
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.
|
pure virtual |
gets rank of current node
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.
|
pure virtual |
gets rank of previous node in ring topology
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.
|
pure virtual |
gets total number of nodes
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.
|
pure virtual |
whether we run in distribted mode
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.
|
pure virtual |
deprecated
Implemented in rabit::engine::AllreduceBase, and rabit::engine::AllreduceMock.
|
pure virtual |
prints the msg in the tracker, this function can be used to communicate progress information to the user who monitors the tracker
msg | message to be printed in the tracker |
Implemented in rabit::engine::MPIEngine, and rabit::engine::AllreduceBase.
|
pure virtual |
Implemented in rabit::engine::AllreduceBase, and rabit::engine::MPIEngine.