1 /* Copyright 2016 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_CORE_DISTRIBUTED_RUNTIME_RPC_RPC_RENDEZVOUS_MGR_H_ 17 #define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_RPC_RPC_RENDEZVOUS_MGR_H_ 18 19 #include "tensorflow/core/distributed_runtime/base_rendezvous_mgr.h" 20 #include "tensorflow/core/distributed_runtime/worker_env.h" 21 #include "tensorflow/core/platform/macros.h" 22 23 namespace tensorflow { 24 25 class DeviceMgr; 26 27 // RendezvousMgr keeps track of a set of local rendezvous instances. 28 // All tensors sent by this worker are buffered in a RendezvousMgr 29 // until the tensor is received. Each global unique "step_id" 30 // corresponds to one local rendezvous instance managed by a 31 // RendezvousMgr. 32 // 33 // E.g., 34 // Rendezvous* rendez = worker_env->rendezvous_mgr->Find(0x8935); 35 // fork execution of an graph executor using "rendez" on thread 1; 36 // fork execution of another graph executor using "rendez" on thread 2; 37 // ... 38 // join threads 1 and 2; 39 // 40 // In the example above, execution in thread 1 and 2 communicates with 41 // each other by send/recv operations through the "rend". 42 // 43 // Tensors sent and recved through rendezvous managed by this 44 // RendezvousMgr must have keys generated by Rendezvous::CreateKey. 45 class RpcRendezvousMgr : public BaseRendezvousMgr { 46 public: 47 explicit RpcRendezvousMgr(const WorkerEnv* env); 48 49 protected: 50 BaseRemoteRendezvous* Create(int64 step_id, const WorkerEnv* worker_env); 51 52 private: 53 TF_DISALLOW_COPY_AND_ASSIGN(RpcRendezvousMgr); 54 }; 55 56 } // end namespace tensorflow 57 58 #endif // TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_RPC_RPC_RENDEZVOUS_MGR_H_ 59