title: Troubles with cudaMemcpyToSymbol
body: <p>I'm trying to copy to constant memory. But I can not because of my misunderstanding of usage of cudaMemcpyToSymbol function. I'm trying to follow <a href="http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/online/group__CUDART__MEMORY_gf268fa2004636b6926fdcd3189152a14.html" rel="nofollow">this</a></p>
  
  <p>Here is some code</p>
  
  <pre><code>__device__ __constant__ double var1;
  __device__ __constant__ int var2;
  
  int main(){
  
     //... some code here...
  
     double var1ToCopy = 10.1;
     int var2ToCopy = 1; 
  
     void * p1 = &amp;var1ToCopy; 
     void * p2 = &amp;var2ToCopy;
  
     cudaStatus = cudaMemcpyToSymbol((void*)&amp;var1,p1,sizeof(double),0,cudaMemcpyHostToDevice);
     if (cudaStatus != cudaSuccess){
        return -1;
     }
  
     cudaStatus = cudaMemcpyToSymbol((void*)&amp;var2,p2,sizeof(int),0,cudaMemcpyHostToDevice);
     if (cudaStatus != cudaSuccess){
        return -1;
     }
  
  
     //... and some code here...
  }
  </code></pre>
  
  <p>I know it is a very dumb question, but I have spent several hours googling an answer and did not had any success.</p>