aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--tensorflow/core/BUILD4
-rw-r--r--tensorflow/core/common_runtime/direct_session.cc9
-rw-r--r--tensorflow/core/kernels/BUILD5
3 files changed, 14 insertions, 4 deletions
diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD
index 76e6ee7568..1c37921afc 100644
--- a/tensorflow/core/BUILD
+++ b/tensorflow/core/BUILD
@@ -1279,11 +1279,13 @@ tf_cuda_library(
srcs = ["common_runtime/direct_session.cc"],
hdrs = ["common_runtime/direct_session.h"],
copts = tf_copts(),
+ cuda_deps = [
+ ":gpu_tracer",
+ ],
linkstatic = 1,
deps = [
":core_cpu_internal",
":framework",
- ":gpu_tracer",
":lib",
":lib_internal",
":proto_text",
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_);
diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD
index 478d1bc332..34954f0066 100644
--- a/tensorflow/core/kernels/BUILD
+++ b/tensorflow/core/kernels/BUILD
@@ -405,7 +405,6 @@ ARRAY_DEPS = [
"//tensorflow/core:array_ops_op_lib",
"//tensorflow/core:core_cpu",
"//tensorflow/core:framework",
- "//tensorflow/core:gpu_runtime",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"//tensorflow/core:proto_text",
@@ -420,7 +419,9 @@ tf_kernel_libraries(
"debug_ops",
"immutable_constant_op",
],
- deps = ARRAY_DEPS,
+ deps = ARRAY_DEPS + [
+ "//tensorflow/core:gpu_runtime",
+ ],
)
tf_kernel_libraries(