diff --git a/python-package/xgboost/rabit.py b/python-package/xgboost/rabit.py index 7c6a9dbcf..ae2426a1a 100644 --- a/python-package/xgboost/rabit.py +++ b/python-package/xgboost/rabit.py @@ -12,6 +12,7 @@ def _init_rabit(): if _LIB is not None: _LIB.RabitGetRank.restype = ctypes.c_int _LIB.RabitGetWorldSize.restype = ctypes.c_int + _LIB.RabitIsDistributed.restype = ctypes.c_int _LIB.RabitVersionNumber.restype = ctypes.c_int def init(args=None): @@ -65,8 +66,12 @@ def tracker_print(msg): """ if not isinstance(msg, STRING_TYPES): msg = str(msg) - _LIB.RabitTrackerPrint(c_str(msg)) - + is_dist = _LIB.RabitIsDistributed() + if is_dist != 0: + _LIB.RabitTrackerPrint(c_str(msg)) + else: + sys.stdout.write(msg) + sys.stdout.flush() def get_processor_name(): """Get the processor name. diff --git a/rabit b/rabit index be50e7b63..849b20b7c 160000 --- a/rabit +++ b/rabit @@ -1 +1 @@ -Subproject commit be50e7b63224b9fb7ff94ce34df9f8752ef83043 +Subproject commit 849b20b7c822d194a515cc5587c37764cdf39385