use static linked cupti internally.

PiperOrigin-RevId: 313822331
Change-Id: Ie2c1e4a2d92ed9f92e2dcd8d3bc354546ab4663f
This commit is contained in:
A. Unique TensorFlower 2020-05-29 11:53:08 -07:00 committed by TensorFlower Gardener
parent 0ccc0ed961
commit 13645c7fd2
3 changed files with 13 additions and 6 deletions

View File

@ -15,6 +15,10 @@ load(
"//tensorflow/core/platform:build_config_root.bzl", "//tensorflow/core/platform:build_config_root.bzl",
"tf_cuda_tests_tags", "tf_cuda_tests_tags",
) )
load(
"//tensorflow/stream_executor:build_defs.bzl",
"tf_additional_cupti_deps",
)
package( package(
default_visibility = ["//tensorflow:internal"], default_visibility = ["//tensorflow:internal"],
@ -91,9 +95,7 @@ tf_cuda_library(
deps = [ deps = [
"//tensorflow/core:lib", "//tensorflow/core:lib",
"//tensorflow/core:platform_base", "//tensorflow/core:platform_base",
] + if_cuda_is_configured_compat([ ] + tf_additional_cupti_deps(),
"//tensorflow/stream_executor/cuda:cupti_stub",
]),
) )
tf_cuda_library( tf_cuda_library(
@ -104,9 +106,7 @@ tf_cuda_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":cupti_interface", ":cupti_interface",
] + if_cuda_is_configured_compat([ ] + tf_additional_cupti_deps(),
"//tensorflow/stream_executor/cuda:cupti_stub",
]),
) )
tf_cuda_library( tf_cuda_library(

View File

@ -10,6 +10,9 @@ def tf_additional_cuda_platform_deps():
def tf_additional_cuda_driver_deps(): def tf_additional_cuda_driver_deps():
return [":cuda_stub"] return [":cuda_stub"]
def tf_additional_cupti_deps():
return ["//tensorflow/stream_executor/cuda:cupti_stub"]
def tf_additional_cudnn_plugin_deps(): def tf_additional_cudnn_plugin_deps():
return [] return []

View File

@ -23,12 +23,16 @@ limitations under the License.
namespace { namespace {
// Returns DSO handle or null if loading the DSO fails. // Returns DSO handle or null if loading the DSO fails.
void* GetDsoHandle() { void* GetDsoHandle() {
#if defined(PLATFORM_GOOGLE) && (CUDA_VERSION > 10000)
return nullptr;
#else
static auto handle = []() -> void* { static auto handle = []() -> void* {
auto handle_or = stream_executor::internal::DsoLoader::GetCuptiDsoHandle(); auto handle_or = stream_executor::internal::DsoLoader::GetCuptiDsoHandle();
if (!handle_or.ok()) return nullptr; if (!handle_or.ok()) return nullptr;
return handle_or.ValueOrDie(); return handle_or.ValueOrDie();
}(); }();
return handle; return handle;
#endif
} }
template <typename T> template <typename T>