Home | History | Annotate | Download | only in distributed_runtime
      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_REMOTE_DEVICE_H_
     17 #define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_REMOTE_DEVICE_H_
     18 
     19 #include <functional>
     20 #include <string>
     21 #include <vector>
     22 #include "tensorflow/core/lib/core/status.h"
     23 
     24 namespace tensorflow {
     25 class Device;
     26 class Env;
     27 class WorkerCacheInterface;
     28 
     29 // NewRemoteDevices discovers available devices on the
     30 // 'remote_worker'.  The implementation uses 'channel_cache' to
     31 // discover how to communicate with the 'remote_worker' (via gRPC, for
     32 // example).
     33 //
     34 // NewRemoteDevices does not block.
     35 //
     36 // On success, the 'done' callback is given the OK status and a vector
     37 // of Device*. The caller should take ownership of these devices.
     38 //
     39 // Otherwise, the 'done' callback is given an error status and the
     40 // vector is empty.
     41 typedef std::function<void(const Status&, std::vector<Device*>*)>
     42     NewRemoteDevicesDone;
     43 void NewRemoteDevices(Env* env, WorkerCacheInterface* worker_cache,
     44                       const string& remote_worker, NewRemoteDevicesDone done);
     45 
     46 }  // namespace tensorflow
     47 
     48 #endif  // TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_REMOTE_DEVICE_H_
     49