title: CUDA pointers to device constants
body: <p>I have the following constant defined on the CUDA device:</p>
  
  <pre><code>__constant__ int deviceTempVariable = 1;
  </code></pre>
  
  <p>Now I tried getting the address of <code>deviceTempVariable</code> using two methods, and I'm getting different results. The first is a direct memory access from a CUDA kernel as follows:</p>
  
  <pre><code>__global__ void cudaPointers(pointerStruct* devicePointer)
  {
      devicePointer-&gt;itsPointer = &amp;deviceTempVariable;
  }
  </code></pre>
  
  <p>The other is through host code as follows:</p>
  
  <pre><code>cudaGetSymbolAddress((void**) &amp;pointerCuda, "deviceTempVariable");
  </code></pre>
  
  <p>I was curious and checked the address values; the first gives something like <code>00000008</code>, and the second is <code>00110008</code>. The offset seems to be the same in all cases (the number 8), but the rest is different. What's going on here, and which address would I have to use?</p>