Skip to content

Commit

Permalink
fix rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Feb 7, 2022
1 parent e64cd03 commit 86715a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/data/gradient_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void GHistIndexMatrix::Init(DMatrix *p_fmat, int max_bins, double sparse_thresh,
CHECK(p_fmat->SingleColBlock());
CHECK(!sorted_sketch);
for (auto const &page : p_fmat->GetBatches<SparsePage>()) {
this->columns_->Init(page, *this, sparse_thresh);
this->columns_->Init(page, *this, sparse_thresh, n_threads);
}
}
}
Expand Down Expand Up @@ -199,7 +199,7 @@ void GHistIndexMatrix::Init(SparsePage const &batch, common::Span<FeatureType co
this->PushBatch(batch, ft, rbegin, prev_sum, nbins, n_threads);
this->columns_ = std::make_unique<common::ColumnMatrix>();
if (!std::isnan(sparse_thresh)) {
this->columns_->Init(batch, *this, sparse_thresh);
this->columns_->Init(batch, *this, sparse_thresh, n_threads);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/data/gradient_index_page_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void GradientIndexPageSource::Fetch() {
if (count_ != 0) {
++(*source_);
}
// This is not read from cache so we still need it to be synced with sparse page source.
CHECK_EQ(count_, source_->Iter());
auto const& csr = source_->Page();
this->page_.reset(new GHistIndexMatrix());
Expand Down
13 changes: 5 additions & 8 deletions src/data/sparse_page_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ class PageSourceIncMixIn : public SparsePageSourceImpl<S> {
bool sync_{true}; // synchronize the row page.

public:
using SparsePageSourceImpl<S>::SparsePageSourceImpl;
PageSourceIncMixIn(float missing, int nthreads, bst_feature_t n_features, uint32_t n_batches,
std::shared_ptr<Cache> cache, bool sync)
: Super::SparsePageSourceImpl{missing, nthreads, n_features, n_batches, cache}, sync_{sync} {}
Expand Down Expand Up @@ -323,6 +322,7 @@ class PageSourceIncMixIn : public SparsePageSourceImpl<S> {
} else {
this->Fetch();
}

if (sync_) {
CHECK_EQ(source_->Iter(), this->count_);
}
Expand All @@ -344,12 +344,9 @@ class CSCPageSource : public PageSourceIncMixIn<CSCPage> {
}

public:
CSCPageSource(
float missing, int nthreads, bst_feature_t n_features, uint32_t n_batches,
std::shared_ptr<Cache> cache,
std::shared_ptr<SparsePageSource> source)
: PageSourceIncMixIn(missing, nthreads, n_features,
n_batches, cache) {
CSCPageSource(float missing, int nthreads, bst_feature_t n_features, uint32_t n_batches,
std::shared_ptr<Cache> cache, std::shared_ptr<SparsePageSource> source)
: PageSourceIncMixIn(missing, nthreads, n_features, n_batches, cache, true) {
this->source_ = source;
this->Fetch();
}
Expand All @@ -375,7 +372,7 @@ class SortedCSCPageSource : public PageSourceIncMixIn<SortedCSCPage> {
SortedCSCPageSource(float missing, int nthreads, bst_feature_t n_features,
uint32_t n_batches, std::shared_ptr<Cache> cache,
std::shared_ptr<SparsePageSource> source)
: PageSourceIncMixIn(missing, nthreads, n_features, n_batches, cache) {
: PageSourceIncMixIn(missing, nthreads, n_features, n_batches, cache, true) {
this->source_ = source;
this->Fetch();
}
Expand Down
6 changes: 3 additions & 3 deletions src/tree/updater_quantile_hist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ void QuantileHistMaker::Builder<GradientSumT>::ExpandTree(
auto const &column_matrix = page.Transpose();
auto &part = this->row_partitioner_.at(page_id);
if (column_matrix.AnyMissing()) {
part.template UpdatePosition<true>(nthread_, page, column_matrix, applied, p_tree);
part.template UpdatePosition<true>(ctx_->Threads(), page, column_matrix, applied, p_tree);
} else {
part.template UpdatePosition<false>(nthread_, page, column_matrix, applied, p_tree);
part.template UpdatePosition<false>(ctx_->Threads(), page, column_matrix, applied, p_tree);
}
++page_id;
}
Expand Down Expand Up @@ -368,7 +368,7 @@ void QuantileHistMaker::Builder<GradientSumT>::InitData(const GHistIndexMatrix &
CHECK_EQ(n_total_bins, page.cut.TotalBins());
}
row_partitioner_.emplace_back();
row_partitioner_.back().Init(page.Size(), page.base_rowid, this->nthread_);
row_partitioner_.back().Init(page.Size(), page.base_rowid, this->ctx_->Threads());
++page_id;
}
histogram_builder_->Reset(n_total_bins, BatchParam{param_.max_bin, param_.sparse_threshold},
Expand Down

0 comments on commit 86715a5

Please sign in to comment.