Is this possible?
I am trying to define a shared memory array in one kernel and then I need to use those values in a different kernel.
I tried declaring the
extern __shared__ float sharedMem[];
outside all functions and then wrote to it in one kernel and tried to access it in a different kernel. The sharedMem array is written to properly in the first kernel, but when I try to access it in the second kernel, the values are all 0. So I am guessing this won't work or I am doing something wrong.
Can someone please help me out on this?
You are correct, shared memory does not persist across kernel calls. Instead you must use global memory (or texture memory) and load it into shared memory in each kernel call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With