Hi,
is it possible to reuse data that is already on the device eventhough there is a function call inbetween.
Here is an example:
void foo(){ float* A; ... initialize A ... #pragma offload_transfer target(mic:0) in(A:length(sizeA) alloc_if(1) free_if(0)) signal(1) ...some CPU function... //overlap this function with data transfer bar(A, sizeA); } void bar(float* A, int sizeA){ #pragma offload_transfer target(mic:0) wait(1) #pragma offload target(mic) nocopy(A:length(sizeA) alloc_if(0) free_if(0)) deviceFunction(A,sizeA); }
A similar program like this segfaults, because A is not known to the device within bar(). The solution that I've found so far would be to make *A a global variable, but this isn't really practical. I also tried to use pointers to pointers but that didn't work somehow.
Does someone know a solution to this problem?
Thanks