|
xgboost
|
Runtime context for XGBoost. Contains information like threads and device. More...
#include <context.h>


Public Member Functions | |
| Context () | |
| void | Init (Args const &kwargs) |
| template<typename Container > | |
| Args | UpdateAllowUnknown (Container const &kwargs) |
| std::int32_t | Threads () const |
Returns the automatically chosen number of threads based on the nthread parameter and the system settting. More... | |
| bool | IsCPU () const |
| Is XGBoost running on CPU? More... | |
| bool | IsCUDA () const |
| Is XGBoost running on a CUDA device? More... | |
| bool | IsSyclDefault () const |
| Is XGBoost running on the default SYCL device? More... | |
| bool | IsSyclCPU () const |
| Is XGBoost running on a SYCL CPU? More... | |
| bool | IsSyclGPU () const |
| Is XGBoost running on a SYCL GPU? More... | |
| bool | IsSycl () const |
| Is XGBoost running on any SYCL device? More... | |
| DeviceOrd | Device () const |
| Get the current device and ordinal. More... | |
| DeviceOrd | DeviceFP64 () const |
| Get the current device and ordinal, if it supports fp64, otherwise returns default CPU. More... | |
| bst_d_ordinal_t | Ordinal () const |
| Get the CUDA device ordinal. -1 if XGBoost is running on CPU. More... | |
| std::string | DeviceName () const |
| Name of the current device. More... | |
| CUDAContext const * | CUDACtx () const |
| Get a CUDA device context for allocator and stream. More... | |
| RandomEngine & | Rng () const |
| Get the random engine. More... | |
| Json | ToJson () const |
| void | FromJson (Json const &in) |
| Context | MakeCUDA (bst_d_ordinal_t ordinal=0) const |
| Make a CUDA context based on the current context. More... | |
| Context | MakeCPU () const |
| Make a CPU context based on the current context. More... | |
| template<typename CPUFn , typename CUDAFn > | |
| decltype(auto) | DispatchDevice (CPUFn &&cpu_fn, CUDAFn &&cuda_fn) const |
| Call function based on the current device. More... | |
| template<typename CPUFn , typename CUDAFn , typename SYCLFn > | |
| decltype(auto) | DispatchDevice (CPUFn &&cpu_fn, CUDAFn &&cuda_fn, SYCLFn &&sycl_fn) const |
| Call function for sycl devices. More... | |
| DMLC_DECLARE_PARAMETER (Context) | |
Public Member Functions inherited from xgboost::XGBoostParameter< Context > | |
| Args | UpdateAllowUnknown (Container const &kwargs) |
| bool | GetInitialised () const |
Public Attributes | |
| 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 Public Attributes | |
| static constexpr std::int64_t | kDefaultSeed = 0 |
Additional Inherited Members | |
Protected Attributes inherited from xgboost::XGBoostParameter< Context > | |
| bool | initialised_ |
Runtime context for XGBoost. Contains information like threads and device.
| xgboost::Context::Context | ( | ) |
| CUDAContext const* xgboost::Context::CUDACtx | ( | ) | const |
Get a CUDA device context for allocator and stream.
|
inline |
Get the current device and ordinal.
| DeviceOrd xgboost::Context::DeviceFP64 | ( | ) | const |
Get the current device and ordinal, if it supports fp64, otherwise returns default CPU.
|
inline |
Name of the current device.
|
inline |
Call function based on the current device.
|
inline |
Call function for sycl devices.
|
inline |
| void xgboost::Context::FromJson | ( | Json const & | in | ) |
| void xgboost::Context::Init | ( | Args const & | kwargs | ) |
|
inline |
Is XGBoost running on CPU?
|
inline |
Is XGBoost running on a CUDA device?
|
inline |
Is XGBoost running on any SYCL device?
|
inline |
Is XGBoost running on a SYCL CPU?
|
inline |
Is XGBoost running on the default SYCL device?
|
inline |
Is XGBoost running on a SYCL GPU?
|
inline |
Make a CPU context based on the current context.
|
inline |
Make a CUDA context based on the current context.
| ordinal | The CUDA device ordinal. |
|
inline |
Get the CUDA device ordinal. -1 if XGBoost is running on CPU.
|
inline |
Get the random engine.
| std::int32_t xgboost::Context::Threads | ( | ) | const |
Returns the automatically chosen number of threads based on the nthread parameter and the system settting.
| Json xgboost::Context::ToJson | ( | ) | const |
|
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} |