Sophie

Sophie

distrib > Mageia > 2 > i586 > media > nonfree-release > by-pkgid > f86555c654b1f4a4c7ccf47789979868 > files > 1044

nvidia-cuda-toolkit-devel-4.2.9-2.mga2.nonfree.i586.rpm

<!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: Unified Addressing</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&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Unified Addressing<br>
<small>
[<a class="el" href="group__CUDART.html">CUDA Runtime API</a>]</small>
</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__CUDART__TYPES_gf599e5b8b829ce7db0f5216928f6ecb6.html#gf599e5b8b829ce7db0f5216928f6ecb6">cudaError_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CUDART__UNIFIED_gab5cad40942fd554556035741d3fe5a2.html#gab5cad40942fd554556035741d3fe5a2">cudaPointerGetAttributes</a> (struct <a class="el" href="structcudaPointerAttributes.html">cudaPointerAttributes</a> *attributes, const void *ptr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns attributes about a specified pointer.  <a href="#gab5cad40942fd554556035741d3fe5a2"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This section describes the unified addressing functions of the CUDA runtime application programming interface.<h2><a class="anchor" name="CUDART_UNIFIED_overview">
Overview</a></h2>
CUDA devices can share a unified address space with the host. For these devices there is no distinction between a device pointer and a host pointer -- the same pointer value may be used to access memory from the host program and from a kernel running on the device (with exceptions enumerated below).<h2><a class="anchor" name="CUDART_UNIFIED_support">
Supported Platforms</a></h2>
Whether or not a device supports unified addressing may be queried by calling <a class="el" href="group__CUDART__DEVICE_g5aa4f47938af8276f08074d09b7d520c.html#g5aa4f47938af8276f08074d09b7d520c" title="Returns information about the compute-device.">cudaGetDeviceProperties()</a> with the device property <a class="el" href="structcudaDeviceProp_07b0114cefb43da05e05c65ec859542c.html#07b0114cefb43da05e05c65ec859542c">cudaDeviceProp::unifiedAddressing</a>.<p>
Unified addressing is automatically enabled in 64-bit processes on devices with compute capability greater than or equal to 2.0.<p>
Unified addressing is not yet supported on Windows Vista or Windows 7 for devices that do not use the TCC driver model.<h2><a class="anchor" name="CUDART_UNIFIED_lookup">
Looking Up Information from Pointer Values</a></h2>
It is possible to look up information about the memory which backs a pointer value. For instance, one may want to know if a pointer points to host or device memory. As another example, in the case of device memory, one may want to know on which CUDA device the memory resides. These properties may be queried using the function <a class="el" href="group__CUDART__UNIFIED_gab5cad40942fd554556035741d3fe5a2.html#gab5cad40942fd554556035741d3fe5a2" title="Returns attributes about a specified pointer.">cudaPointerGetAttributes()</a><p>
Since pointers are unique, it is not necessary to specify information about the pointers specified to <a class="el" href="group__CUDART__MEMORY_g48efa06b81cc031b2aa6fdc2e9930741.html#g48efa06b81cc031b2aa6fdc2e9930741" title="Copies data between host and device.">cudaMemcpy()</a> and other copy functions. The copy direction <a class="el" href="group__CUDART__TYPES_g18fa99055ee694244a270e4d5101e95b.html#gg18fa99055ee694244a270e4d5101e95b715aff8fb2b8f4f1bb553fee802db57a">cudaMemcpyDefault</a> may be used to specify that the CUDA runtime should infer the location of the pointer from its value.<h2><a class="anchor" name="CUDART_UNIFIED_automaphost">
Automatic Mapping of Host Allocated Host Memory</a></h2>
All host memory allocated through all devices using <a class="el" href="group__CUDART__MEMORY_g9f93d9600f4504e0d637ceb43c91ebad.html#g9f93d9600f4504e0d637ceb43c91ebad" title="Allocates page-locked memory on the host.">cudaMallocHost()</a> and <a class="el" href="group__CUDART__MEMORY_g15a3871f15f8c38f5b7190946845758c.html#g15a3871f15f8c38f5b7190946845758c" title="Allocates page-locked memory on the host.">cudaHostAlloc()</a> is always directly accessible from all devices that support unified addressing. This is the case regardless of whether or not the flags <a class="el" href="group__CUDART__TYPES_gc46ce76be41cf79774331cc8cfceb52b.html#gc46ce76be41cf79774331cc8cfceb52b">cudaHostAllocPortable</a> and <a class="el" href="group__CUDART__TYPES_g01e600c738b962c8f973dda7708f7a70.html#g01e600c738b962c8f973dda7708f7a70">cudaHostAllocMapped</a> are specified.<p>
The pointer value through which allocated host memory may be accessed in kernels on all devices that support unified addressing is the same as the pointer value through which that memory is accessed on the host. It is not necessary to call <a class="el" href="group__CUDART__MEMORY_ga475419a9b21a66036029d5001ea908c.html#ga475419a9b21a66036029d5001ea908c" title="Passes back device pointer of mapped host memory allocated by cudaHostAlloc() or...">cudaHostGetDevicePointer()</a> to get the device pointer for these allocations.<p>
Note that this is not the case for memory allocated using the flag <a class="el" href="group__CUDART__TYPES_g3a7db37d02ce0b2350067ab639ef321c.html#g3a7db37d02ce0b2350067ab639ef321c">cudaHostAllocWriteCombined</a>, as discussed below.<h2><a class="anchor" name="CUDART_UNIFIED_autopeerregister">
Direct Access of</a></h2>
Peer Memory<p>
Upon enabling direct access from a device that supports unified addressing to another peer device that supports unified addressing using <a class="el" href="group__CUDART__PEER_g9e5ea65a18938c2b8715a5602105c306.html#g9e5ea65a18938c2b8715a5602105c306" title="Enables direct access to memory allocations on a peer device.">cudaDeviceEnablePeerAccess()</a> all memory allocated in the peer device using <a class="el" href="group__CUDART__MEMORY_gc63ffd93e344b939d6399199d8b12fef.html#gc63ffd93e344b939d6399199d8b12fef" title="Allocate memory on the device.">cudaMalloc()</a> and <a class="el" href="group__CUDART__MEMORY_g80d689bc903792f906e49be4a0b6d8db.html#g80d689bc903792f906e49be4a0b6d8db" title="Allocates pitched memory on the device.">cudaMallocPitch()</a> will immediately be accessible by the current device. The device pointer value through which any peer's memory may be accessed in the current device is the same pointer value through which that memory may be accessed from the peer device.<h2><a class="anchor" name="CUDART_UNIFIED_exceptions">
Exceptions, Disjoint Addressing</a></h2>
Not all memory may be accessed on devices through the same pointer value through which they are accessed on the host. These exceptions are host memory registered using <a class="el" href="group__CUDART__MEMORY_g36b9fe28f547f28d23742e8c7cd18141.html#g36b9fe28f547f28d23742e8c7cd18141" title="Registers an existing host memory range for use by CUDA.">cudaHostRegister()</a> and host memory allocated using the flag <a class="el" href="group__CUDART__TYPES_g3a7db37d02ce0b2350067ab639ef321c.html#g3a7db37d02ce0b2350067ab639ef321c">cudaHostAllocWriteCombined</a>. For these exceptions, there exists a distinct host and device address for the memory. The device address is guaranteed to not overlap any valid host pointer range and is guaranteed to have the same value across all devices that support unified addressing.<p>
This device address may be queried using <a class="el" href="group__CUDART__MEMORY_ga475419a9b21a66036029d5001ea908c.html#ga475419a9b21a66036029d5001ea908c" title="Passes back device pointer of mapped host memory allocated by cudaHostAlloc() or...">cudaHostGetDevicePointer()</a> when a device using unified addressing is current. Either the host or the unified device pointer value may be used to refer to this memory in <a class="el" href="group__CUDART__MEMORY_g48efa06b81cc031b2aa6fdc2e9930741.html#g48efa06b81cc031b2aa6fdc2e9930741" title="Copies data between host and device.">cudaMemcpy()</a> and similar functions using the <a class="el" href="group__CUDART__TYPES_g18fa99055ee694244a270e4d5101e95b.html#gg18fa99055ee694244a270e4d5101e95b715aff8fb2b8f4f1bb553fee802db57a">cudaMemcpyDefault</a> memory direction. </div>
<hr size="1"><address style="text-align: right;"><small>
Generated by Doxygen for NVIDIA CUDA Library &nbsp;<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>