<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>NVIDIA CUDA Library: cuCtxAttach</title> <link href="customdoxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> </div> <div class="contents"> <div class="navpath"><a class="el" href="group__CUDA__CTX__DEPRECATED.html">Context Management [DEPRECATED]</a> </div> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top"> <div class="navtab"> <table> <tr><td class="navtab"><a class="qindexHL" href="group__CUDA__CTX__DEPRECATED_g37ec990b2a75ed46f25a48b1a425b4f0.html#g37ec990b2a75ed46f25a48b1a425b4f0">cuCtxAttach</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDA__CTX__DEPRECATED_g3136efc315abd4c4455e875b9dbb65a1.html#g3136efc315abd4c4455e875b9dbb65a1">cuCtxDetach</a></td></tr> </table> </div> </td> <td valign="top"> <a class="anchor" name="g37ec990b2a75ed46f25a48b1a425b4f0"></a><!-- doxytag: member="cuda.h::cuCtxAttach" ref="g37ec990b2a75ed46f25a48b1a425b4f0" args="(CUcontext *pctx, unsigned int flags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__CUDA__TYPES_g09da14df1a751dcbfeccb9cf0073d64c.html#g09da14df1a751dcbfeccb9cf0073d64c">CUresult</a> cuCtxAttach </td> <td>(</td> <td class="paramtype"><a class="el" href="group__CUDA__TYPES_gf9f5bd81658f866613785b3a0bb7d7d9.html#gf9f5bd81658f866613785b3a0bb7d7d9">CUcontext</a> * </td> <td class="paramname"> <em>pctx</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>flags</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> <dl compact><dt><b><a class="el" href="deprecated.html#_deprecated000046">Deprecated:</a></b></dt><dd></dd></dl> Note that this function is deprecated and should not be used.<p> Increments the usage count of the context and passes back a context handle in <code>*pctx</code> that must be passed to <a class="el" href="group__CUDA__CTX__DEPRECATED_g3136efc315abd4c4455e875b9dbb65a1.html#g3136efc315abd4c4455e875b9dbb65a1" title="Decrement a context's usage-count.">cuCtxDetach()</a> when the application is done with the context. <a class="el" href="group__CUDA__CTX__DEPRECATED_g37ec990b2a75ed46f25a48b1a425b4f0.html#g37ec990b2a75ed46f25a48b1a425b4f0" title="Increment a context's usage-count.">cuCtxAttach()</a> fails if there is no context current to the thread.<p> Currently, the <code>flags</code> parameter must be 0.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pctx</em> </td><td>- Returned context handle of the current context </td></tr> <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td>- Context attach flags (must be 0)</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaa0eed720f8a87cd1c5fd1c453bc7a03d">CUDA_SUCCESS</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaacf52f132faf29b473cdda6061f0f44a">CUDA_ERROR_DEINITIALIZED</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa8feb999f0af99b4a25ab26b3866f4df8">CUDA_ERROR_NOT_INITIALIZED</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaa484e9af32c1e9893ff21f0e0191a12d">CUDA_ERROR_INVALID_CONTEXT</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa90696c86fcee1f536a1ec7d25867feeb">CUDA_ERROR_INVALID_VALUE</a> </dd></dl> <dl class="note" compact><dt><b>Note:</b></dt><dd>Note that this function may also return error codes from previous, asynchronous launches.</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__CUDA__CTX_g65dc0012348bc84810e2103a40d8e2cf.html#g65dc0012348bc84810e2103a40d8e2cf" title="Create a CUDA context.">cuCtxCreate</a>, <a class="el" href="group__CUDA__CTX_g27a365aebb0eb548166309f58a1e8b8e.html#g27a365aebb0eb548166309f58a1e8b8e" title="Destroy a CUDA context.">cuCtxDestroy</a>, <a class="el" href="group__CUDA__CTX__DEPRECATED_g3136efc315abd4c4455e875b9dbb65a1.html#g3136efc315abd4c4455e875b9dbb65a1" title="Decrement a context's usage-count.">cuCtxDetach</a>, <a class="el" href="group__CUDA__CTX_g088a90490dafca5893ef6fbebc8de8fb.html#g088a90490dafca5893ef6fbebc8de8fb" title="Gets the context's API version.">cuCtxGetApiVersion</a>, <a class="el" href="group__CUDA__CTX_g40b6b141698f76744dea6e39b9a25360.html#g40b6b141698f76744dea6e39b9a25360" title="Returns the preferred cache configuration for the current context.">cuCtxGetCacheConfig</a>, <a class="el" href="group__CUDA__CTX_g4e84b109eba36cdaaade167f34ae881e.html#g4e84b109eba36cdaaade167f34ae881e" title="Returns the device ID for the current context.">cuCtxGetDevice</a>, <a class="el" href="group__CUDA__CTX_g9f2d47d1745752aa16da7ed0d111b6a8.html#g9f2d47d1745752aa16da7ed0d111b6a8" title="Returns resource limits.">cuCtxGetLimit</a>, <a class="el" href="group__CUDA__CTX_g2fac188026a062d92e91a8687d0a7902.html#g2fac188026a062d92e91a8687d0a7902" title="Pops the current CUDA context from the current CPU thread.">cuCtxPopCurrent</a>, <a class="el" href="group__CUDA__CTX_gb02d4c850eb16f861fe5a29682cc90ba.html#gb02d4c850eb16f861fe5a29682cc90ba" title="Pushes a context on the current CPU thread.">cuCtxPushCurrent</a>, <a class="el" href="group__CUDA__CTX_g54699acf7e2ef27279d013ca2095f4a3.html#g54699acf7e2ef27279d013ca2095f4a3" title="Sets the preferred cache configuration for the current context.">cuCtxSetCacheConfig</a>, <a class="el" href="group__CUDA__CTX_g0651954dfb9788173e60a9af7201e65a.html#g0651954dfb9788173e60a9af7201e65a" title="Set resource limits.">cuCtxSetLimit</a>, <a class="el" href="group__CUDA__CTX_g7a54725f28d34b8c6299f0c6ca579616.html#g7a54725f28d34b8c6299f0c6ca579616" title="Block for a context's tasks to complete.">cuCtxSynchronize</a> </dd></dl> </div> </div><p> </td> </tr> </table> </div> <hr size="1"><address style="text-align: right;"><small> Generated by Doxygen for NVIDIA CUDA Library <a href="http://www.nvidia.com/cuda"><img src="nvidia_logo.jpg" alt="NVIDIA" align="middle" border="0" height="80"></a></small></address> </body> </html>