Skip to content

Commit

Permalink
fix #508
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed May 13, 2017
1 parent 5b0ae60 commit e9cfece
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/treelearner/feature_histogram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,17 @@ class HistogramPool {
}
uint64_t num_total_bin = train_data->NumTotalBin();
Log::Info("Total Bins %d", num_total_bin);
int old_cache_size = cache_size_;
int old_cache_size = static_cast<int>(pool_.size());
Reset(cache_size, total_size);
pool_.resize(cache_size);
data_.resize(cache_size);

if (cache_size > old_cache_size) {
pool_.resize(cache_size);
data_.resize(cache_size);
}

OMP_INIT_EX();
#pragma omp parallel for schedule(static)
for (int i = old_cache_size; i < cache_size_; ++i) {
for (int i = old_cache_size; i < cache_size; ++i) {
OMP_LOOP_EX_BEGIN();
pool_[i].reset(new FeatureHistogram[train_data->num_features()]);
data_[i].resize(num_total_bin);
Expand Down

0 comments on commit e9cfece

Please sign in to comment.