Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > nonfree-release > by-pkgid > d44b02ea46d82d6a48df31bbd1a088f3 > files > 1180

nvidia-cuda-toolkit-devel-6.5.14-6.mga5.nonfree.x86_64.rpm

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
      <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
      <meta name="copyright" content="(C) Copyright 2005"></meta>
      <meta name="DC.rights.owner" content="(C) Copyright 2005"></meta>
      <meta name="DC.Type" content="cppModule"></meta>
      <meta name="DC.Title" content="Unified Addressing"></meta>
      <meta name="abstract" content=""></meta>
      <meta name="description" content=""></meta>
      <meta name="DC.Format" content="XHTML"></meta>
      <meta name="DC.Identifier" content="group__CUDART__UNIFIED"></meta>
      <link rel="stylesheet" type="text/css" href="../common/formatting/commonltr.css"></link>
      <link rel="stylesheet" type="text/css" href="../common/formatting/site.css"></link>
      <title>CUDA Runtime API :: CUDA Toolkit Documentation</title>
      <!--[if lt IE 9]>
      <script src="../common/formatting/html5shiv-printshiv.min.js"></script>
      <![endif]-->
      <script type="text/javascript" charset="utf-8" src="../common/scripts/tynt/tynt.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.min.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.ba-hashchange.min.js"></script>
      <script type="text/javascript" charset="utf-8" src="../common/formatting/jquery.scrollintoview.min.js"></script>
      <script type="text/javascript" src="../search/htmlFileList.js"></script>
      <script type="text/javascript" src="../search/htmlFileInfoList.js"></script>
      <script type="text/javascript" src="../search/nwSearchFnt.min.js"></script>
      <script type="text/javascript" src="../search/stemmers/en_stemmer.min.js"></script>
      <script type="text/javascript" src="../search/index-1.js"></script>
      <script type="text/javascript" src="../search/index-2.js"></script>
      <script type="text/javascript" src="../search/index-3.js"></script>
      <link rel="canonical" href="http://docs.nvidia.com/cuda/cuda-runtime-api/index.html"></link>
      <link rel="stylesheet" type="text/css" href="../common/formatting/qwcode.highlight.css"></link>
   </head>
   <body>
      
      <header id="header"><span id="company">NVIDIA</span><span id="site-title">CUDA Toolkit Documentation</span><form id="search" method="get" action="search">
            <input type="text" name="search-text"></input><fieldset id="search-location">
               <legend>Search In:</legend>
               <label><input type="radio" name="search-type" value="site"></input>Entire Site</label>
               <label><input type="radio" name="search-type" value="document"></input>Just This Document</label></fieldset>
            <button type="reset">clear search</button>
            <button id="submit" type="submit">search</button></form>
      </header>
      <div id="site-content">
         <nav id="site-nav">
            <div class="category closed"><a href="../index.html" title="The root of the site.">CUDA Toolkit
                  v6.5</a></div>
            <div class="category"><a href="index.html" title="CUDA Runtime API">CUDA Runtime API</a></div>
            <ul>
               <li>
                  <div class="section-link"><a href="api-sync-behavior.html#api-sync-behavior">1.&nbsp;API synchronization behavior </a></div>
               </li>
               <li>
                  <div class="section-link"><a href="stream-sync-behavior.html#stream-sync-behavior">2.&nbsp;Stream synchronization behavior</a></div>
               </li>
               <li>
                  <div class="section-link"><a href="modules.html#modules">3.&nbsp;Modules</a></div>
                  <ul>
                     <li>
                        <div class="section-link"><a href="group__CUDART__DEVICE.html#group__CUDART__DEVICE">3.1.&nbsp;Device Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__THREAD__DEPRECATED.html#group__CUDART__THREAD__DEPRECATED">3.2.&nbsp;Thread Management [DEPRECATED]</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__ERROR.html#group__CUDART__ERROR">3.3.&nbsp;Error Handling</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__STREAM.html#group__CUDART__STREAM">3.4.&nbsp;Stream Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__EVENT.html#group__CUDART__EVENT">3.5.&nbsp;Event Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__EXECUTION.html#group__CUDART__EXECUTION">3.6.&nbsp;Execution Control</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__OCCUPANCY.html#group__CUDART__OCCUPANCY">3.7.&nbsp;Occupancy</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__MEMORY.html#group__CUDART__MEMORY">3.8.&nbsp;Memory Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__UNIFIED.html#group__CUDART__UNIFIED">3.9.&nbsp;Unified Addressing</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__PEER.html#group__CUDART__PEER">3.10.&nbsp;Peer Device Memory Access</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__OPENGL.html#group__CUDART__OPENGL">3.11.&nbsp;OpenGL Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__OPENGL__DEPRECATED.html#group__CUDART__OPENGL__DEPRECATED">3.12.&nbsp;OpenGL Interoperability [DEPRECATED]</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D9.html#group__CUDART__D3D9">3.13.&nbsp;Direct3D 9 Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D9__DEPRECATED.html#group__CUDART__D3D9__DEPRECATED">3.14.&nbsp;Direct3D 9 Interoperability [DEPRECATED]</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D10.html#group__CUDART__D3D10">3.15.&nbsp;Direct3D 10 Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D10__DEPRECATED.html#group__CUDART__D3D10__DEPRECATED">3.16.&nbsp;Direct3D 10 Interoperability [DEPRECATED]</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D11.html#group__CUDART__D3D11">3.17.&nbsp;Direct3D 11 Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__D3D11__DEPRECATED.html#group__CUDART__D3D11__DEPRECATED">3.18.&nbsp;Direct3D 11 Interoperability [DEPRECATED]</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__VDPAU.html#group__CUDART__VDPAU">3.19.&nbsp;VDPAU Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__INTEROP.html#group__CUDART__INTEROP">3.20.&nbsp;Graphics Interoperability</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__TEXTURE.html#group__CUDART__TEXTURE">3.21.&nbsp;Texture Reference Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__SURFACE.html#group__CUDART__SURFACE">3.22.&nbsp;Surface Reference Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__TEXTURE__OBJECT.html#group__CUDART__TEXTURE__OBJECT">3.23.&nbsp;Texture Object Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__SURFACE__OBJECT.html#group__CUDART__SURFACE__OBJECT">3.24.&nbsp;Surface Object Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART____VERSION.html#group__CUDART____VERSION">3.25.&nbsp;Version Management</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__HIGHLEVEL.html#group__CUDART__HIGHLEVEL">3.26.&nbsp;C++ API Routines</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__DRIVER.html#group__CUDART__DRIVER">3.27.&nbsp;Interactions with the CUDA Driver API</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__PROFILER.html#group__CUDART__PROFILER">3.28.&nbsp;Profiler Control</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="group__CUDART__TYPES.html#group__CUDART__TYPES">3.29.&nbsp;Data types used by CUDA Runtime</a></div>
                     </li>
                  </ul>
               </li>
               <li>
                  <div class="section-link"><a href="annotated.html#annotated">4.&nbsp;Data Structures</a></div>
                  <ul>
                     <li>
                        <div class="section-link"><a href="class____cudaOccupancyB2DHelper.html#class____cudaOccupancyB2DHelper">4.1.&nbsp;__cudaOccupancyB2DHelper</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaChannelFormatDesc.html#structcudaChannelFormatDesc">4.2.&nbsp;cudaChannelFormatDesc</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaDeviceProp.html#structcudaDeviceProp">4.3.&nbsp;cudaDeviceProp</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaExtent.html#structcudaExtent">4.4.&nbsp;cudaExtent</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaFuncAttributes.html#structcudaFuncAttributes">4.5.&nbsp;cudaFuncAttributes</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaIpcEventHandle__t.html#structcudaIpcEventHandle__t">4.6.&nbsp;cudaIpcEventHandle_t</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaIpcMemHandle__t.html#structcudaIpcMemHandle__t">4.7.&nbsp;cudaIpcMemHandle_t</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaMemcpy3DParms.html#structcudaMemcpy3DParms">4.8.&nbsp;cudaMemcpy3DParms</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaMemcpy3DPeerParms.html#structcudaMemcpy3DPeerParms">4.9.&nbsp;cudaMemcpy3DPeerParms</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaPitchedPtr.html#structcudaPitchedPtr">4.10.&nbsp;cudaPitchedPtr</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaPointerAttributes.html#structcudaPointerAttributes">4.11.&nbsp;cudaPointerAttributes</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaPos.html#structcudaPos">4.12.&nbsp;cudaPos</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaResourceDesc.html#structcudaResourceDesc">4.13.&nbsp;cudaResourceDesc</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaResourceViewDesc.html#structcudaResourceViewDesc">4.14.&nbsp;cudaResourceViewDesc</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structcudaTextureDesc.html#structcudaTextureDesc">4.15.&nbsp;cudaTextureDesc</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structsurfaceReference.html#structsurfaceReference">4.16.&nbsp;surfaceReference</a></div>
                     </li>
                     <li>
                        <div class="section-link"><a href="structtextureReference.html#structtextureReference">4.17.&nbsp;textureReference</a></div>
                     </li>
                  </ul>
               </li>
               <li>
                  <div class="section-link"><a href="functions.html#functions">5.&nbsp;Data Fields</a></div>
               </li>
               <li>
                  <div class="section-link"><a href="deprecated.html#deprecated">6.&nbsp;Deprecated List</a></div>
               </li>
               <li>
                  <div class="section-link"><a href="notices-header.html#notices-header">Notices</a></div>
                  <ul></ul>
               </li>
            </ul>
         </nav>
         <div id="resize-nav"></div>
         <nav id="search-results">
            <h2>Search Results</h2>
            <ol></ol>
         </nav>
         
         <div id="contents-container">
            <div id="breadcrumbs-container">
               <div id="breadcrumbs"><a href="group__CUDART__MEMORY.html" shape="rect">&lt; Previous</a> | <a href="group__CUDART__PEER.html" shape="rect">Next &gt;</a></div>
               <div id="release-info">CUDA Runtime API
                  (<a href="../../pdf/CUDA_Runtime_API.pdf">PDF</a>)
                  -
                  
                  v6.5
                  (<a href="https://developer.nvidia.com/cuda-toolkit-archive">older</a>)
                  -
                  Last updated August 1, 2014
                  -
                  <a href="mailto:cudatools@nvidia.com?subject=CUDA Toolkit Documentation Feedback: CUDA Runtime API">Send Feedback</a>
                  -
                  <span class="st_facebook"></span><span class="st_twitter"></span><span class="st_linkedin"></span><span class="st_reddit"></span><span class="st_slashdot"></span><span class="st_tumblr"></span><span class="st_sharethis"></span></div>
            </div>
            <article id="contents">
               <div class="topic reference apiRef apiPackage cppModule" id="group__CUDART__UNIFIED"><a name="group__CUDART__UNIFIED" shape="rect">
                     <!-- --></a><h2 class="topictitle2 cppModule">3.9.&nbsp;Unified Addressing</h2>
                  <div class="section">
                     <p>This section describes the unified addressing functions of the CUDA runtime application programming interface.</p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Overview</strong></p>
                     <p class="p">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).
                     </p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Supported Platforms</strong></p>
                     <p class="p">Whether or not a device supports unified addressing may be queried by calling <a class="xref" href="group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g929dcd9a191e17b7498e7ccaa3d16350" title="Returns information about the compute-device." shape="rect">cudaGetDeviceProperties()</a> with the device property <a class="xref" href="structcudaDeviceProp.html#structcudaDeviceProp_107b0114cefb43da05e05c65ec859542c" shape="rect">cudaDeviceProp::unifiedAddressing</a>.
                     </p>
                     <p class="p">Unified addressing is automatically enabled in 64-bit processes on devices with compute capability greater than or equal to
                        2.0.
                     </p>
                     <p class="p">Unified addressing is not yet supported on Windows Vista or Windows 7 for devices that do not use the TCC driver model.</p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Looking Up Information from Pointer Values</strong></p>
                     <p class="p">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="xref" href="group__CUDART__UNIFIED.html#group__CUDART__UNIFIED_1gab5cad40942fd554556035741d3fe5a2" title="Returns attributes about a specified pointer." shape="rect">cudaPointerGetAttributes()</a></p>
                     <p class="p">Since pointers are unique, it is not necessary to specify information about the pointers specified to <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g48efa06b81cc031b2aa6fdc2e9930741" title="Copies data between host and device." shape="rect">cudaMemcpy()</a> and other copy functions. The copy direction <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg18fa99055ee694244a270e4d5101e95b715aff8fb2b8f4f1bb553fee802db57a" shape="rect">cudaMemcpyDefault</a> may be used to specify that the CUDA runtime should infer the location of the pointer from its value.
                     </p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Automatic Mapping of Host Allocated Host Memory</strong></p>
                     <p class="p">All host memory allocated through all devices using <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g9f93d9600f4504e0d637ceb43c91ebad" title="Allocates page-locked memory on the host." shape="rect">cudaMallocHost()</a> and <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g15a3871f15f8c38f5b7190946845758c" title="Allocates page-locked memory on the host." shape="rect">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="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gc46ce76be41cf79774331cc8cfceb52b" shape="rect">cudaHostAllocPortable</a> and <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g01e600c738b962c8f973dda7708f7a70" shape="rect">cudaHostAllocMapped</a> are specified.
                     </p>
                     <p class="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="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ga475419a9b21a66036029d5001ea908c" title="Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister." shape="rect">cudaHostGetDevicePointer()</a> to get the device pointer for these allocations.
                     </p>
                     <p class="p">Note that this is not the case for memory allocated using the flag <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g3a7db37d02ce0b2350067ab639ef321c" shape="rect">cudaHostAllocWriteCombined</a>, as discussed below.
                     </p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Direct Access of Peer Memory</strong></p>
                     <p class="p">Upon enabling direct access from a device that supports unified addressing to another peer device that supports unified addressing
                        using <a class="xref" href="group__CUDART__PEER.html#group__CUDART__PEER_1g9e5ea65a18938c2b8715a5602105c306" title="Enables direct access to memory allocations on a peer device." shape="rect">cudaDeviceEnablePeerAccess()</a> all memory allocated in the peer device using <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g16a37ee003fcd9374ac8e6a5d4dee29e" title="Allocate memory on the device." shape="rect">cudaMalloc()</a> and <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g80d689bc903792f906e49be4a0b6d8db" title="Allocates pitched memory on the device." shape="rect">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.
                     </p>
                     <p class="p apiDesc_subtitle"><strong class="ph b">Exceptions, Disjoint Addressing</strong></p>
                     <p class="p">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="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g36b9fe28f547f28d23742e8c7cd18141" title="Registers an existing host memory range for use by CUDA." shape="rect">cudaHostRegister()</a> and host memory allocated using the flag <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g3a7db37d02ce0b2350067ab639ef321c" shape="rect">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>
                     <p class="p">This device address may be queried using <a class="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1ga475419a9b21a66036029d5001ea908c" title="Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister." shape="rect">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="xref" href="group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g48efa06b81cc031b2aa6fdc2e9930741" title="Copies data between host and device." shape="rect">cudaMemcpy()</a> and similar functions using the <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg18fa99055ee694244a270e4d5101e95b715aff8fb2b8f4f1bb553fee802db57a" shape="rect">cudaMemcpyDefault</a> memory direction. 
                     </p>
                  </div>
                  <h3 class="fake_sectiontitle member_header">Functions</h3>
                  <dl class="members">
                     <dt><span class="member_type"><a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a>&nbsp;</span><span class="member_name"><a href="#group__CUDART__UNIFIED_1gab5cad40942fd554556035741d3fe5a2" shape="rect">cudaPointerGetAttributes</a> (  <a href="structcudaPointerAttributes.html#structcudaPointerAttributes" title="" shape="rect">cudaPointerAttributes</a>*<span>&nbsp;</span><span class="keyword keyword apiItemName">attributes</span>, const void*<span>&nbsp;</span><span class="keyword keyword apiItemName">ptr</span> ) </span></dt>
                     <dd class="shortdesc"><span></span><span class="desc">Returns attributes about a specified pointer. </span></dd>
                  </dl>
                  <div class="description">
                     <h3 class="sectiontitle">Functions</h3>
                     <dl class="description">
                        <dt class="description"><a name="group__CUDART__UNIFIED_1gab5cad40942fd554556035741d3fe5a2" id="group__CUDART__UNIFIED_1gab5cad40942fd554556035741d3fe5a2" shape="rect">
                              <!-- --></a><span><a href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gf599e5b8b829ce7db0f5216928f6ecb6" title="" shape="rect">cudaError_t</a> cudaPointerGetAttributes (  <a href="structcudaPointerAttributes.html#structcudaPointerAttributes" title="" shape="rect">cudaPointerAttributes</a>*<span>&nbsp;</span><span class="keyword keyword apiItemName">attributes</span>, const void*<span>&nbsp;</span><span class="keyword keyword apiItemName">ptr</span> ) </span></dt>
                        <dd class="description">
                           <div class="section">Returns attributes about a specified pointer. </div>
                           <div class="section">
                              <h6 class="parameter_header">
                                 Parameters
                                 
                              </h6>
                              <dl class="table-display-params">
                                 <dt><tt class="code"><span class="keyword keyword apiItemName">attributes</span></tt></dt>
                                 <dd>- Attributes for the specified pointer </dd>
                                 <dt><tt class="code"><span class="keyword keyword apiItemName">ptr</span></tt></dt>
                                 <dd>- Pointer to get attributes for</dd>
                              </dl>
                           </div>
                           <div class="section">
                              <h6 class="return_header">Returns</h6>
                              <p class="return"><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591" shape="rect">cudaSuccess</a>, <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e0038938c6e8b96ecde62e3ab5137156f739a" shape="rect">cudaErrorInvalidDevice</a><a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a></p>
                           </div>
                           <div class="section">
                              <h6 class="description_header">Description</h6>
                              <p>Returns in <tt class="ph tt code">*attributes</tt> the attributes of the pointer <tt class="ph tt code">ptr</tt>. If pointer was not allocated in, mapped by or registered with context supporting unified addressing <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg3f51e3575c2178246db0a94a430e00383e8aef5398ee38e28ed41e357b48917c" shape="rect">cudaErrorInvalidValue</a> is returned.
                              </p>
                              <p class="p">The <a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes" shape="rect">cudaPointerAttributes</a> structure is defined as: <pre xml:space="preserve">‎    struct <a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes" shape="rect">cudaPointerAttributes</a> {
              enum <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1g13de56a8fe75569530ecc3a3106e9b6d" shape="rect">cudaMemoryType</a> 
                  <a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_1b73616e2fdbf607eb6dfc8c87fb9b830" shape="rect">memoryType</a>;
              int <a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_120015540684b0c85e0debf64923bedec" shape="rect">device</a>;
              void *<a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_19edc9782e1ee337072994780fd3b675f" shape="rect">devicePointer</a>;
              void *<a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_119cbae18cd685096287e41cce1c9a087" shape="rect">hostPointer</a>;
              int <a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_17669904353f35b64b73f304b17c5bddc" shape="rect">isManaged</a>;
          }</pre> In this structure, the individual fields mean</p>
                              <p class="p">
                                 <ul class="ul">
                                    <li class="li">
                                       <p class="p"><a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_1b73616e2fdbf607eb6dfc8c87fb9b830" shape="rect">memoryType</a> identifies the physical location of the memory associated with pointer <tt class="ph tt code">ptr</tt>. It can be <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg13de56a8fe75569530ecc3a3106e9b6d9aa7478ab438d2dfb710c9100194a5be" shape="rect">cudaMemoryTypeHost</a> for host memory or <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg13de56a8fe75569530ecc3a3106e9b6d30c8466dd99563e4b1a43dd27bf7c743" shape="rect">cudaMemoryTypeDevice</a> for device memory.
                                       </p>
                                    </li>
                                 </ul>
                              </p>
                              <p class="p">
                                 <ul class="ul">
                                    <li class="li">
                                       <p class="p"><a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_120015540684b0c85e0debf64923bedec" shape="rect">device</a> is the device against which <tt class="ph tt code">ptr</tt> was allocated. If <tt class="ph tt code">ptr</tt> has memory type <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg13de56a8fe75569530ecc3a3106e9b6d30c8466dd99563e4b1a43dd27bf7c743" shape="rect">cudaMemoryTypeDevice</a> then this identifies the device on which the memory referred to by <tt class="ph tt code">ptr</tt> physically resides. If <tt class="ph tt code">ptr</tt> has memory type <a class="xref" href="group__CUDART__TYPES.html#group__CUDART__TYPES_1gg13de56a8fe75569530ecc3a3106e9b6d9aa7478ab438d2dfb710c9100194a5be" shape="rect">cudaMemoryTypeHost</a> then this identifies the device which was current when the allocation was made (and if that device is deinitialized then
                                          this allocation will vanish with that device's state).
                                       </p>
                                    </li>
                                 </ul>
                              </p>
                              <p class="p">
                                 <ul class="ul">
                                    <li class="li">
                                       <p class="p"><a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_19edc9782e1ee337072994780fd3b675f" shape="rect">devicePointer</a> is the device pointer alias through which the memory referred to by <tt class="ph tt code">ptr</tt> may be accessed on the current device. If the memory referred to by <tt class="ph tt code">ptr</tt> cannot be accessed directly by the current device then this is NULL.
                                       </p>
                                    </li>
                                 </ul>
                              </p>
                              <p class="p">
                                 <ul class="ul">
                                    <li class="li">
                                       <p class="p"><a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_119cbae18cd685096287e41cce1c9a087" shape="rect">hostPointer</a> is the host pointer alias through which the memory referred to by <tt class="ph tt code">ptr</tt> may be accessed on the host. If the memory referred to by <tt class="ph tt code">ptr</tt> cannot be accessed directly by the host then this is NULL.
                                       </p>
                                    </li>
                                 </ul>
                              </p>
                              <p class="p">
                                 <ul class="ul">
                                    <li class="li">
                                       <p class="p"><a class="xref" href="structcudaPointerAttributes.html#structcudaPointerAttributes_17669904353f35b64b73f304b17c5bddc" shape="rect">isManaged</a> indicates if the pointer <tt class="ph tt code">ptr</tt> points to managed memory or not.
                                       </p>
                                    </li>
                                 </ul>
                              </p>
                              <p class="p"></p>
                              <p class="p"></p>
                              <p class="p apiDesc_subtitle"><strong class="ph b">See also:</strong></p>
                              <p class="p see_subsection"><a class="xref" href="group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gd3f924ba23b94793b0c93b2addba0741" title="Returns the number of compute-capable devices." shape="rect">cudaGetDeviceCount</a>, <a class="xref" href="group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g2c4d7ed289cf972eb9e21296ea19b669" title="Returns which device is currently being used." shape="rect">cudaGetDevice</a>, <a class="xref" href="group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g418c299b069c4803bfb7cab4943da383" title="Set device to be used for GPU executions." shape="rect">cudaSetDevice</a>, <a class="xref" href="group__CUDART__DEVICE.html#group__CUDART__DEVICE_1g028e5b0474379eaf5f5d54657d48600b" title="Select compute-device which best matches criteria." shape="rect">cudaChooseDevice</a></p>
                              <p class="p"></p>
                           </div>
                        </dd>
                     </dl>
                  </div>
               </div>
               
               <hr id="contents-end"></hr>
               
            </article>
         </div>
      </div>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/formatting/common.min.js"></script>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-write.js"></script>
      <script language="JavaScript" type="text/javascript" charset="utf-8" src="../common/scripts/google-analytics/google-analytics-tracker.js"></script>
      <script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript">stLight.options({publisher: "998dc202-a267-4d8e-bce9-14debadb8d92", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script></body>
</html>