Honor CPU counts from CFS. (#7654)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
/*!
|
||||
* Copyright 2015-2019 by Contributors
|
||||
* \file common.h
|
||||
* \brief Threading utilities
|
||||
* Copyright 2019-2022 by XGBoost Contributors
|
||||
*/
|
||||
#ifndef XGBOOST_COMMON_THREADING_UTILS_H_
|
||||
#define XGBOOST_COMMON_THREADING_UTILS_H_
|
||||
@@ -238,6 +236,8 @@ inline int32_t OmpGetThreadLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
int32_t GetCfsCPUCount() noexcept;
|
||||
|
||||
inline int32_t OmpGetNumThreads(int32_t n_threads) {
|
||||
if (n_threads <= 0) {
|
||||
n_threads = std::min(omp_get_num_procs(), omp_get_max_threads());
|
||||
|
||||
Reference in New Issue
Block a user