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, compiler_use_cc_toolchain,
               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 if compiler_use_cc_toolchain is not set. String optional ""
compiler_files The set of files that are needed when compiling using this toolchain. List of labels optional []
compiler_label The label of the main executable of this toolchain. Either compiler_executable or compiler_label must be specified. Label optional None
compiler_use_cc_toolchain Use existing cc_toolchain if configured as the compiler executable. Overrides compiler_executable or compiler_label Boolean optional False
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, exec_path_separator, 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
exec_path_separator PATH separator on the execution platform. Empty defaults to the Bazel client's separator for local execution. String optional ""
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, exec_path_separator, 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
exec_path_separator PATH separator on the execution platform. Empty defaults to the Bazel client's separator for local execution. 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_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, exec_path_separator, 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
exec_path_separator PATH separator on the execution platform. Empty defaults to the Bazel client's separator for local execution. String optional ""
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_info

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

cuda_toolkit_info(name, bin2c, cicc, device_runtime_static_libs, fatbinary, libdevice, link_stub,
                  nvlink, path, path_data, ptxas, 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
cicc The cicc executable. Label optional None
device_runtime_static_libs Static libraries needed for RDC device link and final host link. List of labels optional []
fatbinary The fatbinary executable. Label optional None
libdevice The libdevice LLVM bitcode library. 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. Will expand location. String required
path_data Required if expand location. List of labels optional []
ptxas The ptxas executable. Label optional None
version Version of the CUDA Toolkit. String required