Expand description
Low-level FFI bindings for the CUDA driver and runtime APIs, NVRTC, NVVM, nvJitLink, NVTX, and the CUDA profiler.
Most users want the safe crate, singe-cuda.
§Bindings
| Binds | Header | Module | Feature |
|---|---|---|---|
| The CUDA driver API | cuda.h | driver | driver_13_4 |
| The CUDA runtime API | cuda_runtime_api.h | runtime | runtime_13_4 |
| CUDA profiler start and stop | cudaProfiler.h | profiler | driver_13_4 |
| Data types shared by the CUDA libraries | library_types.h | library_types | runtime_13_4 |
| NVRTC, which compiles CUDA C++ | nvrtc.h | nvrtc | nvrtc_13_4 |
| NVVM, which compiles NVVM IR | nvvm.h | nvvm | nvvm_13_4 |
| nvJitLink, which links device code | nvJitLink.h | nvjitlink | nvjitlink_13_4 |
| NVTX annotations | nvToolsExt.h | nvtx | nvtx_3 |
Every feature is on by default. The bindings are generated with bindgen from the CUDA 13.4 and NVTX 3 headers.
§Loading
Nothing links at build time.
singe_loader loads each library on the first call of one of its functions, or up front with load_driver, load_runtime, load_nvrtc, load_nvvm, load_nvjitlink, or load_nvtx.
When a library or one of its symbols is missing, a function that returns a status returns an error status, and take_absence reports what was missing.
A function without a status returns zero, null, or nothing instead.
provide_driver and provide_runtime serve the driver and runtime from an in-process implementation instead, such as singe-cuda-emulator.
Modules§
- driver
- CUDA Driver API declarations for contexts, memory, kernels, and graphs.
- library_
types - Scalar data types and library property enums shared by NVIDIA libraries.
- nvjitlink
- CUDA runtime linking library.
- nvrtc
- NVRTC runtime compilation declarations.
- nvtx
- NVTX event annotation declarations.
- nvvm
- NVVM IR compilation and version-query declarations.
- profiler
- CUDA profiler start and stop declarations.
- runtime
- CUDA Runtime API declarations and driver-compatible handle aliases.
Enums§
Functions§
- load_
driver - Loads the CUDA driver now, instead of on the first call of one of its functions.
- load_
nvjitlink - Loads nvJitLink now, instead of on the first call of one of its functions.
- load_
nvrtc - Loads NVRTC now, instead of on the first call of one of its functions.
- load_
nvtx - Loads NVTX now, instead of on the first call of one of its functions.
- load_
nvvm - Loads NVVM now, instead of on the first call of one of its functions.
- load_
runtime - Loads the CUDA runtime now, instead of on the first call of one of its functions.
- nvrtc_
paths - Returns the path of each NVRTC file, loading NVRTC first if it is not loaded yet.
- provide_
driver - Serves the CUDA driver’s functions from
provider, such as an emulator, instead of loading the driver. - provide_
runtime - Serves the CUDA runtime’s functions from
provider, such as an emulator, instead of loading the runtime. - take_
absence - Returns and clears the absence the last status-returning function called on this thread recorded.
Type Aliases§
- Provider
- Returns the address of the function a library exports as
name, orNoneif it has none.