sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / kernels-loop-data-2.c
blob607c35018df2b70d08ae65fdc26c9b848e4615de
1 #include <stdlib.h>
3 #define N (1024 * 512)
4 #define COUNTERTYPE unsigned int
6 int
7 main (void)
9 unsigned int *__restrict a;
10 unsigned int *__restrict b;
11 unsigned int *__restrict c;
13 a = (unsigned int *__restrict)malloc (N * sizeof (unsigned int));
14 b = (unsigned int *__restrict)malloc (N * sizeof (unsigned int));
15 c = (unsigned int *__restrict)malloc (N * sizeof (unsigned int));
17 #pragma acc data copyout (a[0:N])
19 #pragma acc kernels present (a[0:N])
21 for (COUNTERTYPE i = 0; i < N; i++)
22 a[i] = i * 2;
26 #pragma acc data copyout (b[0:N])
28 #pragma acc kernels present (b[0:N])
30 for (COUNTERTYPE i = 0; i < N; i++)
31 b[i] = i * 4;
35 #pragma acc data copyin (a[0:N], b[0:N]) copyout (c[0:N])
37 #pragma acc kernels present (a[0:N], b[0:N], c[0:N])
39 for (COUNTERTYPE ii = 0; ii < N; ii++)
40 c[ii] = a[ii] + b[ii];
44 for (COUNTERTYPE i = 0; i < N; i++)
45 if (c[i] != a[i] + b[i])
46 abort ();
48 free (a);
49 free (b);
50 free (c);
52 return 0;