Files
WeHub Mirror 16d3f15320
ARM CI / build (3.10) (push) Has been cancelled
cffconvert / validate (push) Has been cancelled
Creates a GitHub Issue when a PR Rolled back via Commit to Master / create-issue-on-pr-rollback (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
WeHub snapshot of ee606724a5c2f63bf60704cb3e1b169618993fd9
2026-08-07 16:11:07 +08:00

152 lines
4.1 KiB
Python

# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# Description:
# Tools for testing
load("@xla//third_party/rules_python/python:py_binary.bzl", "py_binary")
load("@xla//third_party/rules_python/python:py_library.bzl", "py_library")
load(
"//tensorflow/tools/test:performance.bzl",
"tf_cc_logged_benchmark",
"tf_py_logged_benchmark",
)
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
default_visibility = ["//tensorflow:internal"],
licenses = ["notice"],
)
exports_files([
"run_and_gather_logs_lib.py",
"run_and_gather_logs.py",
])
py_library(
name = "system_info_lib",
srcs = ["system_info_lib.py"],
strict_deps = True,
deps = [
":gpu_info_lib",
"//tensorflow:tensorflow_py",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/client:device_lib",
"//tensorflow/python/framework:errors",
"//tensorflow/python/platform:gfile",
"@six_archive//:six",
],
)
py_library(
name = "gpu_info_lib",
srcs = ["gpu_info_lib.py"],
strict_deps = True,
deps = [
"//tensorflow:tensorflow_py",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/framework:errors",
"//tensorflow/python/platform:gfile",
"@six_archive//:six",
],
)
py_binary(
name = "system_info",
srcs = ["system_info.py"],
strict_deps = True,
deps = [
":system_info_lib",
"@absl_py//absl:app",
],
)
py_library(
name = "run_and_gather_logs_lib",
srcs = [
"run_and_gather_logs_lib.py",
],
strict_deps = True,
deps = [
":gpu_info_lib",
":system_info_lib",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/platform:gfile",
"@absl_py//absl/logging",
"@six_archive//:six",
],
)
py_binary(
name = "run_and_gather_logs",
srcs = ["run_and_gather_logs.py"],
strict_deps = True,
visibility = ["//visibility:public"],
deps = [
":run_and_gather_logs_main_lib",
"@six_archive//:six",
],
)
py_library(
name = "run_and_gather_logs_main_lib",
srcs = ["run_and_gather_logs.py"],
strict_deps = True,
visibility = ["//visibility:public"],
deps = [
":run_and_gather_logs_lib",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/platform:client_testlib",
"//tensorflow/python/platform:gfile",
"//tensorflow/python/platform:tf_logging",
"@absl_py//absl:app",
"@absl_py//absl/flags",
"@six_archive//:six",
],
)
# Unit test that calls run_and_gather_logs on a benchmark, and
# prints the result.
#cuda_py_test(
# name = "run_and_gather_logs_test",
# srcs = ["run_and_gather_logs.py"],
# deps = [
# ":run_and_gather_logs",
# ],
# args = [
# "--test_name=" + "//tensorflow/core/kernels:cast_op_test",
# "--test_args=" + "'--benchmark_filter=BM_cpu_float'",
# ],
# data = [
# "//tensorflow/core/kernels:cast_op_test",
# ],
# main = "run_and_gather_logs.py",
#)
tf_cc_logged_benchmark(
name = "cast_op_benchmark",
target = "//tensorflow/core/kernels:cast_op_test_gpu",
)
tf_py_logged_benchmark(
name = "rnn_op_benchmark",
target = "//tensorflow/python/kernel_tests/nn_ops:rnn_test",
)
tf_py_logged_benchmark(
name = "sparse_csr_matrix_ops_benchmark",
target = "//tensorflow/python/kernel_tests/linalg/sparse:csr_sparse_matrix_ops_test",
)