I've declared a static array in kernel.cu file
__device__ int myStaticArray[5];
I can modify this array from host using
myKernel.SetConstantVariable("myStaticArray", new int[]{1,2,3,4,5});
After a few processing, I want to copy this array to host, how can I do so?
EDIT1: I noticed that the array will be reset every time when I run a new kernel. I cannot use that array to keep intermediate values to be used in the next kernel. Is it possible to keep those values in static ways?
EDIT2: The problem in EDIT1 occur because I load multiple kernels using LoadKernelPTX. The correct way is to load module once, then construct multiple kernels from that module. (as suggested in https://github.com/kunzmi/managedCuda/wiki/CudaKernel) This way, I can have shared static array/variable across multiple kernels.