Skip to main content

Module context

Module context 

Source
Expand description

CUDA contexts — both primary (shared with the Runtime API) and explicit.

A Context owns the handle returned by cuCtxCreate. Contexts are reference-counted via Arc so multiple streams/events/modules can share ownership; the underlying cuCtxDestroy runs when the last clone drops.

Structs§

Context
A CUDA context created by cuCtxCreate.
PrimaryContext
A retained reference to a device’s primary context — the one shared with the CUDA Runtime API (cudart). Use this when you need to mix driver-API kernels/streams with framework code that relies on the runtime API (most ML frameworks do).