• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 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 #ifndef TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_RMA_DISTRIBUTED_H_
16 #define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_RMA_DISTRIBUTED_H_
17 #include "tensorflow/core/common_runtime/collective_rma_local.h"
18 #include "tensorflow/core/framework/tensor.h"
19 
20 namespace tensorflow {
21 class WorkerCacheInterface;
22 
23 // Extend CollectiveRemoteAccessLocal with access to remote peers.
24 class CollectiveRemoteAccessDistributed : public CollectiveRemoteAccessLocal {
25  public:
CollectiveRemoteAccessDistributed(const DeviceMgr * dev_mgr,DeviceResolverInterface * dev_resolver,WorkerCacheInterface * worker_cache,int64 step_id)26   CollectiveRemoteAccessDistributed(const DeviceMgr* dev_mgr,
27                                     DeviceResolverInterface* dev_resolver,
28                                     WorkerCacheInterface* worker_cache,
29                                     int64 step_id)
30       : CollectiveRemoteAccessLocal(dev_mgr, dev_resolver, step_id),
31         worker_cache_(worker_cache) {}
32 
~CollectiveRemoteAccessDistributed()33   ~CollectiveRemoteAccessDistributed() override {}
34 
35   void RecvFromPeer(const string& peer_device, const string& peer_task,
36                     bool peer_is_local, const string& key, Device* to_device,
37                     DeviceContext* to_device_ctx,
38                     const AllocatorAttributes& to_alloc_attr, Tensor* to_tensor,
39                     const DeviceLocality& client_locality,
40                     int dev_to_dev_stream_index,
41                     const StatusCallback& done) override;
42 
43   void StartAbort(const Status& s) override;
44 
45  protected:
46   WorkerCacheInterface* worker_cache_;  // Not owned
47   CancellationManager cancel_mgr_;
48 };
49 
50 }  // namespace tensorflow
51 #endif  // TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_RMA_DISTRIBUTED_H_
52