aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/training/coordinator.h
diff options
context:
space:
mode:
authorGravatar Yuefeng Zhou <yuefengz@google.com>2017-03-17 12:17:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-17 13:35:23 -0700
commit547a5402823feec97f321424450096c88ffd36e9 (patch)
tree59eed97bfe1da2023e8738426f170386fdc8ee9a /tensorflow/cc/training/coordinator.h
parentca170f34d9174d6981850855190a398393aa921e (diff)
Add ExportRunMetadata in queue runner and ExportCostGraph in coordinator.
Make the queue runner own the metadata and mutex. Change: 150475730
Diffstat (limited to 'tensorflow/cc/training/coordinator.h')
-rw-r--r--tensorflow/cc/training/coordinator.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/tensorflow/cc/training/coordinator.h b/tensorflow/cc/training/coordinator.h
index 1b107e2d06..632418c5ca 100644
--- a/tensorflow/cc/training/coordinator.h
+++ b/tensorflow/cc/training/coordinator.h
@@ -21,19 +21,24 @@ limitations under the License.
#include <unordered_set>
#include <vector>
+#include "tensorflow/core/framework/cost_graph.pb.h"
#include "tensorflow/core/lib/core/error_codes.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/mutex.h"
+#include "tensorflow/core/protobuf/config.pb.h"
namespace tensorflow {
-/// The abstract interface for runners which must implement the Join function.
+/// The abstract interface for runners which must implement the Join and the
+/// IsRunning function.
class RunnerInterface {
public:
virtual ~RunnerInterface() {}
virtual Status Join() = 0;
-
+ virtual Status ExportRunMetadata(RunMetadata* metadata) const {
+ return Status(error::INVALID_ARGUMENT, "No RunMetadata to export.");
+ }
/// Returns true iff the runner is running, i.e. if it is trying to populate
/// its queue.
virtual bool IsRunning() const = 0;
@@ -101,6 +106,9 @@ class Coordinator {
/// RequestStop() is called.
void WaitForStop();
+ // Returns the cost graph from stored run metadata in registered runners.
+ Status ExportCostGraph(CostGraphDef* cost_graph) const;
+
private:
std::unordered_set<int> clean_stop_errors_;
condition_variable wait_for_stop_;
@@ -111,7 +119,7 @@ class Coordinator {
mutex status_lock_;
Status status_ GUARDED_BY(status_lock_);
- mutex runners_lock_;
+ mutable mutex runners_lock_;
std::vector<std::unique_ptr<RunnerInterface>> runners_
GUARDED_BY(runners_lock_);