Viktor Khristenko
Viktor Khristenko

Reputation: 923

dynamic stack allocation on the device with cuda

Title says it all.

Is there anything similar to alloca() functionality in cuda but for the device side? I need to allocate small-sized arrays(nxn and nx1, with n<=10), n is a dynamic variable.

thanks!

Upvotes: 2

Views: 224

Answers (1)

Andrew Hegman
Andrew Hegman

Reputation: 64

You will have to use malloc or new inside the kernel. Be careful though, as this will allocate memory in the global memory space.

Upvotes: 2

Related Questions