cuda.bindings._v2.driver.green_ctx_create#
- cuda.bindings._v2.driver.green_ctx_create(
- intptr_t desc,
- int dev,
- unsigned int flags,
Creates a green context with a specified set of resources.
This API creates a green context with the resources specified in the descriptor
descand returns it in the handle represented byph_ctx. This API will retain the primary context on devicedev, which will is released when the green context is destroyed. It is advised to have the primary context active before calling this API to avoid the heavy cost of triggering primary context initialization and deinitialization multiple times. The API does not set the green context current. In order to set it current, you need to explicitly set it current by first converting the green context to aCUcontextusingcuCtxFromGreenCtxand subsequently callingcuCtxSetCurrent/cuCtxPushCurrent. It should be noted that a green context can be current to only one thread at a time. There is no internal synchronization to make API calls accessing the same green context from multiple threads work. Note: The API is not supported on 32-bit platforms. The supported flags are:.CU_GREEN_CTX_NONE: Default behavior.CU_GREEN_CTX_DEFAULT_STREAM: Creates a default stream to use inside the green context.
- Parameters:
desc (intptr_t) – Descriptor generated via
cuDevResourceGenerateDescwhich contains the set of resources to be used.dev (int) – Device on which to create the green context.
flags (unsigned int) – One of the supported green context creation flags.
- Returns:
Pointer for the output handle to the green context.
- Return type:
intptr_t
See also
cuGreenCtxCreate