Automated g4 rollback of changelist 185233116
authorGuangda Lai <laigd@google.com>
Mon, 12 Feb 2018 02:09:11 +0000 (18:09 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 12 Feb 2018 02:12:53 +0000 (18:12 -0800)
PiperOrigin-RevId: 185324160

tensorflow/core/grappler/clusters/BUILD
tensorflow/core/grappler/clusters/single_machine.cc
tensorflow/core/grappler/clusters/utils.cc
tensorflow/core/grappler/clusters/utils.h
tensorflow/core/grappler/costs/BUILD
tensorflow/core/grappler/costs/utils.cc

index b15a709..5b8ce37 100644 (file)
@@ -26,12 +26,13 @@ config_setting(
 tf_cuda_library(
     name = "utils",
     srcs = ["utils.cc"],
-    hdrs = ["utils.h"],
+    hdrs = [
+        "utils.h",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/eigen3",
         "//tensorflow/core:framework",
-        "//tensorflow/core:gpu_id",
         "//tensorflow/core:lib",
         "//tensorflow/core:protos_all_cc",
     ] + select({
@@ -103,7 +104,6 @@ cc_library(
         "//tensorflow/core:core_cpu_lib",
         "//tensorflow/core:direct_session",
         "//tensorflow/core:framework",
-        "//tensorflow/core:gpu_id",
         "//tensorflow/core:lib",
         "//tensorflow/core/grappler:utils",
         "//tensorflow/core/kernels:ops_util",
index 3e97b31..862ce4a 100644 (file)
@@ -21,7 +21,6 @@ limitations under the License.
 #include "tensorflow/cc/training/queue_runner.h"
 #include "tensorflow/core/common_runtime/device.h"
 #include "tensorflow/core/common_runtime/device_mgr.h"
-#include "tensorflow/core/common_runtime/gpu/gpu_id.h"
 #include "tensorflow/core/grappler/clusters/utils.h"
 #include "tensorflow/core/grappler/utils.h"
 #include "tensorflow/core/kernels/ops_util.h"
@@ -80,17 +79,13 @@ Status SingleMachine::Provision() {
 
   std::vector<DeviceAttributes> devices;
   TF_RETURN_IF_ERROR(session_->ListDevices(&devices));
+  int gpu_id = 0;
   for (const auto& dev : devices) {
     DeviceProperties attr;
     if (dev.device_type() == "CPU") {
       attr = GetLocalCPUInfo();
     } else if (dev.device_type() == "GPU") {
-      DeviceNameUtils::ParsedName parsed;
-      if (!DeviceNameUtils::ParseFullName(dev.name(), &parsed)) {
-        return errors::InvalidArgument(
-            strings::StrCat("Not able to parse GPU device name: ", dev.name()));
-      }
-      attr = GetLocalGPUInfo(TfGpuId(parsed.id));
+      attr = GetLocalGPUInfo(gpu_id++);
     } else {
       attr.set_type(dev.device_type());
     }
index 3e7a7a3..aacd2cc 100644 (file)
@@ -27,8 +27,6 @@ limitations under the License.
 #include "include/libxsmm.h"
 #endif
 
-#include "tensorflow/core/common_runtime/gpu/gpu_id.h"
-#include "tensorflow/core/common_runtime/gpu/gpu_id_manager.h"
 #include "tensorflow/core/lib/strings/numbers.h"
 #include "tensorflow/core/lib/strings/strcat.h"
 #include "tensorflow/core/platform/cpu_info.h"
@@ -68,14 +66,13 @@ DeviceProperties GetLocalCPUInfo() {
   return device;
 }
 
-DeviceProperties GetLocalGPUInfo(TfGpuId tf_gpu_id) {
+DeviceProperties GetLocalGPUInfo(int gpu_id) {
   DeviceProperties device;
   device.set_type("GPU");
 
 #if GOOGLE_CUDA
   cudaDeviceProp properties;
-  CudaGpuId cuda_gpu_id = GpuIdManager::TfToCudaGpuId(tf_gpu_id);
-  cudaError_t error = cudaGetDeviceProperties(&properties, cuda_gpu_id.value());
+  cudaError_t error = cudaGetDeviceProperties(&properties, gpu_id);
   if (error == cudaSuccess) {
     device.set_vendor("NVidia");
     device.set_model(properties.name);
@@ -97,10 +94,6 @@ DeviceProperties GetLocalGPUInfo(TfGpuId tf_gpu_id) {
     // double data rate (DDR).
     device.set_bandwidth(properties.memoryBusWidth / 8 *
                          properties.memoryClockRate * 2);
-  } else {
-    LOG(ERROR) << "Failed to get device properties, error code: " << error;
-    device.set_type("UNKNOWN");
-    return device;
   }
 
   (*device.mutable_environment())["architecture"] =
@@ -117,9 +110,9 @@ DeviceProperties GetDeviceInfo(const DeviceNameUtils::ParsedName& device) {
     return GetLocalCPUInfo();
   } else if (device.type == "GPU") {
     if (device.has_id) {
-      return GetLocalGPUInfo(TfGpuId(device.id));
+      return GetLocalGPUInfo(device.id);
     } else {
-      return GetLocalGPUInfo(TfGpuId(0));
+      return GetLocalGPUInfo(0);
     }
   }
   DeviceProperties result;
index 4ea7e98..1919420 100644 (file)
@@ -16,7 +16,6 @@ limitations under the License.
 #ifndef TENSORFLOW_GRAPPLER_CLUSTERS_UTILS_H_
 #define TENSORFLOW_GRAPPLER_CLUSTERS_UTILS_H_
 
-#include "tensorflow/core/common_runtime/gpu/gpu_id.h"
 #include "tensorflow/core/protobuf/device_properties.pb.h"
 #include "tensorflow/core/util/device_name_utils.h"
 
@@ -28,7 +27,7 @@ DeviceProperties GetLocalCPUInfo();
 
 // Returns the DeviceProperties for the specified GPU attached to the server on
 // which grappler is running.
-DeviceProperties GetLocalGPUInfo(TfGpuId tf_gpu_id);
+DeviceProperties GetLocalGPUInfo(int gpu_id);
 
 // Returns the DeviceProperties of the specified device
 DeviceProperties GetDeviceInfo(const DeviceNameUtils::ParsedName& device);
index 5336df1..0fe01e9 100644 (file)
@@ -142,7 +142,6 @@ tf_cuda_library(
         "//third_party/eigen3",
         "//tensorflow/core:framework",
         "//tensorflow/core:graph",
-        "//tensorflow/core:gpu_id",
         "//tensorflow/core:lib",
         "//tensorflow/core:lib_proto_parsing",
         "//tensorflow/core:protos_all_cc",
index ac30090..602f69f 100644 (file)
@@ -26,7 +26,6 @@ limitations under the License.
 #include "cuda/include/cudnn.h"
 #endif
 
-#include "tensorflow/core/common_runtime/gpu/gpu_id.h"
 #include "tensorflow/core/framework/allocation_description.pb.h"
 #include "tensorflow/core/framework/attr_value.pb.h"
 #include "tensorflow/core/framework/op.h"
@@ -204,7 +203,7 @@ DeviceProperties GetDeviceInfo(const string& device_str) {
   DeviceNameUtils::ParsedName parsed;
   if (DeviceNameUtils::ParseFullName(device_str, &parsed)) {
     if (parsed.type == "GPU") {
-      return GetLocalGPUInfo(TfGpuId(parsed.id));
+      return GetLocalGPUInfo(parsed.id);
     } else if (parsed.type == "CPU") {
       return GetLocalCPUInfo();
     }