From a94839d7910dc5dfa4b6cde20445b1d5a2fa53b8 Mon Sep 17 00:00:00 2001 From: Akshay Modi Date: Wed, 12 Feb 2020 15:35:22 -0800 Subject: [PATCH] Make "share_cluster_devices_in_session" non experimental. PiperOrigin-RevId: 294773227 Change-Id: Ib71d36f09e7e0fde3b5afe6710b9011d39445ede --- tensorflow/core/common_runtime/colocation_graph.cc | 3 +-- .../core/distributed_runtime/master_session.cc | 13 ++++++++++++- tensorflow/core/protobuf/config.proto | 14 +++++++++----- .../python/kernel_tests/functional_ops_test.py | 2 +- .../api/golden/v1/tensorflow.-config-proto.pbtxt | 6 ++++++ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/tensorflow/core/common_runtime/colocation_graph.cc b/tensorflow/core/common_runtime/colocation_graph.cc index f4712d29770..a2527b2bc2f 100644 --- a/tensorflow/core/common_runtime/colocation_graph.cc +++ b/tensorflow/core/common_runtime/colocation_graph.cc @@ -1280,8 +1280,7 @@ Status ColocationGraph::InitializeMemberWithAssignedDevice( "available on this machine: [", absl::StrJoin(DevicesToString(device_set_.devices()), ", "), "].", "If you are seeing this error when running using a tf.Session, set " - "experimental.share_cluster_devices_in_session to true in the " - "tf.ConfigProto."); + "share_cluster_devices_in_session to true in the tf.ConfigProto."); } for (const auto& d : member->supported_device_types()) { diff --git a/tensorflow/core/distributed_runtime/master_session.cc b/tensorflow/core/distributed_runtime/master_session.cc index 897efc0df9f..4eeb04490a1 100644 --- a/tensorflow/core/distributed_runtime/master_session.cc +++ b/tensorflow/core/distributed_runtime/master_session.cc @@ -1319,12 +1319,23 @@ Status MasterSession::CreateWorkerSessions( workers[i].name = &worker_names[i]; workers[i].worker = worker_cache->GetOrCreateWorker(worker_names[i]); workers[i].request.set_session_handle(handle_); - if (session_opts_.config.experimental() + if (session_opts_.config.share_cluster_devices_in_session() || + session_opts_.config.experimental() .share_cluster_devices_in_session()) { for (const auto& remote_dev : devices_->devices()) { *workers[i].request.add_cluster_device_attributes() = remote_dev->attributes(); } + + if (!session_opts_.config.share_cluster_devices_in_session() && + session_opts_.config.experimental() + .share_cluster_devices_in_session()) { + LOG(WARNING) + << "ConfigProto.Experimental.share_cluster_devices_in_session has " + "been promoted to a non-experimental API. Please use " + "ConfigProto.share_cluster_devices_in_session instead. The " + "experimental option will be removed in the future."; + } } DeviceNameUtils::ParsedName name; diff --git a/tensorflow/core/protobuf/config.proto b/tensorflow/core/protobuf/config.proto index e3c2bcdf6b4..93f350f4c30 100644 --- a/tensorflow/core/protobuf/config.proto +++ b/tensorflow/core/protobuf/config.proto @@ -467,6 +467,12 @@ message ConfigProto { // enabled, this field is ignored and sessions are always isolated. bool isolate_session_state = 15; + // When true, WorkerSessions are created with device attributes from the + // full cluster. + // This is helpful when a worker wants to partition a graph + // (for example during a PartitionedCallOp). + bool share_cluster_devices_in_session = 17; + // Everything inside Experimental is subject to change and is not subject // to API stability guarantees in // https://www.tensorflow.org/guide/version_compat. @@ -530,10 +536,8 @@ message ConfigProto { // CPU usage. bool disable_thread_spinning = 9; - // When true, WorkerSessions are created with device attributes from the - // full cluster. - // This is helpful when a worker wants to partition a graph - // (for example during a PartitionedCallOp). + // This was promoted to a non-experimental API. Please use + // ConfigProto.share_cluster_devices_in_session instead. bool share_cluster_devices_in_session = 10; // Metadata about the session. @@ -582,7 +586,7 @@ message ConfigProto { Experimental experimental = 16; - // Next: 17 + // Next: 18 } // Options for a single Run() call. diff --git a/tensorflow/python/kernel_tests/functional_ops_test.py b/tensorflow/python/kernel_tests/functional_ops_test.py index 317911eec8d..cc1cfd57c18 100644 --- a/tensorflow/python/kernel_tests/functional_ops_test.py +++ b/tensorflow/python/kernel_tests/functional_ops_test.py @@ -993,7 +993,7 @@ class PartitionedCallTest(test.TestCase): sess.run(variables.global_variables_initializer()) config = config_pb2.ConfigProto() - config.experimental.share_cluster_devices_in_session = True + config.share_cluster_devices_in_session = True with session.Session(workers[0].target, config=config) as sess: res = sess.run(f(a, b)) diff --git a/tensorflow/tools/api/golden/v1/tensorflow.-config-proto.pbtxt b/tensorflow/tools/api/golden/v1/tensorflow.-config-proto.pbtxt index 2802a584421..1309eb79938 100644 --- a/tensorflow/tools/api/golden/v1/tensorflow.-config-proto.pbtxt +++ b/tensorflow/tools/api/golden/v1/tensorflow.-config-proto.pbtxt @@ -98,6 +98,12 @@ tf_proto { label: LABEL_OPTIONAL type: TYPE_BOOL } + field { + name: "share_cluster_devices_in_session" + number: 17 + label: LABEL_OPTIONAL + type: TYPE_BOOL + } field { name: "experimental" number: 16