| 241 | } |
| 242 | |
| 243 | DeviceProperties 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 | |
| 265 | DeviceProperties GetDeviceInfo(const CostGraphDef::Node& node) { |
| 266 | return GetDeviceInfo(node.device()); |
no test coverage detected