title: GPU 2D shared memory dynamic allocation
body: <p>I am aware of the dynamic allocation when 1D arrays are used, but how can it be done when 2D arrays are used?</p>
  
  <pre><code>myKernel&lt;&lt;&lt;blocks, threads,sizeofSharedMemoryinBytes&gt;&gt;&gt;();
           ....
  
  __global__ void myKernerl(){
   __shared__ float sData[][];
       .....
  }
  </code></pre>
  
  <p>Say I want to allocate a 2D shared memory array:</p>
  
  <pre><code>__shared__ float sData[32][32];
  </code></pre>
  
  <p>How can it be done dynamically? would be:</p>
  
  <pre><code>myKernel&lt;&lt;&lt; blocks, threads, sizeof(float)*32*32 &gt;&gt;&gt;();
  </code></pre>