move nthread to local var

This commit is contained in:
tqchen 2014-09-02 09:06:24 -07:00
parent 28128a1b6e
commit 70219ee1ae

View File

@ -26,13 +26,14 @@ class TreeRefresher: public IUpdater {
virtual void Update(const std::vector<bst_gpair> &gpair, virtual void Update(const std::vector<bst_gpair> &gpair,
IFMatrix *p_fmat, IFMatrix *p_fmat,
const BoosterInfo &info, const BoosterInfo &info,
const std::vector<RegTree*> &trees) { const std::vector<RegTree*> &trees) {
if (trees.size() == 0) return; if (trees.size() == 0) return;
// number of threads // number of threads
// thread temporal space // thread temporal space
std::vector< std::vector<TStats> > stemp; std::vector< std::vector<TStats> > stemp;
std::vector<RegTree::FVec> fvec_temp; std::vector<RegTree::FVec> fvec_temp;
// setup temp space for each thread // setup temp space for each thread
int nthread;
#pragma omp parallel #pragma omp parallel
{ {
nthread = omp_get_num_threads(); nthread = omp_get_num_threads();
@ -126,8 +127,6 @@ class TreeRefresher: public IUpdater {
this->Refresh(gstats, tree[nid].cright(), p_tree); this->Refresh(gstats, tree[nid].cright(), p_tree);
} }
} }
// number of thread in the data
int nthread;
// training parameter // training parameter
TrainParam param; TrainParam param;
}; };