Function cuDevicePrimaryCtxRetain

Source
pub unsafe extern "C" fn cuDevicePrimaryCtxRetain(
    pctx: *mut CUcontext,
    dev: CUdevice,
) -> CUresult
Expand description

\brief 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 with ::cuDevicePrimaryCtxReset(). Unlike ::cuCtxCreate() the newly retained context is not pushed onto the stack.

Retaining the primary context for the first time will fail with ::CUDA_ERROR_UNKNOWN if the compute mode of the device is ::CU_COMPUTEMODE_PROHIBITED. The function ::cuDeviceGetAttribute() can be used with ::CU_DEVICE_ATTRIBUTE_COMPUTE_MODE to determine the compute mode of the device. The nvidia-smi tool can be used to set the compute mode for devices. Documentation for nvidia-smi can be obtained by passing a -h option to it.

Please note that the primary context always supports pinned allocations. Other flags can be specified by ::cuDevicePrimaryCtxSetFlags().

\param pctx - Returned context handle of the new context \param dev - Device for which primary context is requested

\return ::CUDA_SUCCESS, ::CUDA_ERROR_DEINITIALIZED, ::CUDA_ERROR_NOT_INITIALIZED, ::CUDA_ERROR_INVALID_CONTEXT, ::CUDA_ERROR_INVALID_DEVICE, ::CUDA_ERROR_INVALID_VALUE, ::CUDA_ERROR_OUT_OF_MEMORY, ::CUDA_ERROR_UNKNOWN \notefnerr

\sa ::cuDevicePrimaryCtxRelease, ::cuDevicePrimaryCtxSetFlags, ::cuCtxCreate, ::cuCtxGetApiVersion, ::cuCtxGetCacheConfig, ::cuCtxGetDevice, ::cuCtxGetFlags, ::cuCtxGetLimit, ::cuCtxPopCurrent, ::cuCtxPushCurrent, ::cuCtxSetCacheConfig, ::cuCtxSetLimit, ::cuCtxSynchronize