cuda.bindings._v2.driver.stream_get_green_ctx#

cuda.bindings._v2.driver.stream_get_green_ctx(intptr_t h_stream) → intptr_t#

Query the green context associated with a stream.

Returns the CUDA green context that the stream is associated with, or NULL if the stream is not associated with any green context. The stream handle h_stream can refer to any of the following:.

  • a stream created via any of the CUDA driver APIs such as cuStreamCreate, cuStreamCreateWithPriority and cuGreenCtxStreamCreate, or their runtime API equivalents such as cudaStreamCreate, cudaStreamCreateWithFlags and cudaStreamCreateWithPriority. If during stream creation the context that was active in the calling thread was obtained with cuCtxFromGreenCtx, that green context is returned in ph_ctx. Otherwise, *ph_ctx is set to NULL instead.

  • special stream such as the NULL stream or CU_STREAM_LEGACY. In that case if context that is active in the calling thread was obtained with cuCtxFromGreenCtx, that green context is returned. Otherwise, *ph_ctx is set to NULL instead.

Passing an invalid handle will result in undefined behavior.

Parameters:

h_stream (intptr_t) – Handle to the stream to be queried.

Returns:

Returned green context associated with the stream.

Return type:

intptr_t

See also

cuStreamGetGreenCtx