Debian Codegraph @

src/include/xgboost/global_config.h

raw symbols SCIP
1 /**
2 * Copyright 2020-2025, XGBoost Contributors
3 * \file global_config.h
4 * \brief Global configuration for XGBoost
5 * \author Hyunsu Cho
6 */
7 #ifndef XGBOOST_GLOBAL_CONFIG_H_
8 #define XGBOOST_GLOBAL_CONFIG_H_
9
10 #include <dmlc/thread_local.h> // for ThreadLocalStore
11 #include <xgboost/parameter.h> // for XGBoostParameter
12
13 #include <cstdint> // for int32_t
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 // This is not a dmlc parameter to avoid conflict with the context class.
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) // shows only warning
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 } // namespace xgboost
45
46 #endif // XGBOOST_GLOBAL_CONFIG_H_