aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/distributed_runtime
diff options
context:
space:
mode:
authorGravatar Derek Murray <mrry@google.com>2018-04-19 20:00:21 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-19 20:03:04 -0700
commit4ef9de422d452683ac661d3a6313aeb2972b836d (patch)
tree90be0a9a685047f3fd20cb6ced0a05b2a467693a /tensorflow/core/distributed_runtime
parent8723770b4cbcac0a528354d8508a5ef83716d1fa (diff)
Always include the local worker in the list of filtered targets.
It is currently legal to specify a device filter that doesn't include the local worker. In that case, the MasterSession includes all local devices regardless of the filter. This change extends this behavior to the list of filtered workers, which will be crucial for backwards compatibility when we enable CreateWorkerSession for all MasterSessions, because we need to call CreateWorkerSession on all potential workers. PiperOrigin-RevId: 193613313
Diffstat (limited to 'tensorflow/core/distributed_runtime')
-rw-r--r--tensorflow/core/distributed_runtime/master.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/core/distributed_runtime/master.cc b/tensorflow/core/distributed_runtime/master.cc
index 288656e7f8..e60386fd34 100644
--- a/tensorflow/core/distributed_runtime/master.cc
+++ b/tensorflow/core/distributed_runtime/master.cc
@@ -167,13 +167,16 @@ class DeviceFinder {
}
// Enumerates all known workers' target. A target name is a
// prefix of a device name. E.g., /job:mnist/replica:0/task:10.
+ CHECK_GT(env_->local_devices.size(), 0) << "No local devices provided.";
+ const string& local_device_name = env_->local_devices[0]->name();
std::vector<string> workers;
worker_cache->ListWorkers(&workers);
if (filters_.empty()) {
std::swap(workers, targets_);
} else {
for (const string& name : workers) {
- if (MatchFilters(name)) {
+ if (MatchFilters(name) ||
+ DeviceNameUtils::IsSameAddressSpace(name, local_device_name)) {
targets_.push_back(name);
}
}