Medial Code Documentation
Loading...
Searching...
No Matches
rabit.h
Go to the documentation of this file.
1
11#ifndef RABIT_RABIT_H_ // NOLINT(*)
12#define RABIT_RABIT_H_ // NOLINT(*)
13#include <string>
14#include <vector>
15#include <functional>
16// engine definition of rabit, defines internal implementation
17// to use rabit interface, there is no need to read engine.h
18// rabit.h and serializable.h are enough to use the interface
19#include "./internal/engine.h"
20
22namespace rabit {
33
37namespace op {
42struct Max;
47struct Min;
52struct Sum;
57struct BitAND;
62struct BitOR;
67struct BitXOR;
68} // namespace op
75inline bool Init(int argc, char *argv[]);
80inline bool Finalize();
83inline int GetRank();
86inline int GetWorldSize();
89inline bool IsDistributed();
90
93inline std::string GetProcessorName();
100inline void TrackerPrint(const std::string &msg);
101
102#ifndef RABIT_STRICT_CXX98_
110inline void TrackerPrintf(const char *fmt, ...);
111#endif // RABIT_STRICT_CXX98_
120inline void Broadcast(void *sendrecv_data, size_t size, int root);
121
130template<typename DType>
131inline void Broadcast(std::vector<DType> *sendrecv_data, int root);
141inline void Broadcast(std::string *sendrecv_data, int root);
163template<typename OP, typename DType>
164inline void Allreduce(DType *sendrecvbuf, size_t count,
165 void (*prepare_fun)(void *) = nullptr,
166 void *prepare_arg = nullptr);
167
181template<typename DType>
182inline void Allgather(DType *sendrecvbuf_,
183 size_t total_size,
184 size_t slice_begin,
185 size_t slice_end,
186 size_t size_prev_slice);
187
188// C++11 support for lambda prepare function
189#if DMLC_USE_CXX11
214template<typename OP, typename DType>
215inline void Allreduce(DType *sendrecvbuf, size_t count,
216 std::function<void()> prepare_fun);
217#endif // C++11
218
222inline int LoadCheckPoint();
226inline void CheckPoint();
227
233inline int VersionNumber();
234} // namespace rabit
235// implementation of template functions
236#include "./internal/rabit-inl.h"
237#endif // RABIT_RABIT_H_ // NOLINT(*)
@ Max
"max" - take max on conflict
interface for serializable objects
Definition io.h:132
interface of stream I/O for serialization
Definition io.h:30
This file defines the core interface of rabit library.
namespace of rabit
Definition engine.h:18
void CheckPoint()
deprecated, planned for removal after checkpoing from JVM package is removed.
Definition rabit-inl.h:228
std::string GetProcessorName()
gets processor's name
Definition rabit-inl.h:144
bool Finalize()
finalizes the rabit engine, call this function after you finished with all the jobs
Definition rabit-inl.h:124
int LoadCheckPoint()
deprecated, planned for removal after checkpoing from JVM package is removed.
Definition rabit-inl.h:226
void TrackerPrint(const std::string &msg)
prints the msg to the tracker, this function can be used to communicate progress information to the u...
Definition rabit-inl.h:208
void Allgather(DType *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...
void Broadcast(void *sendrecv_data, size_t size, int root)
broadcasts a memory region to every node from the root
Definition rabit-inl.h:148
void TrackerPrintf(const char *fmt,...)
prints the msg to the tracker, this function may not be available in very strict c++98 compilers,...
Definition rabit-inl.h:212
bool IsDistributed()
whether rabit env is in distributed mode
Definition rabit-inl.h:140
int VersionNumber()
Definition rabit-inl.h:230
bool Init(int argc, char *argv[])
initializes rabit, call this once at the beginning of your program
Definition rabit-inl.h:120
int GetRank()
gets rank of the current process
Definition rabit-inl.h:132
int GetWorldSize()
gets total number of processes
Definition rabit-inl.h:136
implementation of inline template function for rabit interface