From 1d8c2391e8b413a981b625b691b33a5237d4b6f7 Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 18 Aug 2014 14:58:30 -0700 Subject: [PATCH] update tree maker to make it more robust --- python/README.md | 1 + src/tree/updater_colmaker-inl.hpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/README.md b/python/README.md index cf59ba9ab..4aceb7d5e 100644 --- a/python/README.md +++ b/python/README.md @@ -3,3 +3,4 @@ python wrapper for xgboost using ctypes see example for usage to make the python module, type make in the root directory of project + diff --git a/src/tree/updater_colmaker-inl.hpp b/src/tree/updater_colmaker-inl.hpp index eb5ff85fc..3645e53ce 100644 --- a/src/tree/updater_colmaker-inl.hpp +++ b/src/tree/updater_colmaker-inl.hpp @@ -271,7 +271,8 @@ class ColMaker: public IUpdater { } // start enumeration const unsigned nsize = static_cast(feat_set.size()); - #pragma omp parallel for schedule(dynamic, 1) + const int batch_size = std::max(static_cast(nsize / this->nthread / 32), 1); + #pragma omp parallel for schedule(dynamic, batch_size) for (unsigned i = 0; i < nsize; ++i) { const unsigned fid = feat_set[i]; const int tid = omp_get_thread_num();