diff options
author | Peter Hawkins <phawkins@google.com> | 2016-12-05 06:27:11 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-12-05 06:44:09 -0800 |
commit | e4a4e922ed4be890f4273a7a276768dfefe80a4c (patch) | |
tree | b724c791eb601946961899a621ea4335babfd1e0 /tensorflow/stream_executor/multi_platform_manager.cc | |
parent | b00e490c3834d72aecce445f72b3a717b068d9db (diff) |
Add a Host platform to the stream executor library that runs code on the CPU.
Avoid using a linker-initialized mutex in multi_platform_manager to work around a initialization/destruction ordering problem on Mac.
Include the CUDA platform ID module even in non-CUDA builds.
Change: 141045549
Diffstat (limited to 'tensorflow/stream_executor/multi_platform_manager.cc')
-rw-r--r-- | tensorflow/stream_executor/multi_platform_manager.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tensorflow/stream_executor/multi_platform_manager.cc b/tensorflow/stream_executor/multi_platform_manager.cc index 6f3ac8bda1..b1f25ab5d3 100644 --- a/tensorflow/stream_executor/multi_platform_manager.cc +++ b/tensorflow/stream_executor/multi_platform_manager.cc @@ -22,13 +22,11 @@ limitations under the License. namespace perftools { namespace gputools { -/* static */ mutex MultiPlatformManager::platforms_mutex_(LINKER_INITIALIZED); - /* static */ port::Status MultiPlatformManager::RegisterPlatform( std::unique_ptr<Platform> platform) { CHECK(platform != nullptr); string key = port::Lowercase(platform->Name()); - mutex_lock lock(platforms_mutex_); + mutex_lock lock(GetPlatformsMutex()); if (GetPlatformMap()->find(key) != GetPlatformMap()->end()) { return port::Status(port::error::INTERNAL, "platform is already registered with name: \"" + @@ -46,7 +44,7 @@ namespace gputools { /* static */ port::StatusOr<Platform*> MultiPlatformManager::PlatformWithName( const string& target) { - mutex_lock lock(platforms_mutex_); + mutex_lock lock(GetPlatformsMutex()); auto it = GetPlatformMap()->find(port::Lowercase(target)); if (it == GetPlatformMap()->end()) { @@ -60,7 +58,7 @@ namespace gputools { /* static */ port::StatusOr<Platform*> MultiPlatformManager::PlatformWithId( const Platform::Id& id) { - mutex_lock lock(platforms_mutex_); + mutex_lock lock(GetPlatformsMutex()); auto it = GetPlatformByIdMap()->find(id); if (it == GetPlatformByIdMap()->end()) { return port::Status( @@ -72,7 +70,7 @@ namespace gputools { } /* static */ void MultiPlatformManager::ClearPlatformRegistry() { - mutex_lock lock(platforms_mutex_); + mutex_lock lock(GetPlatformsMutex()); GetPlatformMap()->clear(); GetPlatformByIdMap()->clear(); } |