Open3D (C++ API)  0.11.0
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
open3d::core::Device Class Reference

#include <Device.h>

Public Types

enum  DeviceType { DeviceType::CPU = 0, DeviceType::CUDA = 1 }
 Type for device. More...
 

Public Member Functions

 Device ()
 Defalut constructor. More...
 
 Device (DeviceType device_type, int device_id)
 Constructor with device specified. More...
 
 Device (const std::string &device_type, int device_id)
 Constructor from device type string and device id. More...
 
 Device (const std::string &type_colon_id)
 Constructor from string, e.g. "CUDA:0". More...
 
bool operator== (const Device &other) const
 
bool operator!= (const Device &other) const
 
std::string ToString () const
 
DeviceType GetType () const
 
int GetID () const
 

Protected Member Functions

void AssertCPUDeviceIDIsZero ()
 

Static Protected Member Functions

static DeviceType StringToDeviceType (const std::string &type_colon_id)
 
static int StringToDeviceId (const std::string &type_colon_id)
 

Protected Attributes

DeviceType device_type_
 
int device_id_
 

Detailed Description

Device context specifying device type and device id. For CPU, there is only one device with id 0

Member Enumeration Documentation

◆ DeviceType

Type for device.

Enumerator
CPU 
CUDA 

Constructor & Destructor Documentation

◆ Device() [1/4]

open3d::core::Device::Device ( )
inline

Defalut constructor.

◆ Device() [2/4]

open3d::core::Device::Device ( DeviceType  device_type,
int  device_id 
)
inline

Constructor with device specified.

◆ Device() [3/4]

open3d::core::Device::Device ( const std::string &  device_type,
int  device_id 
)
inline

Constructor from device type string and device id.

◆ Device() [4/4]

open3d::core::Device::Device ( const std::string &  type_colon_id)
inline

Constructor from string, e.g. "CUDA:0".

Member Function Documentation

◆ AssertCPUDeviceIDIsZero()

void open3d::core::Device::AssertCPUDeviceIDIsZero ( )
inlineprotected

◆ GetID()

int open3d::core::Device::GetID ( ) const
inline

◆ GetType()

DeviceType open3d::core::Device::GetType ( ) const
inline

◆ operator!=()

bool open3d::core::Device::operator!= ( const Device other) const
inline

◆ operator==()

bool open3d::core::Device::operator== ( const Device other) const
inline

◆ StringToDeviceId()

static int open3d::core::Device::StringToDeviceId ( const std::string &  type_colon_id)
inlinestaticprotected

◆ StringToDeviceType()

static DeviceType open3d::core::Device::StringToDeviceType ( const std::string &  type_colon_id)
inlinestaticprotected

◆ ToString()

std::string open3d::core::Device::ToString ( ) const
inline

Field Documentation

◆ device_id_

int open3d::core::Device::device_id_
protected

◆ device_type_

DeviceType open3d::core::Device::device_type_
protected

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