shared memory dynamic allocation multiple arrays in shared memory allocated dynamically ??

is it possible to allocates multiple shared memory arrays…dynamically, using the additional parameter in the kernel call ???

would be usefull if i could

Ex:

size_t shared_mem_size = 4096*2;
my_kernel <<<grid, threads, shared_mem_size>>> ( )


global void my_kernel ()
{
extern shared char arr1;
extern shared char arr2;


}

whats the size of arr1 and arr2 ??
each should be 4096 bytes…

does this work in CUDA >???

thanks…

It works, and the size is whatever you want them to be with the constraint that the sum of both sizes should be equal to how much you allocated at runtime. Both arrays exist in the same address space, so you need to use an offset when addressing the second array. This is discussed in the programming guide.

thanks