implementation of engine using MPI
More...
|
void | Allgather (void *sendrecvbuf_, size_t total_size, size_t slice_begin, size_t slice_end, size_t size_prev_slice) override |
| 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.
|
|
void | Allreduce (void *sendrecvbuf_, size_t type_nbytes, size_t count, ReduceFunction reducer, PreprocFunction prepare_fun, void *prepare_arg) override |
| performs in-place Allreduce, on sendrecvbuf this function is NOT thread-safe
|
|
int | GetRingPrevRank (void) const override |
| gets rank of previous node in ring topology
|
|
void | Broadcast (void *sendrecvbuf_, size_t size, int root) override |
| broadcasts data from root to every other node
|
|
virtual void | InitAfterException (void) |
|
virtual int | LoadCheckPoint (Serializable *global_model, Serializable *local_model=NULL) |
|
virtual void | CheckPoint (const Serializable *global_model, const Serializable *local_model=NULL) |
|
virtual void | LazyCheckPoint (const Serializable *global_model) |
|
virtual int | VersionNumber (void) const |
|
virtual int | GetRank (void) const |
| get rank of current node
|
|
virtual int | GetWorldSize (void) const |
| get total number of
|
|
virtual bool | IsDistributed (void) const |
| whether it is distributed
|
|
virtual std::string | GetHost (void) const |
| get the host name of current node
|
|
virtual void | TrackerPrint (const std::string &msg) |
| prints the msg in the tracker, this function can be used to communicate progress information to the user who monitors the tracker
|
|
| ~IEngine ()=default |
| virtual destructor
|
|
virtual int | LoadCheckPoint ()=0 |
|
virtual void | CheckPoint ()=0 |
| Increase internal version number. Deprecated.
|
|
|
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
|
|
implementation of engine using MPI
◆ Allgather()
void rabit::engine::MPIEngine::Allgather |
( |
void * |
sendrecvbuf, |
|
|
size_t |
total_size, |
|
|
size_t |
slice_begin, |
|
|
size_t |
slice_end, |
|
|
size_t |
size_prev_slice |
|
) |
| |
|
inlineoverridevirtual |
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_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 |
Implements rabit::engine::IEngine.
◆ Allreduce()
void rabit::engine::MPIEngine::Allreduce |
( |
void * |
sendrecvbuf_, |
|
|
size_t |
type_nbytes, |
|
|
size_t |
count, |
|
|
ReduceFunction |
reducer, |
|
|
PreprocFunction |
prepare_fun, |
|
|
void * |
prepare_arg |
|
) |
| |
|
inlineoverridevirtual |
performs in-place Allreduce, on sendrecvbuf this function is NOT thread-safe
- Parameters
-
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 |
Implements rabit::engine::IEngine.
◆ Broadcast()
void rabit::engine::MPIEngine::Broadcast |
( |
void * |
sendrecvbuf_, |
|
|
size_t |
size, |
|
|
int |
root |
|
) |
| |
|
inlineoverridevirtual |
broadcasts data from root to every other node
- Parameters
-
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 |
Implements rabit::engine::IEngine.
◆ GetHost()
virtual std::string rabit::engine::MPIEngine::GetHost |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ GetRank()
virtual int rabit::engine::MPIEngine::GetRank |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ GetRingPrevRank()
int rabit::engine::MPIEngine::GetRingPrevRank |
( |
void |
| ) |
const |
|
inlineoverridevirtual |
◆ GetWorldSize()
virtual int rabit::engine::MPIEngine::GetWorldSize |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ IsDistributed()
virtual bool rabit::engine::MPIEngine::IsDistributed |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ TrackerPrint()
virtual void rabit::engine::MPIEngine::TrackerPrint |
( |
const std::string & |
msg | ) |
|
|
inlinevirtual |
prints the msg in the tracker, this function can be used to communicate progress information to the user who monitors the tracker
- Parameters
-
msg | message to be printed in the tracker |
Implements rabit::engine::IEngine.
◆ VersionNumber()
virtual int rabit::engine::MPIEngine::VersionNumber |
( |
void |
| ) |
const |
|
inlinevirtual |
- Returns
- version number of the current stored model, which means how many calls to CheckPoint we made so far
- See also
- LoadCheckPoint, CheckPoint
Implements rabit::engine::IEngine.
The documentation for this class was generated from the following file: