Skip to content
Open
9 changes: 5 additions & 4 deletions cuda_core/cuda/core/_context.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from cuda.core._resource_handles cimport (
)
from cuda.core._stream import Stream, StreamOptions
from cuda.core._utils.cuda_utils cimport HANDLE_RETURN
from cuda.core._utils.properties import python_property


__all__ = ['Context', 'ContextOptions']
Expand Down Expand Up @@ -57,7 +58,7 @@ cdef class Context:
raise RuntimeError("Failed to create CUDA context view from green context")
return Context._from_handle(cls, h_context, device_id)

@property
@python_property
def handle(self):
"""Return the underlying CUcontext handle."""
if not self._h_context:
Expand All @@ -66,18 +67,18 @@ cdef class Context:
return None
return as_py(self._h_context)

@property
@python_property
def _handle(self):
return self.handle

@property
@python_property
def is_green(self) -> bool:
"""True if this context was created from device resources."""
if not self._h_context:
return False
return get_context_green_ctx(self._h_context).get() != NULL

@property
@python_property
def resources(self) -> DeviceResources:
"""Query the hardware resources provisioned for this context.

Expand Down
Loading
Loading