rules_cuda
rules_cuda copied to clipboard
feat: `load("@rules_cuda_redist_json//:redist.bzl", "rules_cuda_components")`
#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.jsonfromhttps://developer.download.nvidia.com/compute/cuda/redist/redistrib_12.6.3.json - Generates a
redist.bzlwith 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.