title: CUDA how to get grid, block, thread size and parallalize non square matrix calculation
body: <p>I am new to CUDA and need help understanding some things.  I need help parallelizing these two for loops.  Specifically how to setup the dimBlock and dimGrid to make this run faster.  I know this looks like the vector add example in the sdk but that example is only for square matrices and when I try to modify that code for my 128 x 1024 matrix it doesn't work properly.  </p>
  
  <pre><code>__global__ void mAdd(float* A, float* B, float* C)
  {
      for(int i = 0; i &lt; 128; i++)
      {
          for(int j = 0; j &lt; 1024; j++)
          {
              C[i * 1024 + j] = A[i * 1024 + j] + B[i * 1024 + j];
          }
      }
  }
  </code></pre>
  
  <p>This code is part of a larger loop and is the simplest portion of the code, so I decided to try to paralleize thia and learn CUDA at same time.  I have read the guides but still do not understand how to get the proper no. of grids/block/threads going and use them effectively.</p>