Skip to content

hermeticbuild/cuda-toolkit

Repository files navigation

CUDA Toolkit

CI

image

Project Overview

This repository provides the CUDA toolkit (CUDA, cuDNN, and related redistributions) hermetically using Bazel.

This project has similarities with rules_cuda or rules_ml_toolchain except that it provides only the CUDA toolkit without any toolchain definitions or usage assumptions.

It is meant to be consumed by other Bazel projects, notably rulesets and toolchains.

Supported versions

Supported versions are defined in:

  • cuda/cuda_redist_versions.json
  • cudnn/cudnn_redist_versions.json
  • nvshmem/nvshmem_redist_versions.json

Supported platforms

CUDA components are typically published for these platforms:

  • linux-x86_64
  • linux-sbsa

This module exposes each component through proxy subpackages:

  • @cuda//<component>

These proxy targets are platform-aware and resolve to the correct concrete package for the active Bazel configuration.

For example, @cuda//nvcc:ptxas used from an attribute with cfg = "exec" resolves automatically to the appropriate execution-platform binary.

Recommended usage

Example MODULE.bazel setup:

cuda_ext = use_extension("@cuda_toolkit//extensions:cuda.bzl", "cuda")

cuda_ext.redist(
    name = "cuda_12_9_1",
    version = "12.9.1",
    cudnn_version = "8.9.7",
    nvshmem_version = "3.3.24",
)

use_repo(cuda_ext, "cuda")

Notes

  • CUDA versions are registered explicitly with cuda_ext.redist(...).
  • cuDNN and NVSHMEM versions, when used, are pinned on the same cuda_ext.redist(...) tag.
  • CUDA packages under @cuda//<components> are platform-resolving proxies. The selected concrete redistribution is chosen from the current Bazel configuration platform (including exec config).
  • For local validation on non-Linux hosts, you can force Linux selection with --platforms=//:platform_linux_amd64 or --platforms=//:platform_linux_arm64.

License

This project is licensed under the MIT License.

About

Hermetic CUDA Toolkit using Bazel

Resources

License

Stars

Watchers

Forks

Contributors