11.01.2014 Views

NVIDIA CUDA

NVIDIA CUDA

NVIDIA CUDA

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.25 Context Management 125<br />

4.25 Context Management<br />

Functions<br />

• CUresult cuCtxAttach (CUcontext ∗pctx, unsigned int flags)<br />

Increment a context’s usage-count.<br />

• CUresult cuCtxCreate (CUcontext ∗pctx, unsigned int flags, CUdevice dev)<br />

Create a <strong>CUDA</strong> context.<br />

• CUresult cuCtxDestroy (CUcontext ctx)<br />

Destroy the current context or a floating <strong>CUDA</strong> context.<br />

• CUresult cuCtxDetach (CUcontext ctx)<br />

Decrement a context’s usage-count.<br />

• CUresult cuCtxGetDevice (CUdevice ∗device)<br />

Returns the device ID for the current context.<br />

• CUresult cuCtxPopCurrent (CUcontext ∗pctx)<br />

Pops the current <strong>CUDA</strong> context from the current CPU thread.<br />

• CUresult cuCtxPushCurrent (CUcontext ctx)<br />

Pushes a floating context on the current CPU thread.<br />

• CUresult cuCtxSynchronize (void)<br />

Block for a context’s tasks to complete.<br />

4.25.1 Detailed Description<br />

This section describes the context management functions of the low-level <strong>CUDA</strong> driver application programming<br />

interface.<br />

4.25.2 Function Documentation<br />

4.25.2.1 cuCtxAttach (CUcontext ∗ pctx, unsigned int flags)<br />

Increments the usage count of the context and passes back a context handle in ∗pctx that must be passed to cuCtxDetach()<br />

when the application is done with the context. cuCtxAttach() fails if there is no context current to the<br />

thread.<br />

Currently, the flags parameter must be 0.<br />

Parameters:<br />

pctx - Returned context handle of the current context<br />

flags - Context attach flags (must be 0)<br />

Generated for <strong>NVIDIA</strong> <strong>CUDA</strong> Library by Doxygen

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!