xgboost
|
XGBoost 的运行时上下文。包含线程和设备等信息。 更多...
#include <context.h>
公有成员函数 | |
Context () | |
void | Init (Args const &kwargs) |
template<typename Container > | |
Args | UpdateAllowUnknown (Container const &kwargs) |
void | ConfigureGpuId (bool require_gpu) |
配置参数 ‘device’。已弃用,将在移除 gpu_id 后移除。 更多... | |
std::int32_t | Threads () const |
返回基于 nthread 参数和系统设置自动选择的线程数。 更多... | |
bool | IsCPU () const |
XGBoost 是否在 CPU 上运行? 更多... | |
bool | IsCUDA () const |
XGBoost 是否在 CUDA 设备上运行? 更多... | |
bool | IsSyclDefault () const |
XGBoost 是否在默认 SYCL 设备上运行? 更多... | |
bool | IsSyclCPU () const |
XGBoost 是否在 SYCL CPU 上运行? 更多... | |
bool | IsSyclGPU () const |
XGBoost 是否在 SYCL GPU 上运行? 更多... | |
bool | IsSycl () const |
XGBoost 是否在任何 SYCL 设备上运行? 更多... | |
DeviceOrd | Device () const |
获取当前设备和序号。 更多... | |
bst_d_ordinal_t | Ordinal () const |
获取 CUDA 设备序号。如果 XGBoost 在 CPU 上运行,则为 -1。 更多... | |
std::string | DeviceName () const |
当前设备的名称。 更多... | |
CUDAContext const * | CUDACtx () const |
获取用于分配器和流的 CUDA 设备上下文。 更多... | |
Context | MakeCUDA (bst_d_ordinal_t ordinal=0) const |
基于当前上下文创建 CUDA 上下文。 更多... | |
Context | MakeCPU () const |
基于当前上下文创建 CPU 上下文。 更多... | |
template<typename CPUFn , typename CUDAFn > | |
decltype(auto) | DispatchDevice (CPUFn &&cpu_fn, CUDAFn &&cuda_fn) const |
基于当前设备调用函数。 更多... | |
template<typename CPUFn , typename CUDAFn , typename SYCLFn > | |
decltype(auto) | DispatchDevice (CPUFn &&cpu_fn, CUDAFn &&cuda_fn, SYCLFn &&sycl_fn) const |
为 SYCL 设备调用函数。 更多... | |
DMLC_DECLARE_PARAMETER (Context) | |
![]() | |
Args | UpdateAllowUnknown (Container const &kwargs) |
bool | GetInitialised () const |
公有属性 | |
std::int32_t | nthread {0} |
std::int64_t | seed {kDefaultSeed} |
bool | seed_per_iteration {false} |
bool | fail_on_invalid_gpu_id {false} |
bool | validate_parameters {false} |
静态公有属性 | |
static constexpr std::int64_t | kDefaultSeed = 0 |
其他继承成员 | |
![]() | |
bool | initialised_ |
XGBoost 的运行时上下文。包含线程和设备等信息。
xgboost::Context::Context | ( | ) |
void xgboost::Context::ConfigureGpuId | ( | bool | require_gpu | ) |
配置参数 ‘device’。已弃用,将在移除 gpu_id
后移除。
require_gpu | GPU 是否通过其他配置被用户显式要求。 |
CUDAContext const* xgboost::Context::CUDACtx | ( | ) | const |
获取用于分配器和流的 CUDA 设备上下文。
|
inline |
获取当前设备和序号。
|
inline |
当前设备的名称。
|
inline |
基于当前设备调用函数。
|
inline |
为 SYCL 设备调用函数。
|
inline |
void xgboost::Context::Init | ( | Args const & | kwargs | ) |
|
inline |
XGBoost 是否在 CPU 上运行?
|
inline |
XGBoost 是否在 CUDA 设备上运行?
|
inline |
XGBoost 是否在任何 SYCL 设备上运行?
|
inline |
XGBoost 是否在 SYCL CPU 上运行?
|
inline |
XGBoost 是否在默认 SYCL 设备上运行?
|
inline |
XGBoost 是否在 SYCL GPU 上运行?
|
inline |
基于当前上下文创建 CPU 上下文。
|
inline |
基于当前上下文创建 CUDA 上下文。
ordinal | CUDA 设备序号。 |
|
inline |
获取 CUDA 设备序号。如果 XGBoost 在 CPU 上运行,则为 -1。
std::int32_t xgboost::Context::Threads | ( | ) | const |
返回基于 nthread
参数和系统设置自动选择的线程数。
|
inline |
bool xgboost::Context::fail_on_invalid_gpu_id {false} |
|
staticconstexpr |
std::int32_t xgboost::Context::nthread {0} |
std::int64_t xgboost::Context::seed {kDefaultSeed} |
bool xgboost::Context::seed_per_iteration {false} |
bool xgboost::Context::validate_parameters {false} |