Skip to main content

cuCtxSetCurrent

Function cuCtxSetCurrent 

Source
pub unsafe extern "C" fn cuCtxSetCurrent(ctx: CUcontext) -> CUresult
Expand description

Binds the specified CUDA context to the calling CPU thread.

Binds the specified CUDA context to the calling CPU thread. If ctx is NULL then the CUDA context previously bound to the calling CPU thread is unbound and cudaError_enum::CUDA_SUCCESS is returned.

If there exists a CUDA context stack on the calling CPU thread, this will replace the top of that stack with ctx. If ctx is NULL then this will be equivalent to popping the top of the calling CPU thread’s CUDA context stack (or a no-op if the calling CPU thread’s CUDA context stack is empty).

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

§Parameters

  • ctx: Context to bind to the calling CPU thread

§Return value

See also: cuCtxGetCurrent, cuCtxCreate, cuCtxDestroy, cudaSetDevice.