| 97 | |
| 98 | #if !defined(IS_MOBILE_PLATFORM) |
| 99 | tensorflow::Status GetAllRemoteDevices( |
| 100 | const std::vector<string>& remote_workers, |
| 101 | tensorflow::WorkerCacheInterface* worker_cache, |
| 102 | std::unique_ptr<tensorflow::DeviceMgr>* device_mgr) { |
| 103 | std::vector<std::unique_ptr<tensorflow::Device>> remote_devices; |
| 104 | tensorflow::Status status; |
| 105 | // TODO(nareshmodi) do this in parallel instead of serially. |
| 106 | for (const string& remote_worker : remote_workers) { |
| 107 | tensorflow::Notification n; |
| 108 | tensorflow::NewRemoteDevices( |
| 109 | tensorflow::Env::Default(), worker_cache, remote_worker, |
| 110 | [&status, &n, &remote_devices]( |
| 111 | const tensorflow::Status& s, |
| 112 | std::vector<tensorflow::Device*>* devices) { |
| 113 | status = s; |
| 114 | if (s.ok()) { |
| 115 | for (tensorflow::Device* d : *devices) { |
| 116 | remote_devices.emplace_back(d); |
| 117 | } |
| 118 | } |
| 119 | n.Notify(); |
| 120 | }); |
| 121 | n.WaitForNotification(); |
| 122 | } |
| 123 | std::unique_ptr<tensorflow::DeviceMgr> remote_device_mgr( |
| 124 | new tensorflow::DeviceMgr(std::move(remote_devices))); |
| 125 | |
| 126 | TF_RETURN_IF_ERROR(status); |
| 127 | |
| 128 | *device_mgr = std::move(remote_device_mgr); |
| 129 | return tensorflow::Status::OK(); |
| 130 | } |
| 131 | |
| 132 | tensorflow::Status CreateRemoteContexts( |
| 133 | const std::vector<string>& remote_workers, tensorflow::uint64 context_id, |
no test coverage detected