Skip to main content

Crate cudakit

Crate cudakit 

Source
Expand description

Driver-only CUDA host stack shared by speakrs and scriptrs

cudakit loads the NVIDIA driver (libcuda) at run time through cudarc and never loads the CUDA Runtime (libcudart), so a build needs no CUDA toolkit and a process needs only the driver. With the libraries feature, and only when the consumer’s Profile allows it, cuBLAS, cuDNN and NVRTC are loaded lazily after a symbol preflight.

  • Gpu owns one context and one stream, the device attributes and the optional library handles
  • Runtime adds a module cache for a consumer’s KernelAreas: embedded PTX and exact-architecture cubins, loaded by exact identity (ModuleRequest)
  • DeviceTensor is a shaped device buffer
  • Sgemm and SgemmBatched describe row-major cuBLAS products
  • Gpu::capture records stream work as a replayable Graph
  • dnn plans cuDNN convolutions (feature libraries)
  • identity reads the driver release for persisted tuning identities

Kernels are written with cuda-oxide in each consumer’s own kernels crate and built offline by cudakit-build; see the guide

Re-exports§

pub use cudarc;

Modules§

dnnlibraries
cuDNN forward convolutions: one planner and one plan type for every model
identity
Driver releases for persisted identities, such as tune files, with API-only identities kept apart so they are never saved as a release
symbols
Library entry points that cudakit checks before cudarc loads a library

Macros§

embed_tier
Embeds one area variant under exactly the consumer features for which it is the best shipped PTX

Structs§

AreaPtx
The PTX variants of one area embedded by this build
ArtifactHash
Content identity of bytes embedded in the running binary
BlasGuardlibraries
The shared cuBLAS handle in one math mode, from Gpu::blas
ComputeCapability
A device compute capability, ordered by major then minor version
Conv2d
An NCHW 2-D convolution on FP32 buffers (cross-correlation, as in PyTorch Conv2d)
DeviceAttributes
Device facts queried once per Gpu
DeviceAttributesBuildertest-support
Builds attributes for host-only tests in consumers
DeviceTensor
A device buffer with a row-major shape
EmbeddedCubin
One embedded binary, available only alongside its source PTX variant
EmbeddedPtx
The PTX fallback and exact-architecture binaries for one tier of one area
ExtraSymbols
Library entry points a consumer calls directly through cudarc, beyond the ones cudakit’s own wrappers reach
Gpu
One CUDA device context and stream, with optional libraries prepared on request
Graph
A recorded and instantiated sequence of work on one Gpu’s stream
LibraryVersionslibraries
Versions of the loaded numerical libraries, for tune-file identities
LoadedKernels
A kernel module loaded into a CUDA context
ModuleRequest
A complete module identity, resolved before the driver sees any bytes
Options
How to open a Runtime; consumers fill it from their own environment variables
Profile
A consumer’s build-wide CUDA policy, declared once as a constant
Runtime
A Gpu plus the kernel modules of one consumer’s areas
Sgemm
A row-major GEMM on FP32 buffers: c = alpha * op(a) · op(b) + beta * c
SgemmBatched
batch independent Sgemm products whose operands sit at fixed element strides in three buffers, such as one product per attention head
TierSet
A set of PTX tiers, usable in const context

Enums§

ArtifactLoadError
Failure to load the requested artifact, without substituting another artifact
Error
Errors from cudakit
Library
A CUDA shared library that cudakit loads at run time
LibraryPolicy
Whether a consumer may load optional numerical libraries
LoadedArtifact
The exact artifact accepted by the driver for a kernel area
Math
Arithmetic precision of cuBLAS and cuDNN work on FP32 data
PtxTier
A GPU generation that committed PTX can target

Traits§

KernelArea
A consumer’s kernel areas: one cuda-oxide module each, embedded per PTX tier

Functions§

check_len
Checks that a buffer holds exactly the elements an operation reads or writes
element_count
Number of elements in a shape, failing on overflow
load_artifact
Load exactly the requested bytes; driver rejection never tries the other format
to_c_int
Converts a dimension for a cuBLAS or cuDNN call
unfold_windows
Writes rows of window samples cut out of a device span into target