Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce hermetic CUDA in Google ML projects. #10673

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Mar 18, 2024

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

    Default location of CUDA redistributions

    Default location of NCCL redistributions

  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")
    

@copybara-service copybara-service bot force-pushed the test_616865795 branch 21 times, most recently from a70493b to b33ee0c Compare March 25, 2024 18:39
@copybara-service copybara-service bot force-pushed the test_616865795 branch 9 times, most recently from 3359d97 to d5243b0 Compare March 28, 2024 18:06
@copybara-service copybara-service bot force-pushed the test_616865795 branch 4 times, most recently from 7540bf5 to a64b2a7 Compare August 6, 2024 00:41
Copy link

@cliffwoolley cliffwoolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, all my feedback has been addressed now, thanks.
LGTM

@copybara-service copybara-service bot force-pushed the test_616865795 branch 4 times, most recently from cec9075 to 8bed0aa Compare August 7, 2024 01:26
@copybara-service copybara-service bot force-pushed the test_616865795 branch 15 times, most recently from 7436960 to 052ebcd Compare August 13, 2024 22:03
@copybara-service copybara-service bot closed this Aug 14, 2024
@copybara-service copybara-service bot deleted the test_616865795 branch August 14, 2024 18:11
copybara-service bot pushed a commit to tensorflow/serving that referenced this pull request Aug 15, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants