title: Use dynamic shared memory allocation for two different vectors
body: <p>In kernel function, I want two vectors of shared memory, both with <code>size</code> length (actually <code>sizeof(float)*size</code>).</p>
  
  <p>Since it is not possible to allocate memory directly in the kernel function if a variable is needed, I had to allocate it dynamically, like:</p>
  
  <pre><code>    myKernel&lt;&lt;&lt;numBlocks, numThreads, 2*sizeof(float)*size&gt;&gt;&gt; (...);  
  </code></pre>
  
  <p>and, inside the kernel:</p>
  
  <pre><code>extern __shared__ float row[];
  extern __shared__ float results[];    
  </code></pre>
  
  <p>But, this doesn't work.</p>
  
  <p>Instead of this, I made only one vector <code>extern __shared__ float rowresults[]</code> containing all the data, using the <code>2*size</code> memory allocated. So <code>row</code> calls are still the same, and <code>results</code> calls are like <code>rowresults[size+previousIndex]</code>. And this does work.</p>
  
  <p>It is not a big problem because I get my expected results anyway, but is there any way to split my dynamically allocated shared memory into two (or more) different variables? Just for beauty.</p>