title: Kernel parameter passing in CUDA?
body: <p>I have a newbie doubt regarding how do CUDA kernels work.</p>
  
  <p>If have the following code (which use the function <code>cuPrintf</code> taken from <a href="http://code.google.com/p/stanford-cs193g-sp2010/wiki/TutorialHelloWorld">here</a>):</p>
  
  <pre><code>#include "cuPrintf.cu"
  
  __global__ void testKernel(int param){
      cuPrintf("Param value: %d\n", param);
  }
  
  int main(void){
  
      // initialize cuPrintf
      cudaPrintfInit();
  
      int a = 456;    
  
      testKernel&lt;&lt;&lt;4,1&gt;&gt;&gt;(a);
  
      // display the device's greeting
      cudaPrintfDisplay();
  
      // clean up after cuPrintf
      cudaPrintfEnd();
  }
  </code></pre>
  
  <p>The output of the execution is:</p>
  
  <pre><code>Param value: 456
  Param value: 456
  Param value: 456
  Param value: 456
  </code></pre>
  
  <p>I cannot get how the kernel can read the correct value of the parameter I pass, isn't it allocated in the host memory? Can the GPU read from the host memory?</p>
  
  <p>Thanks,</p>
  
  <p>Andrea</p>