title: cudaMalloc failing for 2D array, error code 11
body: <p>I'm attemping to implement a 2D array in CUDA as follows:</p>
  
  <pre><code>u_int32_t **device_fb = 0;
  u_int32_t **host_fb = 0;
  
  cudaMalloc((void **)&amp;device_fb, (block_size*grid_size)*sizeof(u_int32_t*));
  
  for(int i=0; i&lt;(block_size*grid_size); i++)
  {
      cudaMalloc((void **)&amp;host_fb[i], numOpsPerCore*sizeof(u_int32_t));
  }
  cudaMemcpy(device_fb, host_fb, (block_size*grid_size)*sizeof(u_int32_t*), cudaMemcpyHostToDevice);
  </code></pre>
  
  <p>On testing, <code>host_fb</code> is NULL. In addition, when I grab the error code for the first iteration of <code>cudaMalloc((void **)&amp;host_fb[i], numOpsPerCore*sizeof(u_int32_t));</code> I get <code>cudaErrorInvalidValue</code>. What am I doing wrong? Thanks! </p>