bugfix of lazy prepare

This commit is contained in:
tqchen 2015-02-11 20:31:46 -08:00
parent 87017bd4cd
commit 4db0a62a06
2 changed files with 8 additions and 2 deletions

View File

@ -77,7 +77,10 @@ void AllreduceRobust::Allreduce(void *sendrecvbuf_,
PreprocFunction prepare_fun,
void *prepare_arg) {
// skip action in single node
if (world_size == 1) return;
if (world_size == 1) {
if (prepare_fun != NULL) prepare_fun(prepare_arg);
return;
}
bool recovered = RecoverExec(sendrecvbuf_, type_nbytes * count, 0, seq_counter);
// now we are free to remove the last result, if any
if (resbuf.LastSeqNo() != -1 &&

View File

@ -92,6 +92,7 @@ void Allreduce_(void *sendrecvbuf,
mpi::OpType op,
IEngine::PreprocFunction prepare_fun,
void *prepare_arg) {
if (prepare_fun != NULL) prepare_fun(prepare_arg);
}
// code for reduce handle
@ -106,6 +107,8 @@ void ReduceHandle::Init(IEngine::ReduceFunction redfunc, size_t type_nbytes) {}
void ReduceHandle::Allreduce(void *sendrecvbuf,
size_t type_nbytes, size_t count,
IEngine::PreprocFunction prepare_fun,
void *prepare_arg) {}
void *prepare_arg) {
if (prepare_fun != NULL) prepare_fun(prepare_arg);
}
} // namespace engine
} // namespace rabit