This commit is contained in:
Tianqi Chen 2015-01-16 21:10:01 -08:00
parent 56a80f431b
commit 537497f520
3 changed files with 11 additions and 11 deletions

2
.gitignore vendored
View File

@ -7,7 +7,7 @@
# Precompiled Headers # Precompiled Headers
*.gch *.gch
*.pch *.pch
*.lnk
# Compiled Dynamic libraries # Compiled Dynamic libraries
*.so *.so
*.dylib *.dylib

View File

@ -48,8 +48,7 @@ def exec_cmd(cmd, taskid):
while True: while True:
if os.name == 'nt': if os.name == 'nt':
prep = 'SET PYTHONPATH=\"%s\"\n' % WRAPPER_PATH prep = 'SET PYTHONPATH=\"%s\"\n' % WRAPPER_PATH
ret = subprocess.call(prep + cmd + ('rabit_num_trial=%d' % ntrial), ret = subprocess.call(prep + cmd + ('rabit_num_trial=%d' % ntrial), shell=True)
shell=True)
if ret == 254: if ret == 254:
ntrial += 1 ntrial += 1
continue continue
@ -66,7 +65,10 @@ def exec_cmd(cmd, taskid):
print 'Thread %d exit with 0' % taskid print 'Thread %d exit with 0' % taskid
return return
else: else:
raise Exception('Get nonzero return code=%d' % ret) if os.name == 'nt':
os.exit(-1)
else:
raise Exception('Get nonzero return code=%d' % ret)
# #
# Note: this submit script is only used for demo purpose # Note: this submit script is only used for demo purpose
# submission script using pyhton multi-threading # submission script using pyhton multi-threading

View File

@ -11,11 +11,9 @@ import warnings
import numpy as np import numpy as np
if os.name == 'nt': if os.name == 'nt':
WRAPPER_PATH = os.path.dirname(__file__) + '\\..\\windows\\x64\\Release\\' WRAPPER_PATH = os.path.dirname(__file__) + '\\..\\windows\\x64\\Release\\rabit_wrapper%s.dll'
WRAPPER_SUFFIX = 'dll'
else: else:
WRAPPER_PATH = os.path.dirname(__file__) + '/' WRAPPER_PATH = os.path.dirname(__file__) + '/librabit_wrapper%s.so'
WRAPPER_SUFFIX = 'so'
rbtlib = None rbtlib = None
# load in xgboost library # load in xgboost library
@ -25,11 +23,11 @@ def loadlib__(lib = 'standard'):
warnings.Warn('rabit.int call was ignored because it has already been initialized', level = 2) warnings.Warn('rabit.int call was ignored because it has already been initialized', level = 2)
return return
if lib == 'standard': if lib == 'standard':
rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper.' + WRAPPER_SUFFIX) rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '')
elif lib == 'mock': elif lib == 'mock':
rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper_mock.' + WRAPPER_SUFFIX) rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mock')
elif lib == 'mpi': elif lib == 'mpi':
rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper_mpi.so' + WRAPPER_SUFFIX) rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mpi')
else: else:
raise Exception('unknown rabit lib %s, can be standard, mock, mpi' % lib) raise Exception('unknown rabit lib %s, can be standard, mock, mpi' % lib)
rbtlib.RabitGetRank.restype = ctypes.c_int rbtlib.RabitGetRank.restype = ctypes.c_int