cuda.core.Context#
- class cuda.core.Context(*args, **kwargs)#
CUDA context wrapper.
Context objects represent CUDA contexts and cannot be instantiated directly. Use Device or Stream APIs to obtain context objects.
Methods
- __init__(*args, **kwargs)#
- close(self)#
Release this context wrapper’s underlying CUDA handles.
- create_stream(self, options: StreamOptions | None = None)#
Create a new stream bound to this green context.
This method is only available on green contexts. For primary contexts, use
Device.create_stream()instead.- Parameters:
options (
StreamOptions, optional) – Customizable dataclass for stream creation options.- Returns:
Newly created stream object.
- Return type:
Attributes
- handle#
Return the underlying CUcontext handle.
- is_green#
True if this context was created from device resources.
- resources#
Query the hardware resources provisioned for this context.
For green contexts, returns the resources this context was created with (SM partition, workqueue config). For primary contexts, returns the full device resources.
Raises
RuntimeErrorif the context has been closed.