Anybody know the differences between “shared float shared;” and " extern shared float shared ;"
Tobi_W
September 17, 2009, 7:51am
2
Programming Guide 2.3 page 107:
When declaring a variable in shared memory as an external array such as
extern __shared__ float shared[];
the size of the array is determined at launch time (see Section B.12). All variables
declared in this fashion, start at the same address in memory, so that the layout of
the variables in the array must be explicitly managed through offsets.
So “shared float var;” is simpler to use, but SIZE must be known at compile time. Using the “extern” keyword, the size is determined at launch time, but is a little bit harder to manage.
Programming Guide 2.3 page 107:
So “shared float var;” is simpler to use, but SIZE must be known at compile time. Using the “extern” keyword, the size is determined at launch time, but is a little bit harder to manage.
i get it, thank you for reply~