aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/devices.cc
diff options
context:
space:
mode:
authorGravatar Yao Zhang <yaozhang@google.com>2017-03-22 19:50:40 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-22 21:09:23 -0700
commit6ae8ccf4ef7c8ebc74ce616515f6f4ff7e2a848c (patch)
tree75b8dbf36a8af00c767f520a071578250cc6ec36 /tensorflow/core/grappler/devices.cc
parent0a5153d427bd8d36e407dc2bd5339ecc582fdd05 (diff)
Only use LayoutOptimizer if running on GPU.
Change: 150964768
Diffstat (limited to 'tensorflow/core/grappler/devices.cc')
-rw-r--r--tensorflow/core/grappler/devices.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/tensorflow/core/grappler/devices.cc b/tensorflow/core/grappler/devices.cc
index 2fa0073392..d3fc9044d3 100644
--- a/tensorflow/core/grappler/devices.cc
+++ b/tensorflow/core/grappler/devices.cc
@@ -15,16 +15,20 @@ limitations under the License.
#include <memory>
-#include "tensorflow/core/common_runtime/gpu/gpu_init.h"
#include "tensorflow/core/grappler/devices.h"
#include "tensorflow/core/platform/cpu_info.h"
+
+#if GOOGLE_CUDA
+#include "tensorflow/core/common_runtime/gpu/gpu_init.h"
#include "tensorflow/core/platform/stream_executor.h"
+#endif // GOOGLE_CUDA
namespace tensorflow {
namespace grappler {
int GetNumAvailableGPUs() {
int num_eligible_gpus = 0;
+#if GOOGLE_CUDA
if (ValidateGPUMachineManager().ok()) {
perftools::gputools::Platform* gpu_manager = GPUMachineManager();
if (gpu_manager != nullptr) {
@@ -43,6 +47,7 @@ int GetNumAvailableGPUs() {
}
}
}
+#endif // GOOGLE_CUDA
LOG(INFO) << "Number of eligible GPUs (core count >= 8): "
<< num_eligible_gpus;
return num_eligible_gpus;