OpenACC private variables

Hello,
We have codes with fat loops, that need private variables.in OpenACC directives.
For some reasons, the compiler doesn’t process or even reports an error.
Could you tell us the reason, and the way to go around the problem.
Thanks for your fast feedback.
Alain Clo
Research Computing - Kaust

Here is an example of what is needed and what the compiler reports.
#pragma acc loop collapse( 3 ) independent
#pragma acc & private( i, j, k, arg, x, y, z, xi, yi, zi, tempdX0, tempdY0, tempdZ0, &
#pragma acc & tempdXP1, tempdYP1, tempdZP1, tempdXC1, tempdYC1, tempdZC1, &
#pragma acc & NX, NY, NZ, xyzsqrt, dNT, NT, tempd, cons_over_xyzsqrt, &
#pragma acc & absiNX, absjNY, abskNZ, count )
for(i=0; i<=nx; i++) { // spatial loops
for(j=0; j<=ny; j++){
for(k=0; k<=nz; k++){

PGC-S-0035-Syntax error: Recovery attempted by replacing ‘&’ by accparallel (skeleton-c-new-acc.c: 729)
PGC-S-0035-Syntax error: Recovery attempted by replacing acc by ‘(’ (skeleton-c-new-acc.c: 730)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword private (skeleton-c-new-acc.c: 730)
PGC-S-0032-Syntax error: Unexpected input at (skeleton-c-new-acc.c: 730)

Hi Alain,

The problem here is that you’re using Fortran continuation characters. In C, to continue a line you need to put an escape character at the end of the line and don’t add a another “#pragma”. Also, scalar variables are privatized by default, so you should avoid adding them to a private clause. Worse, by privatizing them, you’ve put the variable into global memory versus having the potential of it being put into a register.

  • Mat
#pragma acc loop collapse( 3 ) independent  \
     private(....., \
             .....)