From: Guangda Lai Date: Mon, 12 Feb 2018 02:09:11 +0000 (-0800) Subject: Automated g4 rollback of changelist 185233116 X-Git-Tag: upstream/v1.7.0~31^2~800 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2787540cf596df5da80dddec093210fc61ba7f77;p=platform%2Fupstream%2Ftensorflow.git Automated g4 rollback of changelist 185233116 PiperOrigin-RevId: 185324160 --- diff --git a/tensorflow/core/grappler/clusters/BUILD b/tensorflow/core/grappler/clusters/BUILD index b15a709..5b8ce37 100644 --- a/tensorflow/core/grappler/clusters/BUILD +++ b/tensorflow/core/grappler/clusters/BUILD @@ -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", diff --git a/tensorflow/core/grappler/clusters/single_machine.cc b/tensorflow/core/grappler/clusters/single_machine.cc index 3e97b31..862ce4a 100644 --- a/tensorflow/core/grappler/clusters/single_machine.cc +++ b/tensorflow/core/grappler/clusters/single_machine.cc @@ -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 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()); } diff --git a/tensorflow/core/grappler/clusters/utils.cc b/tensorflow/core/grappler/clusters/utils.cc index 3e7a7a3..aacd2cc 100644 --- a/tensorflow/core/grappler/clusters/utils.cc +++ b/tensorflow/core/grappler/clusters/utils.cc @@ -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; diff --git a/tensorflow/core/grappler/clusters/utils.h b/tensorflow/core/grappler/clusters/utils.h index 4ea7e98..1919420 100644 --- a/tensorflow/core/grappler/clusters/utils.h +++ b/tensorflow/core/grappler/clusters/utils.h @@ -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); diff --git a/tensorflow/core/grappler/costs/BUILD b/tensorflow/core/grappler/costs/BUILD index 5336df1..0fe01e9 100644 --- a/tensorflow/core/grappler/costs/BUILD +++ b/tensorflow/core/grappler/costs/BUILD @@ -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", diff --git a/tensorflow/core/grappler/costs/utils.cc b/tensorflow/core/grappler/costs/utils.cc index ac30090..602f69f 100644 --- a/tensorflow/core/grappler/costs/utils.cc +++ b/tensorflow/core/grappler/costs/utils.cc @@ -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(); }