Update rabit

This commit is contained in:
tqchen 2016-03-01 21:02:35 -08:00
parent 0515e4ec28
commit ced6d45e01
5 changed files with 22 additions and 6 deletions

5
.gitignore vendored
View File

@ -20,8 +20,9 @@
*buffer
*model
*pyc
*train
*test
*.train
*.test
*.tar
*group
*rar
*vali

View File

@ -73,7 +73,7 @@ endif
# specify tensor path
.PHONY: clean all lint clean_all doxygen rcpplint Rpack Rbuild Rcheck java
.PHONY: clean all lint clean_all doxygen rcpplint pypack Rpack Rbuild Rcheck java
all: lib/libxgboost.a $(XGBOOST_DYLIB) xgboost
@ -143,6 +143,11 @@ clean_all: clean
doxygen:
doxygen doc/Doxyfile
# create standalone python tar file.
pypack: ${XGBOOST_DYLIB}
cp ${XGBOOST_DYLIB} python-package/xgboost
cd python-package; tar cf xgboost.tar xgboost; cd ..
# Script to make a clean installable R package.
Rpack:
make clean_all

View File

@ -8,11 +8,18 @@ import numpy as np
from .core import _LIB, c_str, STRING_TYPES
def _init_rabit():
"""Initialize the rabit library."""
"""internal libary initializer."""
_LIB.RabitGetRank.restype = ctypes.c_int
_LIB.RabitGetWorldSize.restype = ctypes.c_int
_LIB.RabitVersionNumber.restype = ctypes.c_int
_LIB.RabitInit(0, None)
def init(args=None):
"""Initialize the rabit libary with arguments"""
if args is None:
args = []
arr = (ctypes.c_char_p * len(args))()
arr[:] = args
_LIB.RabitInit(len(arr), arr)
def finalize():

2
rabit

@ -1 +1 @@
Subproject commit 1392e9f3da59bd5602ddebee944dd8fb5c6507b0
Subproject commit be50e7b63224b9fb7ff94ce34df9f8752ef83043

View File

@ -4,6 +4,9 @@ import scipy.sparse
import pickle
import xgboost as xgb
# always call this before using distributed module
xgb.rabit.init()
# Load file, file will be automatically sharded in distributed mode.
dtrain = xgb.DMatrix('../../demo/data/agaricus.txt.train')
dtest = xgb.DMatrix('../../demo/data/agaricus.txt.test')