tile clause error

I’m trying to use the tile clause with PGI 15.10,
and this is my code

#include <math.h>
#include <string.h>
#include "timer.h"
#include <stdio.h>

#define NN 1024
#define NM 1024

float A[NN][NM];
float Anew[NN][NM];
const int n = NN;
const int m = NM;
const int iter_max = 1000;

const double tol = 1.0e-6;
double error     = 1.0;

void testfunction()
{
    error = 0.0;

     #pragma acc kernels loop tile(8, 8)
    for( int j = 1; j < n-1; j++)
    {
        //#pragma acc loop gang(8) vector(32)
        for( int i = 1; i < m-1; i++ )
        {
            Anew[j][i] = 0.25 * ( A[j][i+1] + A[j][i-1]
                                + A[j-1][i] + A[j+1][i]);
        }
    }

    for( int j = 1; j < n-1; j++)
    {
        for( int i = 1; i < m-1; i++ )
        {
            error = fmax( error, fabs(Anew[j][i] - A[j][i]));
        }
    }

    for( int j = 1; j < n-1; j++)
    {
        for( int i = 1; i < m-1; i++ )
        {
            A[j][i] = Anew[j][i];
        }
    }

}

int main(int argc, char** argv)
{

    memset(A, 0, n * m * sizeof(float));
    memset(Anew, 0, n * m * sizeof(float));

    for (int j = 0; j < n; j++)
    {
        A[j][0]    = 1.0;
        Anew[j][0] = 1.0;
    }

    printf("Jacobi relaxation Calculation: %d x %d mesh\n", n, m);

    StartTimer();
    int iter = 0;

    #pragma acc data copy(A), create(Anew)
    while ( error > tol && iter < iter_max )
    {
        testfunction();

        if(iter % 100 == 0) printf("%5d, %0.6f\n", iter, error);

        iter++;
    }

    double runtime = GetTimer();

    printf(" total: %f s\n", runtime / 1000);
}

the complier reports

$ pgc++ -acc -Minfo=accel -ta=nvidia test2Dfunction_parallel.cpp -o acc2.out
"test2Dfunction_parallel.cpp", line 22: error: invalid text in pragma
       #pragma acc kernels loop tile(8, 8)
                                ^

"test2Dfunction_parallel.cpp", line 22: error: extra text after expected end
          of preprocessing directive
       #pragma acc kernels loop tile(8, 8)
                                    ^

2 errors detected in the compilation of "test2Dfunction_parallel.cpp".

I have tried the #pragma acc parallel loop tile(8, 8), but it reports the same error.


Is the 15.10 support OpenACC 2.0 features? What about the tile clause?[/quote]

Hi cwu87488,

The C++ front-end was missing a few constructs including “tile”. These were added in the 16.4 release.

If you can, either upgrade 16.4 or use the C compiler, pgcc.

Hope this helps,
Mat

% pgcc -acc -V15.10 test.c -Minfo=accel
testfunction:
     22, Generating copyout(Anew[1:n-2][1:m-2])
         Generating copyin(A[:n][:m])
     23, Loop is parallelizable
     26, Loop is parallelizable
         Accelerator kernel generated
         Generating Tesla code
         23, #pragma acc loop gang, vector tile(8,8) /* blockIdx.x threadIdx.x */
         26,   /* blockIdx.x threadIdx.x tiled */
main:
     68, Generating copy(A[:][:])
         Generating create(Anew[:][:])
% pgc++ -acc test.cpp -V16.4 -Minfo=accel
testfunction():
     20, Generating copyout(Anew[1:1022][1:1022])
         Generating copyin(A[:][:])
     23, Loop is parallelizable
     26, Loop is parallelizable
         Accelerator kernel generated
         Generating Tesla code
         23, #pragma acc loop gang, vector tile(8,8) /* blockIdx.x threadIdx.
         26,   /* blockIdx.x threadIdx.x tiled */
main:
     69, Generating copy(A[:][:])
         Generating create(Anew[:][:])