title: Decide CUDA threads and blocks for image processing
body: <p><strong>Dear DOWNVOTERS:</strong> kindly let me know the reason of down vote. I have already accepted an answer which means that the person was able to understand the problem and a minimal working example was not required. Secondly, I wanted it to be a <strong>conceptual question</strong> rather than a homework problem. Please let me know the reason of your down-vote.</p>
  
  <p><strong>IMPORTANT:</strong> I have already read several thread (for example <a href="https://stackoverflow.com/questions/2392250/understanding-cuda-grid-dimensions-block-dimensions-and-threads-organization-s">this</a>) about the distribution of threads and blocks but I have a specific query. </p>
  
  <p>I have to process an image data in <code>unsigned char</code> form at GPU. My image is of size <code>(1080 x 1920)</code> with 3 channels and each pixel is of <code>unsigned char</code> type.</p>
  
  <p><strong>GPU <a href="http://www.nvidia.de/content/PDF/data-sheet/DS_NV_Quadro_K2000_OCT13_NV_US_LR.pdf" rel="nofollow noreferrer">Details</a>:</strong></p>
  
  <pre><code>NVIDIA Quadro k2000
  2 GB of GDDR5 GPU memory
  384 5MX CUDA parallel processing cores
  </code></pre>
  
  <p>As, I am new to GPU processing, I am not able to understand much about the number of threads per block and total number of block distribution for my GPU card in this specific case.  </p>
  
  <p><strong>PROBLEM:</strong> When I use the following 
  configuration for my <code>(1080 x 1920)</code> image to call the GPU kernel then, I am getting the desired results but the computational time is too much</p>
  
  <pre><code>dim3 numOfBlocks( (108) , (192) ); 
  dim3 numOfThreadsPerBlocks( 3*10 , 3*10 ); //multiplied by 3 because we have 3 channel image now
  
  colorTransformation_kernel&lt;&lt;&lt;numOfBlocks, numOfThreadsPerBlocks&gt;&gt;&gt;(numChannels, step_size, iw, ih, dev_ptr_source, dev_ptr_dst);
  </code></pre>
  
  <p><strong>but</strong>, if I choose to have the following another configuration</p>
  
  <pre><code>    dim3 numOfBlocks( (108/2) , (192/2) ); 
      dim3 numOfThreadsPerBlocks( 3*10*2 , 3*10*2 ); //multiplied by 3 because we have 3 channel image now
  </code></pre>
  
  <p>then, I get a blank image.</p>