21using Manager = AllreduceBase;
23typedef AllreduceMock Manager;
26typedef AllreduceBase Manager;
43bool Init(
int argc,
char *argv[]) {
45 if (e->engine.get() ==
nullptr) {
46 e->initialized =
true;
48 return e->engine->Init(argc, argv);
57 if (e->engine.get() !=
nullptr) {
58 if (e->engine->Shutdown()) {
59 e->engine.reset(
nullptr);
60 e->initialized =
false;
77 utils::Check(!e->initialized,
"the rabit has not been initialized");
78 return &default_manager;
85void Allgather(
void *sendrecvbuf_,
size_t total_size,
88 size_t size_prev_slice) {
90 slice_end, size_prev_slice);
103 GetEngine()->
Allreduce(sendrecvbuf, type_nbytes, count, red, prepare_fun, prepare_arg);
Basic implementation of AllReduce using TCP non-block socket and tree-shape reduction.
A threadlocal store to store threadlocal variables. Will return a thread local singleton of type T.
Definition thread_local.h:35
static T * Get()
Definition thread_local.h:38
implementation of basic Allreduce engine
Definition allreduce_base.h:42
interface of core Allreduce engine
Definition engine.h:22
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
void() PreprocFunction(void *arg)
Preprocessing function, that is called before AllReduce, used to prepare the data used by AllReduce.
Definition engine.h:29
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...
Definition engine.h:41
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...
This file defines the core interface of rabit library.
DataType
enum of supported data types
Definition engine.h:141
OpType
enum of all operators
Definition engine.h:132
bool Init(int argc, char *argv[])
initializes the engine module
Definition engine.cc:43
void Allreduce_(void *sendrecvbuf, size_t type_nbytes, size_t count, IEngine::ReduceFunction red, mpi::DataType dtype, mpi::OpType op, IEngine::PreprocFunction prepare_fun=nullptr, void *prepare_arg=nullptr)
perform in-place Allreduce, on sendrecvbuf this is an internal function used by rabit to be able to c...
Definition engine.cc:95
bool Finalize()
finalizes the engine module
Definition engine.cc:55
void Allgather(void *sendrecvbuf, size_t total_size, size_t slice_begin, size_t slice_end, size_t size_prev_slice)
Allgather function, each node have a segment of data in the ring of sendrecvbuf, the data provided by...
Definition engine.cc:85
IEngine * GetEngine()
singleton method to get engine
Definition engine.cc:71
void Check(bool exp, const char *fmt,...)
same as assert, but this is intended to be used as a message for users
Definition utils.h:91
namespace of rabit
Definition engine.h:18
Macros common to all headers.
entry to to easily hold returning information
Definition engine.cc:30
std::unique_ptr< Manager > engine
stores the current engine
Definition engine.cc:32
ThreadLocalEntry()=default
constructor
bool initialized
whether init has been called
Definition engine.cc:34
Portable thread local storage.