From c794ba78a58fcab4fac7623251faa961d6cd42d9 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 2 Nov 2016 09:49:12 -0800 Subject: [PATCH] Simplified the addition of devices. Change: 137964954 --- tensorflow/core/common_runtime/device_factory.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tensorflow/core/common_runtime/device_factory.cc b/tensorflow/core/common_runtime/device_factory.cc index 8104f446366..efbdf6bbb19 100644 --- a/tensorflow/core/common_runtime/device_factory.cc +++ b/tensorflow/core/common_runtime/device_factory.cc @@ -78,7 +78,7 @@ DeviceFactory* DeviceFactory::GetFactory(const string& device_type) { Status DeviceFactory::AddDevices(const SessionOptions& options, const string& name_prefix, std::vector* devices) { - // CPU first. + // CPU first. A CPU device is required. auto cpu_factory = GetFactory("CPU"); if (!cpu_factory) { return errors::NotFound( @@ -90,18 +90,11 @@ Status DeviceFactory::AddDevices(const SessionOptions& options, return errors::NotFound("No CPU devices are available in this process"); } - // Then GPU. - auto gpu_factory = GetFactory("GPU"); - if (gpu_factory) { - TF_RETURN_IF_ERROR( - gpu_factory->CreateDevices(options, name_prefix, devices)); - } - - // Then the rest. + // Then the rest (including GPU). mutex_lock l(*get_device_factory_lock()); for (auto& p : device_factories()) { auto factory = p.second.factory.get(); - if (factory != cpu_factory && factory != gpu_factory) { + if (factory != cpu_factory) { TF_RETURN_IF_ERROR(factory->CreateDevices(options, name_prefix, devices)); } }