Disable HT for DMatrix creation (#6386)

Co-authored-by: SHVETS, KIRILL <kirill.shvets@intel.com>
This commit is contained in:
ShvetsKS
2020-11-14 22:18:33 +08:00
committed by GitHub
co-authored by SHVETS, KIRILL <kirill.shvets@intel.com>
parent fcd6fad822
commit 512b464cfa
3 changed files with 12 additions and 2 deletions
+10
View File
@@ -160,6 +160,16 @@ inline int32_t OmpSetNumThreads(int32_t* p_threads) {
omp_set_num_threads(threads); omp_set_num_threads(threads);
return nthread_original; 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 common
} // namespace xgboost } // namespace xgboost
+1 -1
View File
@@ -844,7 +844,7 @@ void SparsePage::Push(const SparsePage &batch) {
template <typename AdapterBatchT> template <typename AdapterBatchT>
uint64_t SparsePage::Push(const AdapterBatchT& batch, float missing, int nthread) { 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 // 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& offset_vec = offset.HostVector();
auto& data_vec = data.HostVector(); auto& data_vec = data.HostVector();
+1 -1
View File
@@ -93,7 +93,7 @@ BatchSet<EllpackPage> SimpleDMatrix::GetEllpackBatches(const BatchParam& param)
template <typename AdapterT> template <typename AdapterT>
SimpleDMatrix::SimpleDMatrix(AdapterT* adapter, float missing, int nthread) { SimpleDMatrix::SimpleDMatrix(AdapterT* adapter, float missing, int nthread) {
// Set number of threads but keep old value so we can reset it after // 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; std::vector<uint64_t> qids;
uint64_t default_max = std::numeric_limits<uint64_t>::max(); uint64_t default_max = std::numeric_limits<uint64_t>::max();