Skip to main content

cudaExecutionCtxGetId

Function cudaExecutionCtxGetId 

Source
pub unsafe extern "C" fn cudaExecutionCtxGetId(
    ctx: cudaExecutionContext_t,
    ctxId: *mut c_ulonglong,
) -> cudaError_t
Expand description

Returns the unique Id associated with the execution context supplied.

Returns in ctxId the unique Id which is associated with a given context. The Id is unique for the life of the program for this instance of CUDA. 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

  • ctx: Context for which to obtain the Id (required parameter, see note below).
  • ctxId: Pointer to store the Id of the context.

§Return value

See also: cudaGreenCtxCreate, cudaExecutionCtxDestroy, cudaExecutionCtxGetDevice, cuCtxGetId.