2024-03-27 17:27:49 +00:00
|
|
|
# buildifier: disable=load-on-top
|
|
|
|
|
2016-05-26 19:05:13 +00:00
|
|
|
workspace(name = "org_tensorflow")
|
|
|
|
|
2024-04-05 21:30:08 +00:00
|
|
|
# buildifier: disable=load-on-top
|
|
|
|
|
2023-07-06 19:19:25 +00:00
|
|
|
# We must initialize hermetic python first.
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
|
2024-04-05 03:44:26 +00:00
|
|
|
http_archive(
|
|
|
|
name = "rules_java",
|
|
|
|
sha256 = "c73336802d0b4882e40770666ad055212df4ea62cfa6edf9cb0f9d29828a0934",
|
|
|
|
url = "https://github.com/bazelbuild/rules_java/releases/download/5.3.5/rules_java-5.3.5.tar.gz",
|
|
|
|
)
|
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
# Initialize the TensorFlow repository and all dependencies.
|
|
|
|
#
|
|
|
|
# The cascade of load() statements and tf_workspace?() calls works around the
|
|
|
|
# restriction that load() statements need to be at the top of .bzl files.
|
|
|
|
# E.g. we can not retrieve a new repository with http_archive and then load()
|
|
|
|
# a macro from that repository in the same file.
|
|
|
|
load("@//tensorflow:workspace3.bzl", "tf_workspace3")
|
2023-10-09 12:28:06 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
tf_workspace3()
|
2023-10-09 12:28:06 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
# Initialize hermetic Python
|
|
|
|
load("@local_xla//third_party/py:python_init_rules.bzl", "python_init_rules")
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
python_init_rules()
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
load("@local_xla//third_party/py:python_init_repositories.bzl", "python_init_repositories")
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
python_init_repositories(
|
|
|
|
default_python_version = "system",
|
|
|
|
requirements = {
|
|
|
|
"3.9": "//:requirements_lock_3_9.txt",
|
|
|
|
"3.10": "//:requirements_lock_3_10.txt",
|
|
|
|
"3.11": "//:requirements_lock_3_11.txt",
|
|
|
|
"3.12": "//:requirements_lock_3_12.txt",
|
|
|
|
},
|
2023-07-06 19:19:25 +00:00
|
|
|
)
|
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
load("@local_xla//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
python_init_toolchains()
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
load("@local_xla//third_party/py:python_init_pip.bzl", "python_init_pip")
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
python_init_pip()
|
2023-07-06 19:19:25 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
load("@pypi//:requirements.bzl", "install_deps")
|
2021-01-18 19:01:52 +00:00
|
|
|
|
2024-06-28 23:54:53 +00:00
|
|
|
install_deps()
|
|
|
|
# End hermetic Python initialization
|
2021-01-18 19:01:52 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
load("@//tensorflow:workspace2.bzl", "tf_workspace2")
|
2021-01-18 19:01:52 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
tf_workspace2()
|
2018-11-30 19:11:23 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
load("@//tensorflow:workspace1.bzl", "tf_workspace1")
|
2017-02-04 01:13:49 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
tf_workspace1()
|
2019-06-19 11:14:12 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
load("@//tensorflow:workspace0.bzl", "tf_workspace0")
|
2020-12-02 05:04:15 +00:00
|
|
|
|
2021-02-01 19:59:46 +00:00
|
|
|
tf_workspace0()
|
Introduce hermetic CUDA in Google ML projects.
1) Hermetic CUDA rules allow building wheels with GPU support on a machine without GPUs, as well as running Bazel GPU tests on a machine with only GPUs and NVIDIA driver installed. When `--config=cuda` is provided in Bazel options, Bazel will download CUDA, CUDNN and NCCL redistributions in the cache, and use them during build and test phases.
[Default location of CUNN redistributions](https://developer.download.nvidia.com/compute/cudnn/redist/)
[Default location of CUDA redistributions](https://developer.download.nvidia.com/compute/cuda/redist/)
[Default location of NCCL redistributions](https://pypi.org/project/nvidia-nccl-cu12/#history)
2) To include hermetic CUDA rules in your project, add the following in the WORKSPACE of the downstream project dependent on XLA.
Note: use `@local_tsl` instead of `@tsl` in Tensorflow project.
```
load(
"@tsl//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
"cuda_json_init_repository",
)
cuda_json_init_repository()
load(
"@cuda_redist_json//:distributions.bzl",
"CUDA_REDISTRIBUTIONS",
"CUDNN_REDISTRIBUTIONS",
)
load(
"@tsl//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
"cuda_redist_init_repositories",
"cudnn_redist_init_repository",
)
cuda_redist_init_repositories(
cuda_redistributions = CUDA_REDISTRIBUTIONS,
)
cudnn_redist_init_repository(
cudnn_redistributions = CUDNN_REDISTRIBUTIONS,
)
load(
"@tsl//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
"cuda_configure",
)
cuda_configure(name = "local_config_cuda")
load(
"@tsl//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
"nccl_redist_init_repository",
)
nccl_redist_init_repository()
load(
"@tsl//third_party/nccl/hermetic:nccl_configure.bzl",
"nccl_configure",
)
nccl_configure(name = "local_config_nccl")
```
PiperOrigin-RevId: 662981325
2024-08-14 17:57:53 +00:00
|
|
|
|
|
|
|
load(
|
|
|
|
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
|
|
|
|
"cuda_json_init_repository",
|
|
|
|
)
|
|
|
|
|
|
|
|
cuda_json_init_repository()
|
|
|
|
|
|
|
|
load(
|
|
|
|
"@cuda_redist_json//:distributions.bzl",
|
|
|
|
"CUDA_REDISTRIBUTIONS",
|
|
|
|
"CUDNN_REDISTRIBUTIONS",
|
|
|
|
)
|
|
|
|
load(
|
|
|
|
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
|
|
|
|
"cuda_redist_init_repositories",
|
|
|
|
"cudnn_redist_init_repository",
|
|
|
|
)
|
|
|
|
|
|
|
|
cuda_redist_init_repositories(
|
|
|
|
cuda_redistributions = CUDA_REDISTRIBUTIONS,
|
|
|
|
)
|
|
|
|
|
|
|
|
cudnn_redist_init_repository(
|
|
|
|
cudnn_redistributions = CUDNN_REDISTRIBUTIONS,
|
|
|
|
)
|
|
|
|
|
|
|
|
load(
|
|
|
|
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
|
|
|
|
"cuda_configure",
|
|
|
|
)
|
|
|
|
|
|
|
|
cuda_configure(name = "local_config_cuda")
|
|
|
|
|
|
|
|
load(
|
|
|
|
"@local_tsl//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
|
|
|
|
"nccl_redist_init_repository",
|
|
|
|
)
|
|
|
|
|
|
|
|
nccl_redist_init_repository()
|
|
|
|
|
|
|
|
load(
|
|
|
|
"@local_tsl//third_party/nccl/hermetic:nccl_configure.bzl",
|
|
|
|
"nccl_configure",
|
|
|
|
)
|
|
|
|
|
|
|
|
nccl_configure(name = "local_config_nccl")
|