Skip to content

Commit b43769b

Browse files
Update Bazel version to 7.4.1.
PiperOrigin-RevId: 781169047
1 parent c79cc0e commit b43769b

File tree

60 files changed

+5755
-1168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5755
-1168
lines changed

.bazelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
# nohdfs: Disable hadoop hdfs support.
2929
# nonccl: Disable nccl support.
3030

31+
# No MODULE.bzl file.
32+
common --noenable_bzlmod
33+
3134
# Sets the default Apple platform to macOS.
3235
build --apple_platform_type=macos
3336

@@ -44,6 +47,7 @@ test --define=use_fast_cpp_protos=false
4447
build:using_cuda --define=using_cuda=true
4548
build:using_cuda --action_env TF_NEED_CUDA=1
4649
build:using_cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
50+
build:using_cuda --@local_config_cuda//:enable_cuda
4751

4852
# Enable the mlir generated GPU kernels only for cuda builds.
4953
build --define=tensorflow_enable_mlir_generated_gpu_kernels=0
@@ -53,6 +57,10 @@ build:using_cuda --define=tensorflow_enable_mlir_generated_gpu_kernels=1
5357
# This config refers to building CUDA op kernels with nvcc.
5458
build:cuda --config=using_cuda
5559
build:cuda --define=using_cuda_nvcc=true
60+
# Build CUDA with NVCC and other C++ targets with Clang
61+
build:cuda --action_env=TF_NVCC_CLANG="1"
62+
build:cuda --@local_config_cuda//:cuda_compiler=nvcc
63+
build:cuda --action_env=CLANG_CUDA_COMPILER_PATH="/usr/lib/llvm-18/bin/clang"
5664

5765
# dbg config, as a shorthand for '--config=opt -c dbg'
5866
build:dbg --config=opt -c dbg

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.4.0
1+
7.4.1

BUILD

Lines changed: 52 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,53 @@
1-
py_library(
2-
name = "expect_absl_installed",
3-
# This is a dummy rule used as a absl dependency in open-source.
4-
# We expect absl to already be installed on the system, e.g. via
5-
# `pip install absl`
6-
visibility = ["//visibility:public"],
7-
deps = [],
8-
)
9-
10-
py_library(
11-
name = "expect_h5py_installed",
12-
# This is a dummy rule used as a h5 dependency in open-source.
13-
# We expect h5py to already be installed on the system, e.g. via
14-
# `pip install h5py'
15-
visibility = ["//visibility:public"],
16-
deps = [],
17-
)
18-
19-
py_library(
20-
name = "expect_numpy_installed",
21-
# This is a dummy rule used as a numpy dependency in open-source.
22-
# We expect numpy to already be installed on the system, e.g. via
23-
# `pip install numpy`
24-
visibility = ["//visibility:public"],
25-
deps = [],
26-
)
27-
28-
py_library(
29-
name = "expect_pandas_installed",
30-
# This is a dummy rule used as a pandas dependency in open-source.
31-
# We expect pandas to already be installed on the system, e.g. via
32-
# `pip install pandas'
33-
visibility = ["//visibility:public"],
34-
deps = [],
35-
)
36-
37-
py_library(
38-
name = "expect_pillow_installed",
39-
# This is a dummy rule used as a pillow dependency in open-source.
40-
# We expect pillow to already be installed on the system, e.g. via
41-
# `pip install Pillow'
42-
visibility = ["//visibility:public"],
43-
deps = [],
44-
)
45-
46-
# Note that this dependency is for testing only.
47-
py_library(
48-
name = "expect_portpicker_installed",
49-
# This is a dummy rule used as a pandas dependency in open-source.
50-
# We expect portpicker to already be installed on the system, e.g. via
51-
# `pip install portpicker'
52-
visibility = ["//visibility:public"],
53-
deps = [],
54-
)
55-
56-
py_library(
57-
name = "expect_pydot_installed",
58-
# This is a dummy rule used as a pydot dependency in open-source.
59-
# We expect pydot to already be installed on the system, e.g. via
60-
# `pip install pydot'
61-
visibility = ["//visibility:public"],
62-
deps = [],
63-
)
64-
65-
py_library(
66-
name = "expect_scipy_installed",
67-
# This is a dummy rule used as a scipy dependency in open-source.
68-
# We expect scipy to already be installed on the system, e.g. via
69-
# `pip install scipy'
70-
visibility = ["//visibility:public"],
71-
deps = [],
72-
)
73-
74-
py_library(
75-
name = "expect_six_installed",
76-
# This is a dummy rule used as a six dependency in open-source.
77-
# We expect six to already be installed on the system, e.g. via
78-
# `pip install six`
79-
visibility = ["//visibility:public"],
80-
deps = [],
81-
)
82-
83-
py_library(
84-
name = "expect_tensorboard_installed",
85-
# This is a dummy rule used as a tensorboard dependency in open-source.
86-
# We expect tensorboard to already be installed on the system, e.g. via
87-
# `pip install tensorflow`
88-
visibility = ["//visibility:public"],
89-
deps = [],
90-
)
91-
92-
py_library(
93-
name = "expect_tensorflow_installed",
94-
# This is a dummy rule used as a tensorflow dependency in open-source.
95-
# We expect tensorflow to already be installed on the system, e.g. via
96-
# `pip install tensorflow`
97-
visibility = ["//visibility:public"],
98-
deps = [],
99-
)
100-
101-
py_library(
102-
name = "expect_yaml_installed",
103-
# This is a dummy rule used as a yaml dependency in open-source.
104-
# We expect yaml to already be installed on the system, e.g. via
105-
# `pip install yaml`
106-
visibility = ["//visibility:public"],
107-
deps = [],
108-
)
109-
110-
# Note that this dependency is for testing only.
111-
py_library(
112-
name = "expect_tensorflow_io_installed",
113-
# This is a dummy rule used as a tensorflow_io dependency in open-source.
114-
# We expect tensorflow_io to already be installed on the system, e.g. via
115-
# `pip install tensorflow-io`
116-
visibility = ["//visibility:public"],
117-
deps = [],
1+
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
2+
load("@python//:defs.bzl", "compile_pip_requirements")
3+
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
4+
load(
5+
"@xla//third_party/py:py_import.bzl",
6+
"py_import",
7+
)
8+
9+
compile_pip_requirements(
10+
name = "requirements",
11+
extra_args = [
12+
"--allow-unsafe",
13+
"--build-isolation",
14+
"--rebuild",
15+
],
16+
generate_hashes = True,
17+
requirements_in = "requirements.in",
18+
requirements_txt = REQUIREMENTS,
19+
)
20+
21+
py_import(
22+
name = "tf_nightly_with_deps",
23+
wheel = "@pypi//tf_nightly:whl",
24+
wheel_deps = if_cuda([
25+
"@pypi_nvidia_cublas_cu12//:pkg",
26+
"@pypi_nvidia_cuda_cupti_cu12//:pkg",
27+
"@pypi_nvidia_cuda_nvrtc_cu12//:pkg",
28+
"@pypi_nvidia_cuda_runtime_cu12//:pkg",
29+
"@pypi_nvidia_cudnn_cu12//:pkg",
30+
"@pypi_nvidia_cufft_cu12//:pkg",
31+
"@pypi_nvidia_curand_cu12//:pkg",
32+
"@pypi_nvidia_cusolver_cu12//:pkg",
33+
"@pypi_nvidia_cusparse_cu12//:pkg",
34+
"@pypi_nvidia_nccl_cu12//:pkg",
35+
"@pypi_nvidia_nvjitlink_cu12//:pkg",
36+
]),
37+
deps = [
38+
"@pypi_absl_py//:pkg",
39+
"@pypi_astunparse//:pkg",
40+
"@pypi_flatbuffers//:pkg",
41+
"@pypi_gast//:pkg",
42+
"@pypi_ml_dtypes//:pkg",
43+
"@pypi_numpy//:pkg",
44+
"@pypi_opt_einsum//:pkg",
45+
"@pypi_packaging//:pkg",
46+
"@pypi_protobuf//:pkg",
47+
"@pypi_requests//:pkg",
48+
"@pypi_tensorboard//:pkg",
49+
"@pypi_termcolor//:pkg",
50+
"@pypi_typing_extensions//:pkg",
51+
"@pypi_wrapt//:pkg",
52+
],
11853
)

WORKSPACE

Lines changed: 89 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,91 @@ workspace(name = "org_keras")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
http_archive(
6+
name = "xla",
7+
sha256 = "31723c3661c7dd8c23fbc771be246ed4371ba1f9230c5838b3abd4c384503d0a",
8+
strip_prefix = "xla-8cd5440294ba09563548abe742b8c5346e01886a",
9+
urls = [
10+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/xla/archive/8cd5440294ba09563548abe742b8c5346e01886a.tar.gz",
11+
"https://github.com/openxla/xla/archive/8cd5440294ba09563548abe742b8c5346e01886a.tar.gz",
12+
],
13+
)
14+
15+
load("@xla//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
16+
17+
# Initialize hermetic Python
18+
load("@xla//third_party/py:python_init_rules.bzl", "python_init_rules")
19+
20+
python_init_rules()
21+
22+
load("@xla//third_party/py:python_init_repositories.bzl", "python_init_repositories")
23+
24+
python_init_repositories(
25+
requirements = {
26+
"3.9": "//:requirements_lock_3_9.txt",
27+
"3.10": "//:requirements_lock_3_10.txt",
28+
"3.11": "//:requirements_lock_3_11.txt",
29+
"3.12": "//:requirements_lock_3_12.txt",
30+
},
31+
)
32+
33+
load("@xla//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
34+
35+
python_init_toolchains()
36+
37+
load("@xla//third_party/py:python_init_pip.bzl", "python_init_pip")
38+
39+
python_init_pip()
40+
41+
load("@pypi//:requirements.bzl", "install_deps")
42+
43+
install_deps()
44+
45+
# Toolchains for ML projects hermetic builds.
46+
# Details: https://github.com/google-ml-infra/rules_ml_toolchain
47+
http_archive(
48+
name = "rules_ml_toolchain",
49+
sha256 = "59d7eb36a02cbe3c2e2fa67fda5e8f1ab7e274bc4773bbd207c51fe199e11c19",
50+
strip_prefix = "rules_ml_toolchain-ffd9e3d7b84e43c2686c803cb08ce790ffd58baa",
51+
urls = [
52+
"https://github.com/google-ml-infra/rules_ml_toolchain/archive/ffd9e3d7b84e43c2686c803cb08ce790ffd58baa.tar.gz",
53+
],
54+
)
55+
56+
load(
57+
"@rules_ml_toolchain//gpu/cuda:cuda_json_init_repository.bzl",
58+
"cuda_json_init_repository",
59+
)
60+
61+
cuda_json_init_repository()
62+
63+
load(
64+
"@cuda_redist_json//:distributions.bzl",
65+
"CUDA_REDISTRIBUTIONS",
66+
"CUDNN_REDISTRIBUTIONS",
67+
)
68+
load(
69+
"@rules_ml_toolchain//gpu/cuda:cuda_redist_init_repositories.bzl",
70+
"cuda_redist_init_repositories",
71+
"cudnn_redist_init_repository",
72+
)
73+
74+
cuda_redist_init_repositories(
75+
cuda_redistributions = CUDA_REDISTRIBUTIONS,
76+
)
77+
78+
cudnn_redist_init_repository(
79+
cudnn_redistributions = CUDNN_REDISTRIBUTIONS,
80+
)
81+
82+
load(
83+
"@rules_ml_toolchain//gpu/cuda:cuda_configure.bzl",
84+
"cuda_configure",
85+
)
86+
87+
cuda_configure(name = "local_config_cuda")
88+
589
# Needed by protobuf
6-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
790
http_archive(
891
name = "bazel_skylib",
992
urls = [
@@ -29,11 +112,12 @@ bind(
29112
actual = "@six_archive//:six",
30113
)
31114

32-
http_archive(
115+
tf_http_archive(
33116
name = "com_google_protobuf",
34-
sha256 = "f66073dee0bc159157b0bd7f502d7d1ee0bc76b3c1eac9836927511bdc4b3fc1",
35-
strip_prefix = "protobuf-3.21.9",
36-
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.9.zip"],
117+
patch_file = ["@xla//third_party/protobuf:protobuf.patch"],
118+
sha256 = "f645e6e42745ce922ca5388b1883ca583bafe4366cc74cf35c3c9299005136e2",
119+
strip_prefix = "protobuf-5.28.3",
120+
urls = tf_mirror_urls("https://github.com/protocolbuffers/protobuf/archive/refs/tags/v5.28.3.zip"),
37121
)
38122

39123
# ZLIB. Need by com_google_protobuf.
@@ -48,6 +132,5 @@ http_archive(
48132
],
49133
)
50134

51-
52135
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
53136
protobuf_deps()

requirements.in

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# All the required dependencies should come with tf-nightly package.
2+
# The rest of the packages are mostly used for testing purpose.
3+
pandas
4+
pydot
5+
scipy
6+
protobuf >= 5.28.0, < 7.0
7+
tf-nightly
8+
portpicker
9+
pyyaml
10+
Pillow
11+
numpy >= 2.0.0, < 2.2.0 # Sync with the numpy version used in TF
12+
black==22.3.0
13+
isort==5.10.1
14+
flake8==4.0.1
15+
tensorboard
16+
tensorflow-io==0.37.1 ; python_version <= "3.12"
17+
# NVIDIA CUDA dependencies
18+
nvidia-cublas-cu12 == 12.5.3.2
19+
nvidia-cuda-cupti-cu12 == 12.5.82
20+
nvidia-cuda-nvrtc-cu12 == 12.5.82
21+
nvidia-cuda-runtime-cu12 == 12.5.82
22+
nvidia-cudnn-cu12 == 9.3.0.75
23+
nvidia-cufft-cu12 == 11.2.3.61
24+
nvidia-curand-cu12 == 10.3.6.82
25+
nvidia-cusolver-cu12 == 11.6.3.83
26+
nvidia-cusparse-cu12 == 12.5.1.3
27+
nvidia-nccl-cu12 == 2.25.1
28+
nvidia-nvjitlink-cu12 == 12.5.82

requirements.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33
pandas
44
pydot
55
scipy
6-
# Remove once both TensorFlow and TF-Keras nightly builds pass.
7-
# Temporarily enforce 4.21.6 version, as the only version which is compatible
8-
# with both new and old protobuf stubs. This is needed to resolve
9-
# Keras-TensorFlow circular dependency issue, when one of them gets a dependency
10-
# incompatible with another one (protobuf in this specific case).
11-
protobuf==4.21.6
126
tf-nightly
137
portpicker
148
pyyaml
159
Pillow
16-
numpy >= 1.26.0, < 2.1.0 # Sync with the numpy version used in TF
1710
black==22.3.0
1811
isort==5.10.1
1912
flake8==4.0.1

0 commit comments

Comments
 (0)