diff --git a/.gitignore b/.gitignore index 31eed0c3b..bf6d3e539 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ # Precompiled Headers *.gch *.pch - +*.lnk # Compiled Dynamic libraries *.so *.dylib diff --git a/tracker/rabit_demo.py b/tracker/rabit_demo.py index 5abd96599..56ac7c8e0 100755 --- a/tracker/rabit_demo.py +++ b/tracker/rabit_demo.py @@ -48,8 +48,7 @@ def exec_cmd(cmd, taskid): while True: if os.name == 'nt': prep = 'SET PYTHONPATH=\"%s\"\n' % WRAPPER_PATH - ret = subprocess.call(prep + cmd + ('rabit_num_trial=%d' % ntrial), - shell=True) + ret = subprocess.call(prep + cmd + ('rabit_num_trial=%d' % ntrial), shell=True) if ret == 254: ntrial += 1 continue @@ -66,7 +65,10 @@ def exec_cmd(cmd, taskid): print 'Thread %d exit with 0' % taskid return 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 # submission script using pyhton multi-threading diff --git a/wrapper/rabit.py b/wrapper/rabit.py index 20ed8abdb..a6c579338 100644 --- a/wrapper/rabit.py +++ b/wrapper/rabit.py @@ -11,11 +11,9 @@ import warnings import numpy as np if os.name == 'nt': - WRAPPER_PATH = os.path.dirname(__file__) + '\\..\\windows\\x64\\Release\\' - WRAPPER_SUFFIX = 'dll' + WRAPPER_PATH = os.path.dirname(__file__) + '\\..\\windows\\x64\\Release\\rabit_wrapper%s.dll' else: - WRAPPER_PATH = os.path.dirname(__file__) + '/' - WRAPPER_SUFFIX = 'so' + WRAPPER_PATH = os.path.dirname(__file__) + '/librabit_wrapper%s.so' rbtlib = None # 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) return if lib == 'standard': - rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper.' + WRAPPER_SUFFIX) + rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '') elif lib == 'mock': - rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper_mock.' + WRAPPER_SUFFIX) + rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mock') elif lib == 'mpi': - rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH + 'librabit_wrapper_mpi.so' + WRAPPER_SUFFIX) + rbtlib = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mpi') else: raise Exception('unknown rabit lib %s, can be standard, mock, mpi' % lib) rbtlib.RabitGetRank.restype = ctypes.c_int