Disable HT for DMatrix creation (#6386)

Co-authored-by: SHVETS, KIRILL <kirill.shvets@intel.com>
This commit is contained in:
ShvetsKS 2020-11-14 17:18:33 +03:00 committed by GitHub
parent fcd6fad822
commit 512b464cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -160,6 +160,16 @@ inline int32_t OmpSetNumThreads(int32_t* p_threads) {
omp_set_num_threads(threads);
return nthread_original;
}
inline int32_t OmpSetNumThreadsWithoutHT(int32_t* p_threads) {
auto& threads = *p_threads;
int32_t nthread_original = omp_get_max_threads();
if (threads <= 0) {
threads = nthread_original;
}
omp_set_num_threads(threads);
return nthread_original;
}
} // namespace common
} // namespace xgboost

View File

@ -844,7 +844,7 @@ void SparsePage::Push(const SparsePage &batch) {
template <typename AdapterBatchT>
uint64_t SparsePage::Push(const AdapterBatchT& batch, float missing, int nthread) {
// Set number of threads but keep old value so we can reset it after
int nthread_original = common::OmpSetNumThreads(&nthread);
int nthread_original = common::OmpSetNumThreadsWithoutHT(&nthread);
auto& offset_vec = offset.HostVector();
auto& data_vec = data.HostVector();

View File

@ -93,7 +93,7 @@ BatchSet<EllpackPage> SimpleDMatrix::GetEllpackBatches(const BatchParam& param)
template <typename AdapterT>
SimpleDMatrix::SimpleDMatrix(AdapterT* adapter, float missing, int nthread) {
// Set number of threads but keep old value so we can reset it after
int nthread_original = common::OmpSetNumThreads(&nthread);
int nthread_original = common::OmpSetNumThreadsWithoutHT(&nthread);
std::vector<uint64_t> qids;
uint64_t default_max = std::numeric_limits<uint64_t>::max();