Open3D (C++ API)
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
open3d::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::Device::Device ( )
inline

Defalut constructor.

◆ Device() [2/4]

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

Constructor with device specified.

◆ Device() [3/4]

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

Constructor from device type string and device id.

◆ Device() [4/4]

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

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

Member Function Documentation

◆ AssertCPUDeviceIDIsZero()

void open3d::Device::AssertCPUDeviceIDIsZero ( )
inlineprotected

◆ GetID()

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

◆ GetType()

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

◆ operator!=()

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

◆ operator==()

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

◆ StringToDeviceId()

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

◆ StringToDeviceType()

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

◆ ToString()

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

Field Documentation

◆ device_id_

int open3d::Device::device_id_
protected

◆ device_type_

DeviceType open3d::Device::device_type_
protected

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