| 290 | } |
| 291 | |
| 292 | void NodeDeviceDescriptor::Serialize(std::string* serialized) const { |
| 293 | nlohmann::json json_object; |
| 294 | json_object[kJsonKeyHostMemorySize] = impl_->host_memory_size_bytes; |
| 295 | for (const auto& pair : impl_->class_name2descriptor_list) { |
| 296 | std::string serialized_descriptor_list; |
| 297 | auto clz = DeviceDescriptorClass::GetRegisteredClass(pair.first); |
| 298 | CHECK(clz); |
| 299 | clz->SerializeDeviceDescriptorList(pair.second, &serialized_descriptor_list); |
| 300 | json_object[kJsonKeyClasses].push_back( |
| 301 | {{kJsonKeyClassName, clz->Name()}, |
| 302 | {kJsonKeySerializedDescriptorList, serialized_descriptor_list}}); |
| 303 | } |
| 304 | std::string serialized_topology; |
| 305 | SerializeTopologyDescriptor(impl_->topology, &serialized_topology); |
| 306 | json_object[kJsonKeyTopology] = serialized_topology; |
| 307 | *serialized = json_object.dump(); |
| 308 | } |
| 309 | |
| 310 | void NodeDeviceDescriptor::DumpSummary(const std::string& path) const { |
| 311 | std::string classes_base = JoinPath(path, "classes"); |
no test coverage detected