4 #define COUNTERTYPE unsigned int
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 enter data create (a[0:N], b[0:N], c[0:N])
19 #pragma acc kernels present (a[0:N])
21 for (COUNTERTYPE i
= 0; i
< N
; i
++)
26 for (COUNTERTYPE i
= 0; i
< N
; i
++)
30 #pragma acc update device (b[0:N])
32 #pragma acc kernels present (a[0:N], b[0:N], c[0:N])
34 for (COUNTERTYPE ii
= 0; ii
< N
; ii
++)
35 c
[ii
] = a
[ii
] + b
[ii
];
38 #pragma acc exit data copyout (a[0:N], c[0:N])
40 for (COUNTERTYPE i
= 0; i
< N
; i
++)
41 if (c
[i
] != a
[i
] + b
[i
])