Integrate stackdriver support with tensorflow

PiperOrigin-RevId: 315012368
Change-Id: Ib41ec1cfe4920b8ebc22611dd6c86cdb4b43b018
This commit is contained in:
A. Unique TensorFlower 2020-06-05 15:59:02 -07:00 committed by TensorFlower Gardener
parent d4cd262a67
commit f5f25ec023
6 changed files with 57 additions and 4 deletions

View File

@ -199,6 +199,7 @@ build:noaws --define=no_aws_support=true
build:nogcp --define=no_gcp_support=true
build:nohdfs --define=no_hdfs_support=true
build:nonccl --define=no_nccl_support=true
build:nostackdriver --define=no_stackdriver_support=true
build --define=use_fast_cpp_protos=true
build --define=allow_oversize_protos=true

View File

@ -298,6 +298,13 @@ config_setting(
visibility = ["//visibility:public"],
)
# Experimental features
config_setting(
name = "no_stackdriver_support",
define_values = {"no_stackdriver_support": "true"},
visibility = ["//visibility:public"],
)
# Crosses between platforms and file system libraries not supported on those
# platforms due to limitations in nested select() statements.
config_setting(

View File

@ -100,7 +100,7 @@ load("//tensorflow:tensorflow.bzl", "tf_cc_test_gpu")
load("//tensorflow:tensorflow.bzl", "tf_cc_tests_gpu")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_monitoring_deps")
load("//tensorflow:tensorflow.bzl", "tf_monitoring_framework_deps")
# For platform specific build config
load(
@ -1950,7 +1950,7 @@ cc_library(
"@zlib",
"@double_conversion//:double-conversion",
"@com_google_protobuf//:protobuf",
] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl() + tf_monitoring_deps(),
] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl() + tf_monitoring_framework_deps(),
# Alwayslink causes a cc_binary to "always link" in the
# srcs for a given cc_library, even if they are unreferenced, see:
# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.alwayslink

View File

@ -5,6 +5,9 @@
load("//tensorflow:tensorflow.bzl", "py_strict_library")
load("//tensorflow:tensorflow.bzl", "cc_header_only_library", "if_mlir", "if_not_windows", "if_xla_available", "py_test", "py_tests", "tf_cc_shared_object", "tf_cuda_library", "tf_gen_op_wrapper_py")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_monitoring_python_deps")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension")
@ -6013,6 +6016,7 @@ pywrap_tensorflow_macro(
"//tensorflow/core/util/tensor_bundle",
"//tensorflow/compiler/mlir/python:mlir",
] + (tf_additional_lib_deps() +
tf_monitoring_python_deps() +
tf_additional_plugin_deps() +
tf_additional_profiler_deps()) + if_ngraph([
"@ngraph_tf//:ngraph_tf",

View File

@ -2856,8 +2856,39 @@ def if_cuda_or_rocm(if_true, if_false = []):
"//conditions:default": if_false,
})
def tf_monitoring_deps():
return []
def tf_monitoring_framework_deps(link_to_tensorflow_framework = True):
"""Get the monitoring libs that will be linked to the tensorflow framework.
Currently in OSS, the protos must be statically linked to the tensorflow
framework, whereas the grpc should not be linked here.
"""
return select({
"//tensorflow:android": [],
"//tensorflow:ios": [],
"//tensorflow:linux_s390x": [],
"//tensorflow:windows": [],
"//tensorflow:no_stackdriver_support": [],
"//conditions:default": [
"@com_github_googlecloudplatform_tensorflow_gcp_tools//monitoring:stackdriver_exporter_protos",
],
})
def tf_monitoring_python_deps():
"""Get the monitoring libs that will be linked to the python wrapper.
Currently in OSS, the grpc must be statically linked to the python wrapper
whereas the protos should not be linked here.
"""
return select({
"//tensorflow:android": [],
"//tensorflow:ios": [],
"//tensorflow:linux_s390x": [],
"//tensorflow:windows": [],
"//tensorflow:no_stackdriver_support": [],
"//conditions:default": [
"@com_github_googlecloudplatform_tensorflow_gcp_tools//monitoring:stackdriver_exporter",
],
})
def tf_jit_compilation_passes_extra_deps():
return []

View File

@ -328,6 +328,16 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
],
)
tf_http_archive(
name = "com_github_googlecloudplatform_tensorflow_gcp_tools",
sha256 = "5e9ebe17eaa2895eb7f77fefbf52deeda7c4b63f5a616916b823eb74f3a0c542",
strip_prefix = "tensorflow-gcp-tools-2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/GoogleCloudPlatform/tensorflow-gcp-tools/archive/2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5.tar.gz",
"https://github.com/GoogleCloudPlatform/tensorflow-gcp-tools/archive/2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5.tar.gz",
],
)
tf_http_archive(
name = "com_google_googleapis",
build_file = clean_dep("//third_party/googleapis:googleapis.BUILD"),