<!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: cudaDeviceEnablePeerAccess</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__CUDART__PEER.html">Peer Device Memory Access</a> </div> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top"> <div class="navtab"> <table> <tr><td class="navtab"><a class="qindex" href="group__CUDART__PEER_gbc095a10a4d953e972ef918997c5e567.html#gbc095a10a4d953e972ef918997c5e567">cudaDeviceCanAccessPeer</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__PEER_gae24fc50bd0f1ce7f69032f91bde87ac.html#gae24fc50bd0f1ce7f69032f91bde87ac">cudaDeviceDisablePeerAccess</a></td></tr> <tr><td class="navtab"><a class="qindexHL" href="group__CUDART__PEER_g9e5ea65a18938c2b8715a5602105c306.html#g9e5ea65a18938c2b8715a5602105c306">cudaDeviceEnablePeerAccess</a></td></tr> </table> </div> </td> <td valign="top"> <a class="anchor" name="g9e5ea65a18938c2b8715a5602105c306"></a><!-- doxytag: member="cuda_runtime_api.h::cudaDeviceEnablePeerAccess" ref="g9e5ea65a18938c2b8715a5602105c306" args="(int peerDevice, unsigned int flags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__CUDART__TYPES_gf599e5b8b829ce7db0f5216928f6ecb6.html#gf599e5b8b829ce7db0f5216928f6ecb6">cudaError_t</a> cudaDeviceEnablePeerAccess </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>peerDevice</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> Enables registering memory on <code>peerDevice</code> for direct access from the current device. On success, allocations on <code>peerDevice</code> may be registered for access from the current device using cudaPeerRegister(). Registering peer memory will be possible until it is explicitly disabled using <a class="el" href="group__CUDART__PEER_gae24fc50bd0f1ce7f69032f91bde87ac.html#gae24fc50bd0f1ce7f69032f91bde87ac" title="Disables direct access to memory allocations on a peer device and unregisters any...">cudaDeviceDisablePeerAccess()</a>, or either the current device or <code>peerDevice</code> is reset using <a class="el" href="group__CUDART__DEVICE_gdcc2c6f914eb9461565b12648faa5e28.html#gdcc2c6f914eb9461565b12648faa5e28" title="Destroy all allocations and reset all state on the current device in the current...">cudaDeviceReset()</a>.<p> If both the current device and <code>peerDevice</code> support unified addressing then all allocations from <code>peerDevice</code> will immediately be accessible by the current device upon success. In this case, explicitly sharing allocations using cudaPeerRegister() is not necessary.<p> Note that access granted by this call is unidirectional and that in order to access memory on the current device from <code>peerDevice</code>, a separate symmetric call to <a class="el" href="group__CUDART__PEER_g9e5ea65a18938c2b8715a5602105c306.html#g9e5ea65a18938c2b8715a5602105c306" title="Enables direct access to memory allocations on a peer device.">cudaDeviceEnablePeerAccess()</a> is required.<p> Returns <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038938c6e8b96ecde62e3ab5137156f739a">cudaErrorInvalidDevice</a> if <a class="el" href="group__CUDART__PEER_gbc095a10a4d953e972ef918997c5e567.html#gbc095a10a4d953e972ef918997c5e567" title="Queries if a device may directly access a peer device's memory.">cudaDeviceCanAccessPeer()</a> indicates that the current device cannot directly access memory from <code>peerDevice</code>.<p> Returns <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e00380bc28e8217afa14b95f907631cb84f33">cudaErrorPeerAccessAlreadyEnabled</a> if direct access of <code>peerDevice</code> from the current device has already been enabled.<p> Returns <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c">cudaErrorInvalidValue</a> if <code>flags</code> is not 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>peerDevice</em> </td><td>- Peer device to enable direct access to from the current device </td></tr> <tr><td valign="top"></td><td valign="top"><em>flags</em> </td><td>- Reserved for future use and must be set to 0</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591">cudaSuccess</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038938c6e8b96ecde62e3ab5137156f739a">cudaErrorInvalidDevice</a> <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e00380bc28e8217afa14b95f907631cb84f33">cudaErrorPeerAccessAlreadyEnabled</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c">cudaErrorInvalidValue</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__CUDART__PEER_gbc095a10a4d953e972ef918997c5e567.html#gbc095a10a4d953e972ef918997c5e567" title="Queries if a device may directly access a peer device's memory.">cudaDeviceCanAccessPeer</a>, <a class="el" href="group__CUDART__PEER_gae24fc50bd0f1ce7f69032f91bde87ac.html#gae24fc50bd0f1ce7f69032f91bde87ac" title="Disables direct access to memory allocations on a peer device and unregisters any...">cudaDeviceDisablePeerAccess</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>