OpenACC - Start

OpenACC: Quick reference, home page, tutorial (Dr.Dobb's)

The compilers by PGI have to be used, see trial version. Release information.
C++ classes:  by Rob Farber, PGI 14.4, PGI notes §2.6.4,

Compiling Code:

How to OpenACC parallelize the inner product:

Original code for inner product:
double scalar(const int N, const double x[], const double y[])
{
 double sum = 0.0;
for (int i=0; i<N; ++i) { sum += x[i]*y[i]; } return sum; }

int main()
{
...
double s = scalar(n,a,b);
...
}


OpenACC code for inner product:
// local sequential inner product
double scalar(const int N, const double x[], const double y[]) { double sum = 0.0;
#pragma acc kernels loop present_or_copyin(x[0:N], y[0:N]) independent reduction(+:sum)
for (int i=0; i<N; ++i)
sum += x[i]*y[i]; return sum; }

int main(int argc, char* argv[])
{
...

#pragma acc data copyin(a[0:nnode],b[0:nnode])
{
...
double s = scalar(n,a,b);
...
}
...
}

and  compile the code with one of the available compilers