Hello. What does the keyword extern here means
[codebox]
extern shared float s_shared;
[/codebox]
Thanks
Hello. What does the keyword extern here means
[codebox]
extern shared float s_shared;
[/codebox]
Thanks
It means the same thing that it means in standard C - the variable s_shared is defined external to the current compilation unit.
Ok, thanks.
Within the context of a CUDA kernel, extern shared means that the size of this array is dynamically defined by the third argument in a kernel call in the Runtime (“C for CUDA”) API. i.e. <<grid_dim, block_dim, shared_mem_size>>
Use this when the shared memory size your kernel needs is not yet known during compile time (e.g. dependent on some input data or problem size)
Christian