Retro68/gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-6.c
2017-04-10 13:32:00 +02:00

37 lines
519 B
C

/* { dg-do run } */
/* { dg-additional-options "-w" } */
/* Test reductions on explicitly private variables. */
#include <assert.h>
int
main ()
{
int i, j, red[10];
int v;
for (i = 0; i < 10; i++)
red[i] = -1;
#pragma acc parallel copyout(red)
{
#pragma acc loop gang private(v)
for (j = 0; j < 10; j++)
{
v = j;
#pragma acc loop vector reduction (+:v)
for (i = 0; i < 100; i++)
v++;
red[j] = v;
}
}
for (i = 0; i < 10; i++)
assert (red[i] == i + 100);
return 0;
}