title: CUDA gridDim, blockDim are always user defined?
body: <p>When I pass the grid size and thread count at kernel call, will these values be placed in gridDim and blockDim always and exactly as I passed them?</p>
  
  <p>And, moreover, will blockIdx and threadIdx always respect these limits?</p>
  
  <p>In other words, calling</p>
  
  <pre><code>kernel&lt;&lt;&lt;5, 7&gt;&gt;&gt;()
  </code></pre>
  
  <p>always results in having, in the kernel,</p>
  
  <pre><code>gridDim.x == 5 &amp;&amp; blockIdx.x &lt; gridDim.x
  blockDim.x == 7 &amp;&amp; threadIdx.x &lt; blockDim.x
  </code></pre>
  
  <p>the above conditions to hold? (And equally with 2D and 3D sizes and index?)</p>
  
  <p>I know this may sound silly as question, but I'm wondering if CUDA is allowed to ignore this limits for resource allocation and thus the programmer is always required to check.</p>
  
  <p>Hoping it's clear, thanks!</p>