MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetDeviceInfo

Function GetDeviceInfo

tensorflow/core/grappler/clusters/utils.cc:151–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151DeviceProperties GetDeviceInfo(const DeviceNameUtils::ParsedName& device) {
152 DeviceProperties unknown;
153 unknown.set_type("UNKNOWN");
154
155 if (device.type == "CPU") {
156 return GetLocalCPUInfo();
157 } else if (device.type == "GPU") {
158 if (device.has_id) {
159 TfGpuId tf_gpu_id(device.id);
160 PlatformGpuId platform_gpu_id;
161 Status s = GpuIdManager::TfToPlatformGpuId(tf_gpu_id, &platform_gpu_id);
162 if (!s.ok()) {
163 LOG(ERROR) << s;
164 return unknown;
165 }
166 return GetLocalGPUInfo(platform_gpu_id);
167 } else {
168 return GetLocalGPUInfo(PlatformGpuId(0));
169 }
170 }
171 return unknown;
172}
173
174} // end namespace grappler
175} // end namespace tensorflow

Callers 2

TESTFunction · 0.70
VirtualClusterMethod · 0.70

Calls 4

GetLocalCPUInfoFunction · 0.85
TfToPlatformGpuIdFunction · 0.85
GetLocalGPUInfoFunction · 0.85
okMethod · 0.45

Tested by 1

TESTFunction · 0.56