title: Why is cuda shared memory dynamic allocation not valid here?
body: <p>This works fine: </p>
  
  <pre><code>a_size=FindSizeAtrunTime();
  
  Kernel&lt;&lt;&lt; gridDim, blockDim, a_size &gt;&gt;&gt;(count)
  </code></pre>
  
  <p>But this shows error </p>
  
  <pre><code>__global__ void Kernel(int count_a, int count_b)
  {
  
  a_size=FindSizeAtrunTime();
      __shared__ int a[a_size];
  
  }
  </code></pre>
  
  <p>error: expression must have a constant value</p>
  
  <p>In both cases size is being determined at runtime. So why the first case is ok, and not the second case?   </p>