Skip to content

Commit 787c85f

Browse files
Add hermetic CUDA repository rule calls to TF serving project.
See instructions [here](https://github.com/openxla/xla/blob/main/docs/hermetic_cuda.md). [XLA PR](openxla/xla#10673) introduced hermetic CUDA rules in ML OSS projects. Now all XLA downstream projects should call those rules in their workspaces. Also `.bazelrc` should use new environment variables for CUDA builds. PiperOrigin-RevId: 663396732
1 parent 727c55e commit 787c85f

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

.bazelrc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ build:cuda_clang --config=cuda
1212
build:cuda_clang --copt=-Wno-gnu-offsetof-extensions
1313
build:cuda_clang --copt=-Wno-error=unused-command-line-argument
1414
build:cuda_clang --host_copt=-Wno-error=unused-command-line-argument
15-
build:cuda_clang --repo_env TF_NEED_TENSORRT=1
15+
build:cuda_clang --repo_env TF_NEED_TENSORRT=0
1616
build:cuda_clang --action_env=TF_CUDA_CLANG="1"
1717
build:cuda_clang --@local_config_cuda//:cuda_compiler=clang
1818
build:cuda_clang --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_50,sm_60,sm_70,sm_80,compute_90"
1919

20-
build:cuda_clang --action_env=TF_CUDA_VERSION="12"
21-
build:cuda_clang --action_env=TF_CUDNN_VERSION="8"
22-
build:cuda_clang --action_env=CUDA_TOOLKIT_PATH="/usr/local/cuda-12.2"
20+
build:cuda_clang --repo_env=HERMETIC_CUDA_VERSION="12.2.0"
21+
build:cuda_clang --repo_env=HERMETIC_CUDNN_VERSION="8.9.4.25"
2322
build:cuda_clang --action_env=GCC_HOST_COMPILER_PATH="/dt9/usr/bin/gcc"
2423
build:cuda_clang --action_env=CLANG_CUDA_COMPILER_PATH="/usr/lib/llvm-17/bin/clang"
25-
build:cuda_clang --action_env=LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
2624

2725
# Options used to build with TPU support.
2826
build:tpu --define=with_tpu_support=true --define=framework_shared_object=false

WORKSPACE

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ local_repository(
2424
load("//tensorflow_serving:repo.bzl", "tensorflow_http_archive")
2525
tensorflow_http_archive(
2626
name = "org_tensorflow",
27-
sha256 = "37c31df1fd6ffc977b89fcc1df3dda00a10167bb9a9783c33002dbf47599401f",
28-
git_commit = "fa046f8e05897e19bf26fca342144e638026d67a",
27+
sha256 = "ff3d29623c5fa7fbf66e3f383b33381fbcd5bd8e1988ea9d5364273b639c1ed8",
28+
git_commit = "1ad7a2160315a64dd2a5cbde380e9478b671d043",
2929
)
3030

3131
# Import all of TensorFlow Serving's external dependencies.
@@ -84,3 +84,50 @@ load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_
8484
rules_proto_dependencies()
8585
rules_proto_toolchains()
8686

87+
load(
88+
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
89+
"cuda_json_init_repository",
90+
)
91+
92+
cuda_json_init_repository()
93+
94+
load(
95+
"@cuda_redist_json//:distributions.bzl",
96+
"CUDA_REDISTRIBUTIONS",
97+
"CUDNN_REDISTRIBUTIONS",
98+
)
99+
load(
100+
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
101+
"cuda_redist_init_repositories",
102+
"cudnn_redist_init_repository",
103+
)
104+
105+
cuda_redist_init_repositories(
106+
cuda_redistributions = CUDA_REDISTRIBUTIONS,
107+
)
108+
109+
cudnn_redist_init_repository(
110+
cudnn_redistributions = CUDNN_REDISTRIBUTIONS,
111+
)
112+
113+
load(
114+
"@local_tsl//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
115+
"cuda_configure",
116+
)
117+
118+
cuda_configure(name = "local_config_cuda")
119+
120+
load(
121+
"@local_tsl//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
122+
"nccl_redist_init_repository",
123+
)
124+
125+
nccl_redist_init_repository()
126+
127+
load(
128+
"@local_tsl//third_party/nccl/hermetic:nccl_configure.bzl",
129+
"nccl_configure",
130+
)
131+
132+
nccl_configure(name = "local_config_nccl")
133+

0 commit comments

Comments
 (0)