This commit is contained in:
tqchen 2015-07-26 14:57:24 -07:00
parent fe8bb3b60e
commit 29d43ab52f

View File

@ -123,10 +123,13 @@ inline void Broadcast(std::string *sendrecv_data, int root);
* this function is NOT thread-safe * this function is NOT thread-safe
* *
* Example Usage: the following code does an Allreduce and outputs the sum as the result * Example Usage: the following code does an Allreduce and outputs the sum as the result
* \code{.cpp}
* vector<int> data(10); * vector<int> data(10);
* ... * ...
* Allreduce<op::Sum>(&data[0], data.size()); * Allreduce<op::Sum>(&data[0], data.size());
* ... * ...
* \endcode
*
* \param sendrecvbuf buffer for both sending and receiving data * \param sendrecvbuf buffer for both sending and receiving data
* \param count number of elements to be reduced * \param count number of elements to be reduced
* \param prepare_fun Lazy preprocessing function, if it is not NULL, prepare_fun(prepare_arg) * \param prepare_fun Lazy preprocessing function, if it is not NULL, prepare_fun(prepare_arg)
@ -146,7 +149,9 @@ inline void Allreduce(DType *sendrecvbuf, size_t count,
* \brief performs in-place Allreduce, on sendrecvbuf * \brief performs in-place Allreduce, on sendrecvbuf
* with a prepare function specified by a lambda function * with a prepare function specified by a lambda function
* *
* Example Usage: the following code does an Allreduce and outputs the sum as the result * Example Usage:
* \code{.cpp}
* // the following code does an Allreduce and outputs the sum as the result
* vector<int> data(10); * vector<int> data(10);
* ... * ...
* Allreduce<op::Sum>(&data[0], data.size(), [&]() { * Allreduce<op::Sum>(&data[0], data.size(), [&]() {
@ -155,6 +160,7 @@ inline void Allreduce(DType *sendrecvbuf, size_t count,
* } * }
* }); * });
* ... * ...
* \endcode
* \param sendrecvbuf buffer for both sending and receiving data * \param sendrecvbuf buffer for both sending and receiving data
* \param count number of elements to be reduced * \param count number of elements to be reduced
* \param prepare_fun Lazy lambda preprocessing function, prepare_fun() will be invoked * \param prepare_fun Lazy lambda preprocessing function, prepare_fun() will be invoked
@ -179,14 +185,15 @@ inline void Allreduce(DType *sendrecvbuf, size_t count,
* if returned version == 0, this means no model has been CheckPointed * if returned version == 0, this means no model has been CheckPointed
* the p_model is not touched, users should do the necessary initialization by themselves * the p_model is not touched, users should do the necessary initialization by themselves
* *
* Common usage example: * \code{.cpp}
* // Example usage code of LoadCheckPoint
* int iter = rabit::LoadCheckPoint(&model); * int iter = rabit::LoadCheckPoint(&model);
* if (iter == 0) model.InitParameters(); * if (iter == 0) model.InitParameters();
* for (i = iter; i < max_iter; ++i) { * for (i = iter; i < max_iter; ++i) {
* do many things, include allreduce * // do many things, include allreduce
* rabit::CheckPoint(model); * rabit::CheckPoint(model);
* } * }
* * \endcode
* \sa CheckPoint, VersionNumber * \sa CheckPoint, VersionNumber
*/ */
inline int LoadCheckPoint(Serializable *global_model, inline int LoadCheckPoint(Serializable *global_model,