aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/c_api_internal.h
diff options
context:
space:
mode:
authorGravatar Brennan Saeta <saeta@google.com>2017-05-26 11:04:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-26 11:07:54 -0700
commit9c495f9499199ea46fff9028774374fa0c52e018 (patch)
tree9c0009cdc0cbe1eebfec9bdc7e24e271dbf0584b /tensorflow/c/c_api_internal.h
parent7b401106a488eba759b6cce370393dce05d1d173 (diff)
Add session.list_devices() API
In order to debug a TensorFlow cluster or check whether devices are available in a local session (e.g. GPU drivers are loaded), this change adds a `sess.list_devices` API to list all devices within the cluster. This CL implements the list_devices() feature via extensions to the TensorFlow C API, and the corresponding additions to the session.h session class and corresponding subclasses for both direct sessions, grpc_sessions, tensorflow_serving, and others. Additionally, in order to accomidate ClusterSpec propagation clusters, Master::ListDevices now also includes a session_handle in order to identify the appropriate master_session on which it should list the available devices. (With ClusterSpec propagation, different sessions can have different servers with different device capabilities.) This CL adds a ListDevices() API to MasterSession. It is most efficient to implement this API call there, because the MasterSession already has a list of devices. Additionally, this change upgrades the implementation of Master::ListDevices() to delegate to the MasterSession if a session handle is specified, and to return an error if no corresponding session is found. PiperOrigin-RevId: 157239656
Diffstat (limited to 'tensorflow/c/c_api_internal.h')
-rw-r--r--tensorflow/c/c_api_internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/c/c_api_internal.h b/tensorflow/c/c_api_internal.h
index b5320d20da..f17ac26ad9 100644
--- a/tensorflow/c/c_api_internal.h
+++ b/tensorflow/c/c_api_internal.h
@@ -29,7 +29,6 @@ limitations under the License.
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/common_runtime/shape_refiner.h"
-
// Internal structures used by the C API. These are likely to change and should
// not be depended on.
@@ -114,3 +113,7 @@ struct TF_Session {
struct TF_ImportGraphDefOptions {
tensorflow::ImportGraphDefOptions opts;
};
+
+struct TF_DeviceList {
+ std::vector<tensorflow::DeviceAttributes> response;
+};