]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-reduction.c
Use plain -fopenacc to enable OpenACC kernels processing
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-reduction.c
CommitLineData
5d7804a9
TV
1#include <stdlib.h>
2
3#define n 10000
4
5unsigned int a[n];
6
7void __attribute__((noinline,noclone))
8foo (void)
9{
10 int i;
11 unsigned int sum = 1;
12
13#pragma acc kernels copyin (a[0:n]) copy (sum)
14 {
15 for (i = 0; i < n; ++i)
16 sum += a[i];
17 }
18
19 if (sum != 5001)
20 abort ();
21}
22
23int
24main ()
25{
26 int i;
27
28 for (i = 0; i < n; ++i)
29 a[i] = i % 2;
30
31 foo ();
32
33 return 0;
34}