Skip to content

Commit 7d4187e

Browse files
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
1 parent 5b47d57 commit 7d4187e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

site/en/install/source.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ Preconfigured Bazel build configs to DISABLE default on features:
211211

212212
#### GPU support
213213

214+
##### from v.2.18.0
215+
For [GPU support](./pip.md), set `cuda=Y` during configuration and specify the
216+
versions of CUDA and cuDNN if required. Bazel will download CUDA and CUDNN
217+
packages automatically or point to CUDA/CUDNN/NCCL redistributions on local file
218+
system if required.
219+
220+
##### before v.2.18.0
214221
For [GPU support](./pip.md), set `cuda=Y` during configuration and specify the
215222
versions of CUDA and cuDNN. If your system has multiple versions of CUDA or
216223
cuDNN installed, explicitly set the version instead of relying on the default.
@@ -370,6 +377,9 @@ On your host machine, the TensorFlow *pip* package is in the current directory
370377

371378
### GPU support
372379

380+
Note: Starting from Tensorflow v.2.18.0 the wheels can be built from
381+
source on a machine without GPUs and without NVIDIA driver installed.
382+
373383
Docker is the easiest way to build GPU support for TensorFlow since the *host*
374384
machine only requires the
375385
[NVIDIA® driver](https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#how-do-i-install-the-nvidia-driver)

0 commit comments

Comments
 (0)