5 #pragma acc routine vector
6 void __attribute__((noinline, noclone))
7 Vector (int *ptr, int n, const int &inc)
9 #pragma acc loop vector
10 for (unsigned ix = 0; ix < n; ix++)
14 #pragma acc routine worker
15 void __attribute__((noinline, noclone))
16 Worker (int *ptr, int m, int n, const int &inc)
18 #pragma acc loop worker
19 for (unsigned ix = 0; ix < m; ix++)
20 Vector(ptr + ix * n, n, inc);
26 const int n = 32, m = 32;
33 ary[ix][iy] = (ix << 8) + iy;
35 #pragma acc parallel copy(ary)
37 Worker (&ary[0][0], m, n, 1 << 16);
44 if (ary[ix][iy] != ((1 << 16) + (ix << 8) + iy))
46 printf ("ary[%u][%u] = %x expected %x\n",
47 ix, iy, ary[ix][iy], ((1 << 16) + (ix << 8) + iy));
53 printf ("%d failed\n", err);
57 #pragma acc parallel copy(ary)
59 Vector (&ary[0][0], m * n, (1 << 24) - (1 << 16));
64 if (ary[ix][iy] != ((1 << 24) + (ix << 8) + iy))
66 printf ("ary[%u][%u] = %x expected %x\n",
67 ix, iy, ary[ix][iy], ((1 << 24) + (ix << 8) + iy));
73 printf ("%d failed\n", err);