Skip to main content

cudaDeviceGetExecutionCtx

Function cudaDeviceGetExecutionCtx 

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

Returns the execution context for a device.

Returns in ctx the execution context for the specified device. This is the device’s primary context. The returned context can then be passed to APIs that take in a cudaExecutionContext_t enabling explicit context-based programming without relying on thread-local state.

Passing the returned execution context to cudaExecutionCtxDestroy is not allowed and will result in undefined behavior.

§Parameters

  • ctx: Returns the device execution context.
  • device: Device to get the execution context for.

§Return value

See also: cudaExecutionCtxGetDevice, cudaExecutionCtxGetId.