I have an array of struct A that has arrays and int variables. How can I map them to the target
Strcut A{
int **a;
int *x;
int *y;
int ny;
int nx;
}A;
A arrayA = (A*)malloc(sizeof(A)*MaxSize);
for(int i=0; i<MaxSize; i++){
arrayA[i].a = (int**)(malloc(sizeof(int*)*arrayA[i].nx);
for(int j=0; j< arrayA[i].nx; j++)
arrayA[i].a[j] = (int*)(malloc(sizeof(int)*arrayA[i].ny);
arrayA[i].x = (int*)(malloc(sizeof(int)*arrayA[i].ny);
arrayA[i].y = (int*)(malloc(sizeof(int)*arrayA[i].ny);
}
#pragma omp target data map(from:arrayA[i].y) map(to:arrayA[i].x,arrayA[i].a, arrayA[i].ny,arrayA[i].nx)
#pragma omp target teams distribute parallel for
for(i=0;i<MaxSize; i++){
methodA(arrayA[i].x,arrayA[i].a, arrayA[i].ny,arrayA[i].nx, arrayA[i].y);
}
However, this does not work. What is the best way to pass the arrayA?
I am using gcc 8.3