make clear seperation

This commit is contained in:
tqchen
2014-10-16 13:03:42 -07:00
parent 47145a7fac
commit a21df0770d
6 changed files with 63 additions and 24 deletions

27
src/sync/sync_empty.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "./sync.h"
#include "../utils/utils.h"
// no synchronization module, single thread mode does not need it anyway
namespace xgboost {
namespace sync {
int GetRank(void) {
return 0;
}
void Init(int argc, char *argv[]) {
}
void Finalize(void) {
}
template<>
void AllReduce<uint32_t>(uint32_t *sendrecvbuf, int count, ReduceOp op) {
}
template<>
void AllReduce<float>(float *sendrecvbuf, int count, ReduceOp op) {
}
void Bcast(std::string *sendrecv_data, int root) {
}
ReduceHandle::ReduceHandle(void) : handle(NULL) {}
ReduceHandle::~ReduceHandle(void) {}
void ReduceHandle::Init(ReduceFunction redfunc, bool commute) {}
void ReduceHandle::AllReduce(void *sendrecvbuf, size_t n4byte) {}
} // namespace sync
} // namespace xgboost

View File

@@ -1,10 +1,9 @@
#include "./sync.h"
#include "../utils/utils.h"
#include "mpi.h"
// use MPI to implement sync
namespace xgboost {
namespace sync {
int GetRank(void) {
return MPI::COMM_WORLD.Get_rank();
}