1+ from __future__ import annotations
2+
3+ from collections .abc import Sequence
4+ from dataclasses import dataclass
5+
6+ from cuda .core ._device_resources import (DeviceResources , SMResource ,
7+ WorkqueueResource )
8+ from cuda .core ._stream import StreamOptions
9+
10+
11+ class Context :
12+ """CUDA context wrapper.
13+
14+ Context objects represent CUDA contexts and cannot be instantiated directly.
15+ Use Device or Stream APIs to obtain context objects.
16+ """
17+
18+ def close (self ):
19+ """Release this context wrapper's underlying CUDA handles."""
20+
21+ def __init__ (self , * args , ** kwargs ):
22+ ...
23+
24+ @property
25+ def handle (self ):
26+ """Return the underlying CUcontext handle."""
27+
28+ @property
29+ def _handle (self ):
30+ ...
31+
32+ @property
33+ def is_green (self ) -> bool :
34+ """True if this context was created from device resources."""
35+
36+ @property
37+ def resources (self ) -> DeviceResources :
38+ """Query the hardware resources provisioned for this context.
39+
40+ For green contexts, returns the resources this context was created
41+ with (SM partition, workqueue config). For primary contexts, returns
42+ the full device resources.
43+
44+ Raises :class:`RuntimeError` if the context has been closed.
45+ """
46+
47+ def create_stream (self , options : StreamOptions | None = None ):
48+ """Create a new stream bound to this green context.
49+
50+ This method is only available on green contexts. For primary
51+ contexts, use :meth:`Device.create_stream` instead.
52+
53+ Parameters
54+ ----------
55+ options : :obj:`~_stream.StreamOptions`, optional
56+ Customizable dataclass for stream creation options.
57+
58+ Returns
59+ -------
60+ :obj:`~_stream.Stream`
61+ Newly created stream object.
62+ """
63+
64+ def __eq__ (self , other ):
65+ ...
66+
67+ def __hash__ (self ) -> int :
68+ ...
69+
70+ def __repr__ (self ) -> str :
71+ ...
72+
73+ @dataclass
74+ class ContextOptions :
75+ """Options for context creation.
76+
77+ Attributes
78+ ----------
79+ resources : :obj:`~cuda.core.typing.DeviceResourcesType`
80+ Device resources used to create a green context.
81+ """
82+ resources : DeviceResourcesType
83+ __all__ = ['Context' , 'ContextOptions' ]
84+ DeviceResourcesType = Sequence [SMResource | WorkqueueResource ]
85+
86+ # This file was generated by stubgen-pyx v0.2.5 from cuda_core/cuda/core/_context.pyx
0 commit comments