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

Function GetDeviceInfo

tensorflow/core/grappler/costs/utils.cc:243–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243DeviceProperties GetDeviceInfo(const string& device_str) {
244 DeviceProperties unknown;
245 unknown.set_type("UNKNOWN");
246
247 DeviceNameUtils::ParsedName parsed;
248 if (DeviceNameUtils::ParseFullName(device_str, &parsed)) {
249 if (parsed.type == "GPU") {
250 TfGpuId tf_gpu_id(parsed.id);
251 PlatformGpuId platform_gpu_id;
252 Status s = GpuIdManager::TfToPlatformGpuId(tf_gpu_id, &platform_gpu_id);
253 if (!s.ok()) {
254 // We are probably running simulation without linking cuda libraries.
255 platform_gpu_id = PlatformGpuId(parsed.id);
256 }
257 return GetLocalGPUInfo(platform_gpu_id);
258 } else if (parsed.type == "CPU") {
259 return GetLocalCPUInfo();
260 }
261 }
262 return unknown;
263}
264
265DeviceProperties GetDeviceInfo(const CostGraphDef::Node& node) {
266 return GetDeviceInfo(node.device());

Callers 2

Calls 5

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

Tested by

no test coverage detected