How to share a globla array

Hello,

I have something to clarify…

In my program I have two kernels, K1 and K2.

K1 produces huge amount of array of data after that K2 consumes those data generated by K1.

How can we do this using a global array as lifetime of a global array ends as the kernel ends.

How can we keep K1 data alive to be consumed by K2.

Please advice me. greatly appreciated.

Thanks,
ZZam

The lifetime of a global array does not end when the kernel ends. It ends when you call cudaFree() on the pointer.