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 | #include <vector> |
20 | |
21 | #include "tensorflow/core/framework/collective.h" |
22 | #include "tensorflow/core/framework/device_attributes.pb.h" |
23 | #include "tensorflow/core/platform/status.h" |
24 | |
25 | namespace tensorflow { |
26 | class DeviceMgr; |
27 | |
28 | // Implements DeviceResolverInterface in a single-task context. |
29 | class DeviceResolverLocal : public DeviceResolverInterface { |
30 | public: |
31 | explicit DeviceResolverLocal(const DeviceMgr* dev_mgr) : dev_mgr_(dev_mgr) {} |
32 | |
33 | Status GetDeviceAttributes(const string& device, |
34 | DeviceAttributes* attributes) override; |
35 | |
36 | Status GetAllDeviceAttributes( |
37 | const string& task, std::vector<DeviceAttributes>* attributes) override; |
38 | |
39 | Status UpdateDeviceAttributes( |
40 | const std::vector<DeviceAttributes>& attributes) override; |
41 | |
42 | protected: |
43 | const DeviceMgr* dev_mgr_; |
44 | }; |
45 | |
46 | } // namespace tensorflow |
47 | #endif // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_RESOLVER_LOCAL_H_ |
48 | |