extern __shared__ variables? Confused by documentation

Hello everyone,

I’m new to CUDA programming and still going through the documentation, and my brain is currently stuck in an infinite loop trying to understand statements in the CUDA programming guide…

@ page 29 in the pdf it is mentionned:

and later @ page 30 it is mentionned:

I don’t know but that seems like a contradiction right there… :wacko:

BTW what would be the purpose of declaring variables as extern? To ease passing parameters between functions defined in different files?

In general, device-side variables cannot be extern.

However, the first construct with the array of unspecified size is a special construct where one can specify the size of the shared memory at run time – which is useful when the required size of the shared memory isn’t known at compile-time.