1/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15#ifndef TENSORFLOW_CORE_GRAPH_COLLECTIVE_ORDER_H_
16#define TENSORFLOW_CORE_GRAPH_COLLECTIVE_ORDER_H_
17
18#include "tensorflow/core/graph/graph.h"
19
20namespace tensorflow {
21
22enum class GraphCollectiveOrder { kNone, kEdges, kAttrs };
23
24// Introduces a deterministic execution order between potentially concurrent
25// CollectiveOps. This may be used to execute collectives in the same order
26// across all workers in a distributed execution, if all workers are executing
27// the same graph.
28// If `order_type` is `kEdges`, introduce the ordering in the form of explicit
29// control edges between collective graph nodes. If `order_type` is `kAttrs`,
30// add an attribute to the node which may be used by collective executor to
31// ensure the required ordering.
32Status OrderCollectives(Graph* graph, GraphCollectiveOrder order_type);
33
34} // namespace tensorflow
35
36#endif // TENSORFLOW_CORE_GRAPH_COLLECTIVE_ORDER_H_
37