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

feat: load("@rules_cuda_redist_json//:redist.bzl", "rules_cuda_components") #286

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

cloudhan
Copy link
Collaborator

@cloudhan cloudhan commented Oct 21, 2024

#283

cuda_redist_json repo rule download the redistrib.json (redist_json) from the urls, or download from nvidia's default repo if only version is specified. In the repo, we generate a redist.bzl file. The redist.bzl contains macros with wrapped cuda_component repo rules of the components specified in the cuda_redist_json's components attribute.

For example,

cuda_redist_json(
    name = "rules_cuda_redist_json",
    components = [
        "cccl",
        "cudart",
        "nvcc",
    ],
    version = "12.6.3",
)
  • Downloads redistrib.json from https://developer.download.nvidia.com/compute/cuda/redist/redistrib_12.6.3.json
  • Generates a redist.bzl with the content as follows:
    def rules_cuda_components():
        cuda_component(
            name = "local_cuda_cccl_v12.6.77",
            component_name = "cccl",
            # sha256, strip_prefix and urls automatically filled by reading redist.json
        )
    
        cuda_component(
            name = "local_cuda_cudart_v12.6.77",
            component_name = "cudart",
            # sha256, strip_prefix and urls automatically filled by reading redist.json
        )
    
        cuda_component(
            name = "local_cuda_nvcc_v12.6.85",
            component_name = "nvcc",
            # sha256, strip_prefix and urls automatically filled by reading redist.json
        )
    
        return {"cccl": "@local_cuda_cccl_v12.6.77", "cudart": "@local_cuda_cudart_v12.6.77", "nvcc": "@local_cuda_nvcc_v12.6.85"}
    
    def rules_cuda_components_and_toolchains(register_toolchains = False):
        components_mapping = rules_cuda_components()
        rules_cuda_toolchains(
            components_mapping= components_mapping,
            register_toolchains = register_toolchains,
            version = "12.6.3",
        )
    

User then

load("@rules_cuda_redist_json//:redist.bzl", "rules_cuda_components_and_toolchains")
rules_cuda_components_and_toolchains(register_toolchains = True)

Only WORKSPACE based project is addressed in this PR.

@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch 2 times, most recently from 49aaa29 to 9fd0d83 Compare December 15, 2024 05:56
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch from 9fd0d83 to f922cb1 Compare December 23, 2024 16:35
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from 45cb7a1 to e33993f Compare December 23, 2024 16:35
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch from f922cb1 to 06bbedf Compare December 30, 2024 13:22
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from e33993f to 574b5f3 Compare December 30, 2024 13:23
@cloudhan cloudhan mentioned this pull request Dec 30, 2024
14 tasks
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch from 06bbedf to daeceb6 Compare December 30, 2024 14:19
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from 574b5f3 to 456d770 Compare December 30, 2024 14:20
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch from daeceb6 to 9506e4c Compare December 30, 2024 14:33
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch 6 times, most recently from eafca8d to 9106b4e Compare January 9, 2025 16:43
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch 2 times, most recently from 87e98e6 to 27d7499 Compare January 9, 2025 16:47
@cloudhan cloudhan marked this pull request as ready for review January 9, 2025 16:47
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-2 branch from 496ecfc to 254e18d Compare February 22, 2025 03:02
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from 27d7499 to a1f48c7 Compare February 22, 2025 03:02
Base automatically changed from cloudhan/hermetic-ctk-2 to main February 22, 2025 03:23
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from a1f48c7 to c194026 Compare February 24, 2025 15:48
@cloudhan cloudhan force-pushed the cloudhan/hermetic-ctk-3 branch from c194026 to 92c3461 Compare February 25, 2025 03:35
@cloudhan cloudhan merged commit 3ace346 into main Feb 25, 2025
18 checks passed
@cloudhan cloudhan deleted the cloudhan/hermetic-ctk-3 branch February 25, 2025 13:17
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.

1 participant