Skip to content

Commit b305ea2

Browse files
Modified _get_context_device() helper routine
To fix test failures with CTK 11.8 and driver 535.247.01 only attempt to query _ctx_handle if _device_id is None. Ensure that context handle is set in Stream.context property
1 parent 48de1b3 commit b305ea2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cuda_core/cuda/core/experimental/_stream.pyx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,21 @@ cdef class Stream:
316316
self._get_device_and_context()
317317
return Device(self._device_id)
318318

319-
cdef _get_device_and_context(self):
320-
# Get the stream context first
319+
cdef void _get_context(Stream self) except *:
321320
if self._ctx_handle is None:
322321
err, self._ctx_handle = driver.cuStreamGetCtx(self._handle)
323322
raise_if_driver_error(err)
323+
324+
cdef void _get_device_and_context(Stream self) except *:
324325
if self._device_id is None:
326+
# Get the stream context first
327+
self._get_context()
325328
self._device_id = get_device_from_ctx(self._ctx_handle)
326-
raise_if_driver_error(err)
327329

328330
@property
329331
def context(self) -> Context:
330332
"""Return the :obj:`~_context.Context` associated with this stream."""
333+
self._get_context()
331334
self._get_device_and_context()
332335
return Context._from_ctx(self._ctx_handle, self._device_id)
333336

0 commit comments

Comments
 (0)