Update 'Q' constraint documentation.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-private-vars-loop-gang-5.c
blobb160eaa604dcd5e7cd2382a90e41817ae8ecaf25
1 #include <assert.h>
3 /* Test of gang-private array variable declared on loop directive, with
4 broadcasting to partitioned workers. */
6 int
7 main (int argc, char* argv[])
9 int x[8], i, arr[32 * 32];
11 for (i = 0; i < 32 * 32; i++)
12 arr[i] = i;
14 #pragma acc kernels copy(arr)
16 #pragma acc loop gang(num:32) private(x)
17 for (i = 0; i < 32; i++)
19 for (int j = 0; j < 8; j++)
20 x[j] = j * 2;
22 #pragma acc loop worker(num:32)
23 for (int j = 0; j < 32; j++)
24 arr[i * 32 + j] += x[j % 8];
28 for (i = 0; i < 32 * 32; i++)
29 assert (arr[i] == i + (i % 8) * 2);
31 return 0;