Skip to content

Configure the toolchain

cuda_toolchain

load("@rules_cuda_docs//:toolchain_config_docs.bzl", "cuda_toolchain")

cuda_toolchain(name, compiler_executable, compiler_files, compiler_label, toolchain_config)

This rule consumes a CudaToolchainConfigInfo and provides a platform_common.ToolchainInfo, a.k.a, the CUDA Toolchain.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
compiler_executable The path of the main executable of this toolchain. Either compiler_executable or compiler_label must be specified. String optional ""
compiler_files The set of files that are needed when compiling using this toolchain. Label optional None
compiler_label The label of the main executable of this toolchain. Either compiler_executable or compiler_label must be specified. Label optional None
toolchain_config A target that provides a CudaToolchainConfigInfo. Label required

cuda_toolchain_config_clang

load("@rules_cuda_docs//:toolchain_config_docs.bzl", "cuda_toolchain_config_clang")

cuda_toolchain_config_clang(name, cuda_toolkit, toolchain_identifier)

This rule provides the predefined cuda toolchain configuration for Clang.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
cuda_toolkit A target that provides a CudaToolkitInfo. Label required
toolchain_identifier - String required

cuda_toolchain_config_nvcc

load("@rules_cuda_docs//:toolchain_config_docs.bzl", "cuda_toolchain_config_nvcc")

cuda_toolchain_config_nvcc(name, cuda_toolkit, nvcc_version_major, nvcc_version_minor,
                           toolchain_identifier)

This rule provides the predefined cuda toolchain configuration for NVCC with non MSVC as host compiler.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
cuda_toolkit A target that provides a CudaToolkitInfo. Label required
nvcc_version_major The CUDA Toolkit major version, e.g, 11 for 11.6 Integer optional 0
nvcc_version_minor The CUDA Toolkit minor version, e.g, 6 for 11.6 Integer optional 0
toolchain_identifier - String required

cuda_toolchain_config_nvcc_msvc

load("@rules_cuda_docs//:toolchain_config_docs.bzl", "cuda_toolchain_config_nvcc_msvc")

cuda_toolchain_config_nvcc_msvc(name, cuda_toolkit, msvc_env_tmp, nvcc_version_major,
                                nvcc_version_minor, toolchain_identifier)

This rule provides the predefined cuda toolchain configuration for NVCC with MSVC as host compiler.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
cuda_toolkit A target that provides a CudaToolkitInfo. Label required
msvc_env_tmp The TEMP directory. String optional ""
nvcc_version_major The CUDA Toolkit major version, e.g, 11 for 11.6 Integer optional 0
nvcc_version_minor The CUDA Toolkit minor version, e.g, 6 for 11.6 Integer optional 0
toolchain_identifier - String required

cuda_toolkit

load("@rules_cuda_docs//:toolchain_config_docs.bzl", "cuda_toolkit")

cuda_toolkit(name, bin2c, fatbinary, link_stub, nvlink, path, version)

This rule provides CudaToolkitInfo.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
bin2c The bin2c executable. Label optional None
fatbinary The fatbinary executable. Label optional None
link_stub The link.stub text file. Label optional None
nvlink The nvlink executable. Label optional None
path Root path to the CUDA Toolkit. String required
version Version of the CUDA Toolkit. String required