Global memory variables reuse

Hi all,

I have a kernel that need to be used for multiple times in an application. At first, some arrays (a[],b[] & c[]) need to be copied to global memory. So the parameters include a[], b[], c[], d, e & f. a[], b[] & c[] will be constant all the time, d, e & f may be different. 

cudaMemcpy(...a[]...);    
cudaMemcpy(...b[]...);
cudaMemcpy(...c[]...);

for(int i=0; i<100; i++){
    ...
    myKernel<<<.....>>>(a[], b[], c[], d, e & f);
    ...
}

 Will the a[], b[], c[] be rewrited to global memory in each iteration? Is there a way to avoid this?

  Thank you so much!!!

Casy

If they’re in global memory, then all you’re passing are pointers to the global memory arrays.

The data you put into device’s global memory stays there inbetween kernel calls unless you explicitly deallocate it (or your app crashes ;) )