[FIX] rabit on single node
This commit is contained in:
parent
849b20b7c8
commit
e19fced5cb
@ -90,7 +90,7 @@ class AllreduceBase : public IEngine {
|
|||||||
PreprocFunction prepare_fun = NULL,
|
PreprocFunction prepare_fun = NULL,
|
||||||
void *prepare_arg = NULL) {
|
void *prepare_arg = NULL) {
|
||||||
if (prepare_fun != NULL) prepare_fun(prepare_arg);
|
if (prepare_fun != NULL) prepare_fun(prepare_arg);
|
||||||
if (world_size == 1) return;
|
if (world_size == 1 || world_size == -1) return;
|
||||||
utils::Assert(TryAllreduce(sendrecvbuf_,
|
utils::Assert(TryAllreduce(sendrecvbuf_,
|
||||||
type_nbytes, count, reducer) == kSuccess,
|
type_nbytes, count, reducer) == kSuccess,
|
||||||
"Allreduce failed");
|
"Allreduce failed");
|
||||||
@ -102,7 +102,7 @@ class AllreduceBase : public IEngine {
|
|||||||
* \param root the root worker id to broadcast the data
|
* \param root the root worker id to broadcast the data
|
||||||
*/
|
*/
|
||||||
virtual void Broadcast(void *sendrecvbuf_, size_t total_size, int root) {
|
virtual void Broadcast(void *sendrecvbuf_, size_t total_size, int root) {
|
||||||
if (world_size == 1) return;
|
if (world_size == 1 || world_size == -1) return;
|
||||||
utils::Assert(TryBroadcast(sendrecvbuf_, total_size, root) == kSuccess,
|
utils::Assert(TryBroadcast(sendrecvbuf_, total_size, root) == kSuccess,
|
||||||
"Broadcast failed");
|
"Broadcast failed");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ void AllreduceRobust::Allreduce(void *sendrecvbuf_,
|
|||||||
*/
|
*/
|
||||||
void AllreduceRobust::Broadcast(void *sendrecvbuf_, size_t total_size, int root) {
|
void AllreduceRobust::Broadcast(void *sendrecvbuf_, size_t total_size, int root) {
|
||||||
// skip action in single node
|
// skip action in single node
|
||||||
if (world_size == 1) return;
|
if (world_size == 1 || world_size == -1) return;
|
||||||
bool recovered = RecoverExec(sendrecvbuf_, total_size, 0, seq_counter);
|
bool recovered = RecoverExec(sendrecvbuf_, total_size, 0, seq_counter);
|
||||||
// now we are free to remove the last result, if any
|
// now we are free to remove the last result, if any
|
||||||
if (resbuf.LastSeqNo() != -1 &&
|
if (resbuf.LastSeqNo() != -1 &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user