xgboost
公有成员函数 | 公有属性 | 静态公有属性 | 所有成员列表
xgboost::Context 结构体参考

XGBoost 的运行时上下文。包含线程和设备等信息。 更多...

#include <context.h>

xgboost::Context 的继承图
Inheritance graph
xgboost::Context 的协作图
Collaboration graph

公有成员函数

 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)
 
- 继承自 xgboost::XGBoostParameter< 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
 

其他继承成员

- 继承自 xgboost::XGBoostParameter< Context > 的保护属性
bool initialised_
 

详细描述

XGBoost 的运行时上下文。包含线程和设备等信息。

构造函数和析构函数文档

◆ Context()

xgboost::Context::Context ( )

成员函数文档

◆ ConfigureGpuId()

void xgboost::Context::ConfigureGpuId ( bool  require_gpu)

配置参数 ‘device’。已弃用,将在移除 gpu_id 后移除。

参数
require_gpuGPU 是否通过其他配置被用户显式要求。

◆ CUDACtx()

CUDAContext const* xgboost::Context::CUDACtx ( ) const

获取用于分配器和流的 CUDA 设备上下文。

◆ Device()

DeviceOrd xgboost::Context::Device ( ) const
inline

获取当前设备和序号。

◆ DeviceName()

std::string xgboost::Context::DeviceName ( ) const
inline

当前设备的名称。

◆ DispatchDevice() [1/2]

template<typename CPUFn , typename CUDAFn >
decltype(auto) xgboost::Context::DispatchDevice ( CPUFn &&  cpu_fn,
CUDAFn &&  cuda_fn 
) const
inline

基于当前设备调用函数。

◆ DispatchDevice() [2/2]

template<typename CPUFn , typename CUDAFn , typename SYCLFn >
decltype(auto) xgboost::Context::DispatchDevice ( CPUFn &&  cpu_fn,
CUDAFn &&  cuda_fn,
SYCLFn &&  sycl_fn 
) const
inline

为 SYCL 设备调用函数。

◆ DMLC_DECLARE_PARAMETER()

xgboost::Context::DMLC_DECLARE_PARAMETER ( Context  )
inline

◆ Init()

void xgboost::Context::Init ( Args const &  kwargs)

◆ IsCPU()

bool xgboost::Context::IsCPU ( ) const
inline

XGBoost 是否在 CPU 上运行?

◆ IsCUDA()

bool xgboost::Context::IsCUDA ( ) const
inline

XGBoost 是否在 CUDA 设备上运行?

◆ IsSycl()

bool xgboost::Context::IsSycl ( ) const
inline

XGBoost 是否在任何 SYCL 设备上运行?

◆ IsSyclCPU()

bool xgboost::Context::IsSyclCPU ( ) const
inline

XGBoost 是否在 SYCL CPU 上运行?

◆ IsSyclDefault()

bool xgboost::Context::IsSyclDefault ( ) const
inline

XGBoost 是否在默认 SYCL 设备上运行?

◆ IsSyclGPU()

bool xgboost::Context::IsSyclGPU ( ) const
inline

XGBoost 是否在 SYCL GPU 上运行?

◆ MakeCPU()

Context xgboost::Context::MakeCPU ( ) const
inline

基于当前上下文创建 CPU 上下文。

◆ MakeCUDA()

Context xgboost::Context::MakeCUDA ( bst_d_ordinal_t  ordinal = 0) const
inline

基于当前上下文创建 CUDA 上下文。

参数
ordinalCUDA 设备序号。

◆ Ordinal()

bst_d_ordinal_t xgboost::Context::Ordinal ( ) const
inline

获取 CUDA 设备序号。如果 XGBoost 在 CPU 上运行,则为 -1。

◆ Threads()

std::int32_t xgboost::Context::Threads ( ) const

返回基于 nthread 参数和系统设置自动选择的线程数。

◆ UpdateAllowUnknown()

template<typename Container >
Args xgboost::Context::UpdateAllowUnknown ( Container const &  kwargs)
inline

成员数据文档

◆ fail_on_invalid_gpu_id

bool xgboost::Context::fail_on_invalid_gpu_id {false}

◆ kDefaultSeed

constexpr std::int64_t xgboost::Context::kDefaultSeed = 0
staticconstexpr

◆ nthread

std::int32_t xgboost::Context::nthread {0}

◆ seed

std::int64_t xgboost::Context::seed {kDefaultSeed}

◆ seed_per_iteration

bool xgboost::Context::seed_per_iteration {false}

◆ validate_parameters

bool xgboost::Context::validate_parameters {false}

此结构体的文档生成自以下文件