| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#ifndef XGBOOST_GLOBAL_CONFIG_H_ |
| 8 |
#define XGBOOST_GLOBAL_CONFIG_H_ |
| 9 |
|
| 10 |
#include <dmlc/thread_local.h> |
| 11 |
#include <xgboost/parameter.h> |
| 12 |
|
| 13 |
#include <cstdint> |
| 14 |
|
| 15 |
namespace xgboost { |
| 16 |
struct GlobalConfiguration : public XGBoostParameter<GlobalConfiguration> { |
| 17 |
std::int32_t verbosity{1}; |
| 18 |
bool use_rmm{false}; |
| 19 |
bool use_cuda_async_pool{false}; |
| 20 |
|
| 21 |
std::int32_t nthread{0}; |
| 22 |
DMLC_DECLARE_PARAMETER(GlobalConfiguration) { |
| 23 |
DMLC_DECLARE_FIELD(verbosity) |
| 24 |
.set_range(0, 3) |
| 25 |
.set_default(1) |
| 26 |
.describe("Flag to print out detailed breakdown of runtime."); |
| 27 |
DMLC_DECLARE_FIELD(use_rmm).set_default(false).describe( |
| 28 |
"Whether to use RAPIDS Memory Manager to allocate GPU memory in XGBoost"); |
| 29 |
DMLC_DECLARE_FIELD(use_cuda_async_pool) |
| 30 |
.set_default(false) |
| 31 |
.describe("Whether to use the async memory pool in CUDA."); |
| 32 |
} |
| 33 |
}; |
| 34 |
|
| 35 |
using GlobalConfigThreadLocalStore = dmlc::ThreadLocalStore<GlobalConfiguration>; |
| 36 |
|
| 37 |
struct InitNewThread { |
| 38 |
GlobalConfiguration config; |
| 39 |
std::int32_t device{-1}; |
| 40 |
|
| 41 |
void operator()() const; |
| 42 |
InitNewThread(); |
| 43 |
}; |
| 44 |
} |
| 45 |
|
| 46 |
#endif |