From cd2bce47190532a9e4c14af1e3d92b65fae2c10c Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 19 Jan 2015 21:32:25 -0800 Subject: [PATCH] update with new rabit api --- multi-node/row-split/machine-row-rabit.sh | 6 +++--- src/tree/param.h | 12 ++++++------ src/tree/updater_distcol-inl.hpp | 2 +- src/tree/updater_histmaker-inl.hpp | 2 +- src/tree/updater_refresh-inl.hpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/multi-node/row-split/machine-row-rabit.sh b/multi-node/row-split/machine-row-rabit.sh index 69f94b9d1..fb3e3ba60 100755 --- a/multi-node/row-split/machine-row-rabit.sh +++ b/multi-node/row-split/machine-row-rabit.sh @@ -17,8 +17,8 @@ cd - python splitrows.py ../../demo/regression/machine.txt.train train-machine $k # run xgboost mpi -../../rabit/tracker/rabit_mpi.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=3 eval_train=1 +../../subtree/rabit/tracker/rabit_demo.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=3 eval_train=1 # run xgboost-mpi save model 0001, continue to run from existing model -../../rabit/tracker/rabit_mpi.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=1 -../../rabit/tracker/rabit_mpi.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=2 model_in=0001.model +../../subtree/rabit/tracker/rabit_demo.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=1 +../../subtree/rabit/tracker/rabit_demo.py -n $k ../../xgboost machine-row.conf dsplit=row num_round=2 model_in=0001.model diff --git a/src/tree/param.h b/src/tree/param.h index 701721c17..2c2362095 100644 --- a/src/tree/param.h +++ b/src/tree/param.h @@ -205,8 +205,8 @@ struct GradStats { this->Add(b.sum_grad, b.sum_hess); } /*! \brief same as add, reduce is used in All Reduce */ - inline void Reduce(const GradStats &b) { - this->Add(b); + inline static void Reduce(GradStats &a, const GradStats &b) { + a.Add(b); } /*! \brief set current value to a - b */ inline void SetSubstract(const GradStats &a, const GradStats &b) { @@ -285,8 +285,8 @@ struct CVGradStats : public GradStats { } } /*! \brief same as add, reduce is used in All Reduce */ - inline void Reduce(const CVGradStats &b) { - this->Add(b); + inline static void Reduce(CVGradStats &a, const CVGradStats &b) { + a.Add(b); } /*! \brief set current value to a - b */ inline void SetSubstract(const CVGradStats &a, const CVGradStats &b) { @@ -368,8 +368,8 @@ struct SplitEntry{ } } /*! \brief same as update, used by AllReduce*/ - inline void Reduce(const SplitEntry &e) { - this->Update(e); + inline static void Reduce(SplitEntry &dst, const SplitEntry &src) { + dst.Update(src); } /*!\return feature index to split on */ inline unsigned split_index(void) const { diff --git a/src/tree/updater_distcol-inl.hpp b/src/tree/updater_distcol-inl.hpp index fe872971b..c989f4e47 100644 --- a/src/tree/updater_distcol-inl.hpp +++ b/src/tree/updater_distcol-inl.hpp @@ -155,7 +155,7 @@ class DistColMaker : public ColMaker { private: utils::BitMap bitmap; std::vector boolmap; - rabit::Reducer reducer; + rabit::Reducer reducer; }; // we directly introduce pruner here TreePruner pruner; diff --git a/src/tree/updater_histmaker-inl.hpp b/src/tree/updater_histmaker-inl.hpp index b519f3480..8c617450b 100644 --- a/src/tree/updater_histmaker-inl.hpp +++ b/src/tree/updater_histmaker-inl.hpp @@ -117,7 +117,7 @@ class HistMaker: public BaseMaker { // workspace of thread ThreadWSpace wspace; // reducer for histogram - rabit::Reducer histred; + rabit::Reducer histred; // set of working features std::vector fwork_set; // update function implementation diff --git a/src/tree/updater_refresh-inl.hpp b/src/tree/updater_refresh-inl.hpp index 75ee3aadf..8613c8ea6 100644 --- a/src/tree/updater_refresh-inl.hpp +++ b/src/tree/updater_refresh-inl.hpp @@ -147,7 +147,7 @@ class TreeRefresher: public IUpdater { // training parameter TrainParam param; // reducer - rabit::Reducer reducer; + rabit::Reducer reducer; }; } // namespace tree