Make "share_cluster_devices_in_session" non experimental.

PiperOrigin-RevId: 294773227
Change-Id: Ib71d36f09e7e0fde3b5afe6710b9011d39445ede
This commit is contained in:
Akshay Modi 2020-02-12 15:35:22 -08:00 committed by TensorFlower Gardener
parent 057e8630bc
commit a94839d791
5 changed files with 29 additions and 9 deletions

View File

@ -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()) {

View File

@ -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;

View File

@ -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.

View File

@ -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))

View File

@ -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