extern __shared__ does not allocate memory

Hi All,

Can you please help me to understand the usage of shared ?

In my case “the block Dimension” and hence “the number of threads” in a blocks will be calculated at the run time.

So i cant pass a hard coded value in the shared memory, which i was doing by the below written line -

shared int s_data[4];

But if my array size has to be allocated dynamically, Can you please suggest me what is the best method to do so.

Additionally when i try to use -

extern shared int s_data;

It allocates values for first few elements only and rest of it displays me ZERO.

regards,
Nabarun.

ISSUE RESOLVED.

Shared Memory size is the third argument we pass in the kernel function call.

Thanks,

Nabarun.