I've never used an atomic directive before and I cannot find answers on the documentation. Every time I try to use it in this loop I get an error of the type:
PGCC-S-0155-Invalid atomic expression
PGCC-S-0155-Invalid atomic region
PGCC-S-0155-Invalid atomic read
I tried several atomic clauses without success.
#pragma acc parallel loop collapse(2) present(c, L, R)
for (i = 1; i < endi; i++){
for (j = 0; j < endj; j++)
#pragma acc atomic
A = c[i][j] - c[i-1][j];
#pragma acc atomic
B = c[i+1][j] - c[i][j];
A = 0.5*(A+B);
#pragma acc atomic
L[i][j] = c[i][j] + 0.5*A;
#pragma acc atomic
R[i-1][j] = c[i][j] - 0.5*A;
}
}