• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_C_EAGER_immediate_execution_distributed_manager_H_
17 #define TENSORFLOW_C_EAGER_immediate_execution_distributed_manager_H_
18 
19 #include "tensorflow/core/platform/status.h"
20 
21 namespace tensorflow {
22 class ImmediateExecutionContext;
23 class ServerDef;
24 
25 class ImmediateExecutionDistributedManager {
26  public:
~ImmediateExecutionDistributedManager()27   virtual ~ImmediateExecutionDistributedManager() {}
28 
29   // Set up distributed execution environment on local and remote tasks.
30   // When `reset_context` is true, initialize new cluster context state based on
31   // cluster configurations provided in `server_def`; otherwise, update existing
32   // context state with the provided `server_def`.
33   // Contexts created on remote tasks will be considered stale and garbage
34   // collected after `keep_alive_secs` of inactivity.
35   virtual Status SetOrUpdateServerDef(const ServerDef& server_def,
36                                       bool reset_context,
37                                       int keep_alive_secs) = 0;
38 
39   // Set up a multi-client distributed execution environment. Must be called on
40   // all tasks in the cluster.
41   // This call internally coordinates with other tasks to initialize the eager
42   // context and TF server for multi-client execution.
43   virtual Status EnableCollectiveOps(const ServerDef& server_def) = 0;
44 
45   // Check if the remote task is alive.
46   virtual Status CheckRemoteAlive(const std::string& remote_task_name,
47                                   bool* is_alive) = 0;
48 };
49 }  // namespace tensorflow
50 
51 #endif  // TENSORFLOW_C_EAGER_immediate_execution_distributed_manager_H_
52