cleanup multi-node
This commit is contained in:
@@ -33,10 +33,6 @@ xglib.XGBoosterCreate.restype = ctypes.c_void_p
|
||||
xglib.XGBoosterPredict.restype = ctypes.POINTER(ctypes.c_float)
|
||||
xglib.XGBoosterEvalOneIter.restype = ctypes.c_char_p
|
||||
xglib.XGBoosterDumpModel.restype = ctypes.POINTER(ctypes.c_char_p)
|
||||
# sync function
|
||||
xglib.XGSyncGetRank.restype = ctypes.c_int
|
||||
xglib.XGSyncGetWorldSize.restype = ctypes.c_int
|
||||
# initialize communication module
|
||||
|
||||
def ctypes2numpy(cptr, length, dtype):
|
||||
"""convert a ctypes pointer array to numpy array """
|
||||
@@ -557,17 +553,3 @@ def cv(params, dtrain, num_boost_round = 10, nfold=3, metrics=[], \
|
||||
results.append(res)
|
||||
return results
|
||||
|
||||
# synchronization module
|
||||
def sync_init(args = sys.argv):
|
||||
arr = (ctypes.c_char_p * len(args))()
|
||||
arr[:] = args
|
||||
xglib.XGSyncInit(len(args), arr)
|
||||
|
||||
def sync_finalize():
|
||||
xglib.XGSyncFinalize()
|
||||
|
||||
def sync_get_rank():
|
||||
return int(xglib.XGSyncGetRank())
|
||||
|
||||
def sync_get_world_size():
|
||||
return int(xglib.XGSyncGetWorldSize())
|
||||
|
||||
@@ -82,23 +82,6 @@ class Booster: public learner::BoostLearner {
|
||||
using namespace xgboost::wrapper;
|
||||
|
||||
extern "C"{
|
||||
void XGSyncInit(int argc, char *argv[]) {
|
||||
rabit::Init(argc, argv);
|
||||
if (rabit::GetWorldSize() != 1) {
|
||||
std::string pname = rabit::GetProcessorName();
|
||||
utils::Printf("distributed job start %s:%d\n", pname.c_str(), rabit::GetRank());
|
||||
}
|
||||
}
|
||||
void XGSyncFinalize(void) {
|
||||
rabit::Finalize();
|
||||
}
|
||||
int XGSyncGetRank(void) {
|
||||
int rank = rabit::GetRank();
|
||||
return rank;
|
||||
}
|
||||
int XGSyncGetWorldSize(void) {
|
||||
return rabit::GetWorldSize();
|
||||
}
|
||||
void* XGDMatrixCreateFromFile(const char *fname, int silent) {
|
||||
return LoadDataMatrix(fname, silent != 0, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user