[DIST] Enable multiple thread and tracker, make rabit and xgboost more thread-safe by using thread local variables.

This commit is contained in:
tqchen
2016-03-03 11:36:34 -08:00
parent 12dc92f7e0
commit e80d3db64b
17 changed files with 323 additions and 153 deletions

View File

@@ -15,6 +15,7 @@
#include <utility>
#include <string>
#include <limits>
#include "../common/common.h"
namespace xgboost {
namespace gbm {
@@ -265,13 +266,11 @@ class GBTree : public GradientBooster {
inline void InitUpdater() {
if (updaters.size() != 0) return;
std::string tval = tparam.updater_seq;
char *pstr;
pstr = std::strtok(&tval[0], ",");
while (pstr != nullptr) {
std::unique_ptr<TreeUpdater> up(TreeUpdater::Create(pstr));
std::vector<std::string> ups = common::Split(tval, ',');
for (const std::string& pstr : ups) {
std::unique_ptr<TreeUpdater> up(TreeUpdater::Create(pstr.c_str()));
up->Init(this->cfg);
updaters.push_back(std::move(up));
pstr = std::strtok(nullptr, ",");
}
}
// do group specific group