Hello, I am trying to call functions inside a for loop in main. My AMP code works fine, but I am not really sure what is going on. In the following code, am I copying data from host to GPU twice every step of the loop? Both array A and B are really large. I'm trying to avoid copying as much as I can. It would be very nice if I can pass arrays on GPU (created by funcX) as funcY arguments. Is there any way I can pass the array already exist on GPU to funcY? The arrays I use are defined as 1-Dimensional on CPU and it is treated as 2-Dimensional on GPU. Thank you in advance for your help.
void funcX(int* A, int* B ){
array_view<int,2> Aamp(n,m,A);
array_view<int,2> Bamp(n,m,B);
parallel_for_each(…..
//do something here
);
}
void funcY(int* A, int* B ){
array_view<int,2> Aamp(n,m,A);
array_view<int,2> Bamp(n,m,B);
parallel_for_each(…..
//do something here
);
}
int main(){
.......
For(i=0;i<10;i++){
........
.......
funcX(A,B);
.......
funcY(A,B);
......
}
return 0;
}