Skip to main content

cudaExecutionCtxGetDevice

Function cudaExecutionCtxGetDevice 

Source
pub unsafe extern "C" fn cudaExecutionCtxGetDevice(
    device: *mut c_int,
    ctx: cudaExecutionContext_t,
) -> cudaError_t
Expand description

Returns the device handle for the execution context.

Returns in *device the handle of the specified execution context’s device. The execution context should not be NULL.

Note that this function may also return error codes from previous, asynchronous launches.

Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaError_t::CUDA_ERROR_NOT_PERMITTED may, but is not guaranteed to, be returned as a diagnostic in such case.

Note: The context parameter is required and the API ignores the context that is current to the calling thread. This enables explicit context-based programming without relying on thread-local state. If no context is specified, the API will return cudaError_t::CUDA_ERROR_INVALID_VALUE.

§Parameters

  • device: Returned device handle for the specified execution context.
  • ctx: Execution context for which to obtain the device (required parameter, see note below).

§Return value

See also: cudaGreenCtxCreate, cudaExecutionCtxDestroy, cuCtxGetDevice.