diff options
author | A. Unique TensorFlower <nobody@tensorflow.org> | 2016-03-17 14:44:48 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-03-18 08:46:49 -0700 |
commit | 23c618958b19816ef3ee31b9d886dbdc8d06f4b2 (patch) | |
tree | 9cfcb24b38a9d33c0ea19998bad148d43d3807be /tensorflow/core/common_runtime/simple_placer.cc | |
parent | c23050b394898b3249161048f384998683565664 (diff) |
Patching placer to print out a list of devices when a placement cannot be made to aid debugging. This instantly answers the question: did I specify it wrong or is the device not found?
Change: 117493711
Diffstat (limited to 'tensorflow/core/common_runtime/simple_placer.cc')
-rw-r--r-- | tensorflow/core/common_runtime/simple_placer.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tensorflow/core/common_runtime/simple_placer.cc b/tensorflow/core/common_runtime/simple_placer.cc index 5414b75fff..1f4ccf7096 100644 --- a/tensorflow/core/common_runtime/simple_placer.cc +++ b/tensorflow/core/common_runtime/simple_placer.cc @@ -315,11 +315,20 @@ class ColocationGraph { device_set_->FindMatchingDevices(specified_device_name, &devices_matching_nodedef); if (devices_matching_nodedef.empty()) { + // Sometimes it is almost impossible to understand the problem + // without a list of available devices. + std::vector<string> device_names; + for (const Device* device : device_set_->devices()) { + device_names.push_back(device->name()); + } + std::sort(device_names.begin(), device_names.end()); + return errors::InvalidArgument( "Could not satisfy explicit device specification '", node->def().device(), "' because no devices matching that specification " - "are registered in this process"); + "are registered in this process; available devices: ", + str_util::Join(device_names, ", ")); } else if (specified_device_name.has_type) { return errors::InvalidArgument( "Could not satisfy explicit device specification '", |