user1192151
user1192151

Reputation:

Shared Memory Allocation on GPU (Static or Dynamic)

I want to know what is the difference between statically allocated shared memory and dynamically allocated shared memory on the GPU? In my device code, I have the following line:

__shared__ int temp[THREADS_PER_BLOCK];

Is this static or dynamic allocation of shared memory?

Upvotes: 0

Views: 1369

Answers (1)

Roger Dahl
Roger Dahl

Reputation: 15734

It's dynamically allocated if the shared memory size is specified at run time. It is statically allocated if the size of the shared memory is determined at compile time. Your example is static shared memory allocation.

Upvotes: 1

Related Questions