55 Device(
const std::string& device_type,
int device_id)
56 :
Device(device_type +
":" +
std::to_string(device_id)) {}
59 Device(
const std::string& type_colon_id)
101 std::vector<std::string> tokens;
103 if (tokens.size() == 2) {
105 if (device_name_lower ==
"cpu") {
107 }
else if (device_name_lower ==
"cuda") {
118 std::vector<std::string> tokens;
120 if (tokens.size() == 2) {
121 return std::stoi(tokens[1]);
void LogError(const char *format, const Args &... args)
Definition: Console.h:174
Definition: RendererHandle.h:165
static int StringToDeviceId(const std::string &type_colon_id)
Definition: Device.h:117
Device()
Defalut constructor.
Definition: Device.h:44
Device(DeviceType device_type, int device_id)
Constructor with device specified.
Definition: Device.h:49
Device(const std::string &type_colon_id)
Constructor from string, e.g. "CUDA:0".
Definition: Device.h:59
int device_id_
Definition: Device.h:129
Device(const std::string &device_type, int device_id)
Constructor from device type string and device id.
Definition: Device.h:55
DeviceType device_type_
Definition: Device.h:128
std::string ToString() const
Definition: Device.h:72
Definition: Open3DViewer.h:29
bool operator!=(const Device &other) const
Definition: Device.h:70
void SplitString(std::vector< std::string > &tokens, const std::string &str, const std::string &delimiters, bool trim_empty_str)
Definition: Helper.cpp:43
DeviceType GetType() const
Definition: Device.h:88
DeviceType
Type for device.
Definition: Device.h:41
static DeviceType StringToDeviceType(const std::string &type_colon_id)
Definition: Device.h:100
int GetID() const
Definition: Device.h:90
void AssertCPUDeviceIDIsZero()
Definition: Device.h:93
bool operator==(const Device &other) const
Definition: Device.h:65
std::string ToLower(const std::string &str)
Convet string to the lower case.
Definition: Helper.cpp:72