OpenACC Deep Copy


In OpenACC 2.6 Deep Copy Technical Report, i’ve found out an example of deep copy for an array of struct as follow:

points * p;
/* allocate array p [:] */
# pragma acc enter data copyin (p[0:n])
for (i =0; i<n; ++i){
/* allocate p[i].x[:] , p[i].y [:] */
# pragma acc enter data create (p[i].x[0: p[i].n],p[i].y [0: p[i].n])

This code works fun with PGI18.7, but when i tried to modify the code:

# pragma acc enter data copyin (p[i].x[0: p[i].n],p[i].y [0: p[i].n])

It occured an __c_mcopy8() error. I don’t know the reason causing this problem. Are there some methods that can solve this problem?


Hi Tao,

Just a guess, but try adding “-Mnoidom” so the compiler doesn’t mcopy.

Also, you may want to use a scalar here:

int pn=p[i].n;
# pragma acc enter data copyin (p[i].x[0:pn],p[i].y[0:pn])