Remove omp_get_max_threads in tree updaters. (#7590)
This commit is contained in:
@@ -1035,6 +1035,16 @@ SparsePage SparsePage::GetTranspose(int num_columns, int32_t n_threads) const {
|
||||
return transpose;
|
||||
}
|
||||
|
||||
void SparsePage::SortRows(int32_t n_threads) {
|
||||
auto& h_offset = this->offset.HostVector();
|
||||
auto& h_data = this->data.HostVector();
|
||||
common::ParallelFor(this->Size(), n_threads, [&](auto i) {
|
||||
if (h_offset[i] < h_offset[i + 1]) {
|
||||
std::sort(h_data.begin() + h_offset[i], h_data.begin() + h_offset[i + 1], Entry::CmpValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SparsePage::Push(const SparsePage &batch) {
|
||||
auto& data_vec = data.HostVector();
|
||||
auto& offset_vec = offset.HostVector();
|
||||
|
||||
@@ -67,7 +67,7 @@ BatchSet<SortedCSCPage> SimpleDMatrix::GetSortedColumnBatches() {
|
||||
if (!sorted_column_page_) {
|
||||
sorted_column_page_.reset(
|
||||
new SortedCSCPage(sparse_page_->GetTranspose(info_.num_col_, ctx_.Threads())));
|
||||
sorted_column_page_->SortRows();
|
||||
sorted_column_page_->SortRows(ctx_.Threads());
|
||||
}
|
||||
auto begin_iter = BatchIterator<SortedCSCPage>(
|
||||
new SimpleBatchIteratorImpl<SortedCSCPage>(sorted_column_page_));
|
||||
|
||||
@@ -339,7 +339,7 @@ class SortedCSCPageSource : public PageSourceIncMixIn<SortedCSCPage> {
|
||||
this->page_->PushCSC(csr->GetTranspose(n_features_, nthreads_));
|
||||
CHECK_EQ(this->page_->Size(), n_features_);
|
||||
CHECK_EQ(this->page_->data.Size(), csr->data.Size());
|
||||
this->page_->SortRows();
|
||||
this->page_->SortRows(this->nthreads_);
|
||||
page_->SetBaseRowId(csr->base_rowid);
|
||||
this->WriteCache();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user