Remove omp_get_max_threads in tree updaters. (#7590)

This commit is contained in:
Jiaming Yuan
2022-01-26 19:55:47 +08:00
committed by GitHub
parent 24789429fd
commit 5d7818e75d
19 changed files with 142 additions and 199 deletions

View File

@@ -302,22 +302,7 @@ class SparsePage {
SparsePage GetTranspose(int num_columns, int32_t n_threads) const;
void SortRows() {
auto ncol = static_cast<bst_omp_uint>(this->Size());
dmlc::OMPException exc;
#pragma omp parallel for schedule(dynamic, 1)
for (bst_omp_uint i = 0; i < ncol; ++i) {
exc.Run([&]() {
if (this->offset.HostVector()[i] < this->offset.HostVector()[i + 1]) {
std::sort(
this->data.HostVector().begin() + this->offset.HostVector()[i],
this->data.HostVector().begin() + this->offset.HostVector()[i + 1],
Entry::CmpValue);
}
});
}
exc.Rethrow();
}
void SortRows(int32_t n_threads);
/**
* \brief Pushes external data batch onto this page

View File

@@ -1,5 +1,5 @@
/*!
* Copyright 2014-2019 by Contributors
* Copyright 2014-2022 by XGBoost Contributors
* \file tree_updater.h
* \brief General primitive for tree learning,
* Updating a collection of trees given the information.
@@ -32,7 +32,7 @@ class Json;
*/
class TreeUpdater : public Configurable {
protected:
GenericParameter const* tparam_;
GenericParameter const* ctx_;
public:
/*! \brief virtual destructor */