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",
"tf_cuda_tests_tags",
)
load(
"//tensorflow/stream_executor:build_defs.bzl",
"tf_additional_cupti_deps",
)
package(
default_visibility = ["//tensorflow:internal"],
@ -91,9 +95,7 @@ tf_cuda_library(
deps = [
"//tensorflow/core:lib",
"//tensorflow/core:platform_base",
] + if_cuda_is_configured_compat([
"//tensorflow/stream_executor/cuda:cupti_stub",
]),
] + tf_additional_cupti_deps(),
)
tf_cuda_library(
@ -104,9 +106,7 @@ tf_cuda_library(
visibility = ["//visibility:public"],
deps = [
":cupti_interface",
] + if_cuda_is_configured_compat([
"//tensorflow/stream_executor/cuda:cupti_stub",
]),
] + tf_additional_cupti_deps(),
)
tf_cuda_library(

View File

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

View File

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