From 396105ddd5a6b5838be8de1f20172ea78c58c124 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 29 May 2020 17:40:27 -0700 Subject: [PATCH] fix build due to cupti static link. PiperOrigin-RevId: 313880914 Change-Id: I4cf691e60fd28e773f124e440ebb30f054d5f2e9 --- tensorflow/core/profiler/internal/gpu/BUILD | 7 +++++++ tensorflow/stream_executor/cuda/cupti_stub.cc | 1 + 2 files changed, 8 insertions(+) diff --git a/tensorflow/core/profiler/internal/gpu/BUILD b/tensorflow/core/profiler/internal/gpu/BUILD index 670080573b2..2bb0805a592 100644 --- a/tensorflow/core/profiler/internal/gpu/BUILD +++ b/tensorflow/core/profiler/internal/gpu/BUILD @@ -98,11 +98,18 @@ tf_cuda_library( ] + tf_additional_cupti_deps(), ) +# Rationale for linkstatic: The symbols in libcupti_static.a have hidden +# visibility. The wrapper will fail to find them if it's ever built as a +# shared library. This is the same issue as b/11094727. Always linking +# the wrapper statically works around the issue. An alternative would be +# to patch libcupti_static, but it's not worth the trouble considering +# that the wrapper is about the only direct user. tf_cuda_library( name = "cupti_wrapper", srcs = if_cuda_is_configured_compat(["cupti_wrapper.cc"]), hdrs = if_cuda_is_configured_compat(["cupti_wrapper.h"]), copts = tf_copts(), + linkstatic = 1, visibility = ["//visibility:public"], deps = [ ":cupti_interface", diff --git a/tensorflow/stream_executor/cuda/cupti_stub.cc b/tensorflow/stream_executor/cuda/cupti_stub.cc index feea09e002a..313d68eddfc 100644 --- a/tensorflow/stream_executor/cuda/cupti_stub.cc +++ b/tensorflow/stream_executor/cuda/cupti_stub.cc @@ -14,6 +14,7 @@ limitations under the License. ==============================================================================*/ #include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h" +#include "third_party/gpus/cuda/include/cuda.h" // IWYU pragma: no_include "perftools/gputools/executor/stream_executor.h" #include "tensorflow/stream_executor/lib/env.h" #include "tensorflow/stream_executor/platform/dso_loader.h"