blob: dad6d13eb6089de505b0f5326fbbc78bb4ae1d6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/* This test exercises combined directives. */
/* { dg-do run } */
#include <stdlib.h>
int
main (int argc, char **argv)
{
const int N = 32;
float a[N], b[N];
int i;
for (i = 0; i < N; i++)
{
a[i] = 1.0;
b[i] = 0.0;
}
#pragma acc parallel loop copy (a[0:N]) copy (b[0:N])
for (i = 0; i < N; i++)
{
b[i] = 2.0;
a[i] = a[i] + b[i];
}
for (i = 0; i < N; i++)
{
if (a[i] != 3.0)
abort ();
if (b[i] != 2.0)
abort ();
}
#pragma acc kernels loop copy (a[0:N]) copy (b[0:N])
for (i = 0; i < N; i++)
{
b[i] = 3.0;
a[i] = a[i] + b[i];
}
for (i = 0; i < N; i++)
{
if (a[i] != 6.0)
abort ();
if (b[i] != 3.0)
abort ();
}
return 0;
}
|