• 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_COMMON_RUNTIME_DEVICE_RESOLVER_LOCAL_H_
16 #define TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_RESOLVER_LOCAL_H_
17 
18 #include <string>
19 
20 #include "tensorflow/core/framework/collective.h"
21 #include "tensorflow/core/framework/device_attributes.pb.h"
22 
23 namespace tensorflow {
24 class DeviceMgr;
25 
26 // Implements DeviceResolverInterface in a single-task context.
27 class DeviceResolverLocal : public DeviceResolverInterface {
28  public:
DeviceResolverLocal(const DeviceMgr * dev_mgr)29   DeviceResolverLocal(const DeviceMgr* dev_mgr) : dev_mgr_(dev_mgr) {}
30 
~DeviceResolverLocal()31   virtual ~DeviceResolverLocal() {}
32 
33   void GetDeviceLocalitiesAsync(const CollInstanceParams& ci_params,
34                                 std::vector<DeviceLocality>* localities,
35                                 const StatusCallback& done) override;
36 
37   void GetLocalityAsync(const string& device, const string& task,
38                         DeviceLocality* locality,
39                         const StatusCallback& done) override;
40 
ClearTask(const string & task)41   void ClearTask(const string& task) override {}
42 
43  protected:
44   const DeviceMgr* dev_mgr_;
45 };
46 
47 }  // namespace tensorflow
48 #endif  // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_RESOLVER_LOCAL_H_
49