aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime/direct_session.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-10-27 14:43:30 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-10-27 15:49:32 -0700
commite3b841bd93cd48b8364034faad6bddf3957dad63 (patch)
tree51222a1f7a98beb3c230c96ce32d5bed4b5f326f /tensorflow/core/common_runtime/direct_session.cc
parent1f64f2fad3a7a984564c03663243f705b8c2e35c (diff)
Remove the GPU runtime from being linked into TensorFlow by default.
Users must explicitly depend on :gpu_runtime if they want support for GPU operations. Change: 137451312
Diffstat (limited to 'tensorflow/core/common_runtime/direct_session.cc')
-rw-r--r--tensorflow/core/common_runtime/direct_session.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/core/common_runtime/direct_session.cc b/tensorflow/core/common_runtime/direct_session.cc
index 6f4c0ecfea..35332dfc8c 100644
--- a/tensorflow/core/common_runtime/direct_session.cc
+++ b/tensorflow/core/common_runtime/direct_session.cc
@@ -23,7 +23,6 @@ limitations under the License.
#include "tensorflow/core/common_runtime/device_factory.h"
#include "tensorflow/core/common_runtime/executor.h"
#include "tensorflow/core/common_runtime/function.h"
-#include "tensorflow/core/common_runtime/gpu/gpu_tracer.h"
#include "tensorflow/core/common_runtime/graph_optimizer.h"
#include "tensorflow/core/common_runtime/memory_types.h"
#include "tensorflow/core/common_runtime/simple_placer.h"
@@ -57,6 +56,10 @@ limitations under the License.
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/util/device_name_utils.h"
+#if GOOGLE_CUDA
+#include "tensorflow/core/common_runtime/gpu/gpu_tracer.h"
+#endif // GOOGLE_CUDA
+
namespace tensorflow {
namespace {
@@ -453,12 +456,14 @@ Status DirectSession::Run(const RunOptions& run_options,
args.stats_collector = run_state.collector.get();
}
+#if GOOGLE_CUDA
std::unique_ptr<GPUTracer> tracer;
if (run_options.trace_level() >= RunOptions::HARDWARE_TRACE) {
tracer.reset(CreateGPUTracer());
// tracer will be NULL on non-GPU platforms.
if (tracer) tracer->Start();
}
+#endif // GOOGLE_CUDA
for (const auto& item : executors_and_keys->items) {
item.executor->RunAsync(args, barrier->Get());
@@ -468,10 +473,12 @@ Status DirectSession::Run(const RunOptions& run_options,
? run_options.timeout_in_ms()
: operation_timeout_in_ms_);
+#if GOOGLE_CUDA
if (tracer) {
tracer->Stop();
tracer->Collect(args.stats_collector);
}
+#endif // GOOGLE_CUDA
{
mutex_lock l(run_state.mu_);