mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-12 06:44:55 +08:00
Update
[ghstack-poisoned]
This commit is contained in:
@ -296,13 +296,12 @@ static void registerXpuDeviceProperties(PyObject* module) {
|
||||
};
|
||||
#endif
|
||||
|
||||
auto m = py::handle(module).cast<py::module>();
|
||||
|
||||
// Wrapper class for XPU UUID
|
||||
struct XPUuuid {
|
||||
XPUuuid(const std::array<unsigned char, 16>& uuid) : bytes(uuid) {}
|
||||
const std::array<unsigned char, 16> bytes;
|
||||
const std::array<unsigned char, 16>& bytes{};
|
||||
};
|
||||
auto m = py::handle(module).cast<py::module>();
|
||||
|
||||
py::class_<XPUuuid>(m, "_XPUuuid")
|
||||
.def_property_readonly(
|
||||
@ -347,10 +346,7 @@ static void registerXpuDeviceProperties(PyObject* module) {
|
||||
.def_property_readonly("type", get_device_type)
|
||||
.def_property_readonly(
|
||||
"uuid",
|
||||
[](const DeviceProp& prop) -> XPUuuid {
|
||||
XPUuuid uuid(prop.uuid);
|
||||
return uuid;
|
||||
})
|
||||
[](const DeviceProp& prop) -> XPUuuid { return XPUuuid(prop.uuid); })
|
||||
.def(
|
||||
"__repr__",
|
||||
[&get_device_type, &gpu_subslice_count](const DeviceProp& prop) {
|
||||
@ -358,10 +354,9 @@ static void registerXpuDeviceProperties(PyObject* module) {
|
||||
stream << "_XpuDeviceProperties(name='" << prop.name
|
||||
<< "', platform_name='" << prop.platform_name << "', type='"
|
||||
<< get_device_type(prop) << "', device_id=0x" << std::hex
|
||||
<< std::uppercase << prop.device_id << std::dec
|
||||
<< ", uuid="
|
||||
// << uuid_to_string(
|
||||
// reinterpret_cast<const char*>(prop.uuid.data()))
|
||||
<< std::uppercase << prop.device_id << std::dec << ", uuid="
|
||||
<< uuid_to_string(
|
||||
reinterpret_cast<const char*>(prop.uuid.data()))
|
||||
<< ", driver_version='" << prop.driver_version
|
||||
<< "', total_memory="
|
||||
<< prop.global_mem_size / (1024ull * 1024) << "MB"
|
||||
|
||||
Reference in New Issue
Block a user