diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-03-08 11:38:46 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-03-08 11:43:00 -0800 |
commit | 05c31035abedb2983899c49d172ac0382b6eceb7 (patch) | |
tree | fbf038709425824522bf8599634b2f29a241c842 /tensorflow/stream_executor/platform.h | |
parent | a6a0c0bf9486c11793b7dd0b4883a75ff3dcf3f3 (diff) |
[SE] Initial perftools::gputools::Platform initialization support
Adds initialization methods to Platform. Some platforms require initialization.
Those that do not have trivial implementations of these methods.
PiperOrigin-RevId: 188363315
Diffstat (limited to 'tensorflow/stream_executor/platform.h')
-rw-r--r-- | tensorflow/stream_executor/platform.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tensorflow/stream_executor/platform.h b/tensorflow/stream_executor/platform.h index f0a0e60e02..54f8aa86c2 100644 --- a/tensorflow/stream_executor/platform.h +++ b/tensorflow/stream_executor/platform.h @@ -111,6 +111,9 @@ class Platform { // Returns a key uniquely identifying this platform. virtual Id id() const = 0; + // Name of this platform. + virtual const string& Name() const = 0; + // Returns the number of devices accessible on this platform. // // Note that, though these devices are visible, if there is only one userspace @@ -118,8 +121,17 @@ class Platform { // device, a call to ExecutorForDevice may return an error status. virtual int VisibleDeviceCount() const = 0; - // Name of this platform. - virtual const string& Name() const = 0; + // Returns true iff the platform has been initialized. + virtual bool Initialized() const; + + // Initializes the platform with a custom set of options. The platform must be + // initialized before obtaining StreamExecutor objects. The interpretation of + // the platform_options argument is implementation specific. This method may + // return an error if unrecognized options are provided. If using + // MultiPlatformManager, this method will be called automatically by + // InitializePlatformWithId/InitializePlatformWithName. + virtual port::Status Initialize( + const std::map<string, string>& platform_options); // Returns a device with the given ordinal on this platform with a default // plugin configuration or, if none can be found with the given ordinal or @@ -156,6 +168,8 @@ class Platform { // This is only useful on platforms which bind a device to a single process // that has obtained the device context. May return UNIMPLEMENTED on platforms // that have no reason to destroy device contexts. + // + // The platform must be reinitialized after this is called. virtual port::Status ForceExecutorShutdown(); // Registers a TraceListener to listen to all StreamExecutors for this |