xgboost
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
xgboost::DeviceOrd Struct Reference

A type for device ordinal. The type is packed into 32-bit for efficient use in viewing types like linalg::TensorView. More...

#include <context.h>

Collaboration diagram for xgboost::DeviceOrd:
Collaboration graph

Public Types

enum  Type : std::int16_t { kCPU = 0 , kCUDA = 1 }
 

Public Member Functions

bool IsCUDA () const
 
bool IsCPU () const
 
 DeviceOrd ()=default
 
constexpr DeviceOrd (Type type, bst_d_ordinal_t ord)
 
 DeviceOrd (DeviceOrd const &that)=default
 
DeviceOrdoperator= (DeviceOrd const &that)=default
 
 DeviceOrd (DeviceOrd &&that)=default
 
DeviceOrdoperator= (DeviceOrd &&that)=default
 
bool operator== (DeviceOrd const &that) const
 
bool operator!= (DeviceOrd const &that) const
 
std::string Name () const
 Get a string representation of the device and the ordinal. More...
 

Static Public Member Functions

constexpr static auto CPU ()
 Constructor for CPU. More...
 
static auto CUDA (bst_d_ordinal_t ordinal)
 Constructor for CUDA device. More...
 

Public Attributes

enum xgboost::DeviceOrd::Type kCPU
 
bst_d_ordinal_t ordinal {-1}
 

Detailed Description

A type for device ordinal. The type is packed into 32-bit for efficient use in viewing types like linalg::TensorView.

Member Enumeration Documentation

◆ Type

enum xgboost::DeviceOrd::Type : std::int16_t
Enumerator
kCPU 
kCUDA 

Constructor & Destructor Documentation

◆ DeviceOrd() [1/4]

xgboost::DeviceOrd::DeviceOrd ( )
default

◆ DeviceOrd() [2/4]

constexpr xgboost::DeviceOrd::DeviceOrd ( Type  type,
bst_d_ordinal_t  ord 
)
inlineconstexpr

◆ DeviceOrd() [3/4]

xgboost::DeviceOrd::DeviceOrd ( DeviceOrd const &  that)
default

◆ DeviceOrd() [4/4]

xgboost::DeviceOrd::DeviceOrd ( DeviceOrd &&  that)
default

Member Function Documentation

◆ CPU()

constexpr static auto xgboost::DeviceOrd::CPU ( )
inlinestaticconstexpr

Constructor for CPU.

◆ CUDA()

static auto xgboost::DeviceOrd::CUDA ( bst_d_ordinal_t  ordinal)
inlinestatic

Constructor for CUDA device.

Parameters
ordinalCUDA device ordinal.

◆ IsCPU()

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

◆ IsCUDA()

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

◆ Name()

std::string xgboost::DeviceOrd::Name ( ) const
inline

Get a string representation of the device and the ordinal.

◆ operator!=()

bool xgboost::DeviceOrd::operator!= ( DeviceOrd const &  that) const
inline

◆ operator=() [1/2]

DeviceOrd& xgboost::DeviceOrd::operator= ( DeviceOrd &&  that)
default

◆ operator=() [2/2]

DeviceOrd& xgboost::DeviceOrd::operator= ( DeviceOrd const &  that)
default

◆ operator==()

bool xgboost::DeviceOrd::operator== ( DeviceOrd const &  that) const
inline

Member Data Documentation

◆ kCPU

enum xgboost::DeviceOrd::Type xgboost::DeviceOrd::kCPU

◆ ordinal

bst_d_ordinal_t xgboost::DeviceOrd::ordinal {-1}

The documentation for this struct was generated from the following file: