cuda.bindings._v2.driver.device_primary_ctx_retain#
- cuda.bindings._v2.driver.device_primary_ctx_retain(int dev) intptr_t#
Retain the primary context on the GPU.
Retains the primary context on the device. Once the user successfully retains the primary context, the primary context will be active and available to the user until the user releases it with
cuDevicePrimaryCtxRelease()or resets it withcuDevicePrimaryCtxReset(). UnlikecuCtxCreate()the newly retained context is not pushed onto the stack. Retaining the primary context for the first time will fail withCUDA_ERROR_UNKNOWNif the compute mode of the device isCU_COMPUTEMODE_PROHIBITED. The functiondevice_get_attribute()can be used withCU_DEVICE_ATTRIBUTE_COMPUTE_MODEto determine the compute mode of the device. Thenvidia-smitool can be used to set the compute mode for devices. Documentation fornvidia-smican be obtained by passing a -h option to it. Please note that the primary context always supports pinned allocations. Other flags can be specified bycuDevicePrimaryCtxSetFlags().- Parameters:
dev (int) – Device for which primary context is requested.
- Returns:
Returned context handle of the new context.
- Return type:
intptr_t
See also
cuDevicePrimaryCtxRetain