blob: d2fec1082149bfaa8ac23fc0066f72db043f603b (
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
55
56
|
/* Test orphan reductions. */
/* { dg-do compile } */
#pragma acc routine seq
int
seq_reduction (int n)
{
int i, sum = 0;
#pragma acc loop seq reduction(+:sum)
for (i = 0; i < n; i++)
sum = sum + 1;
return sum;
}
#pragma acc routine gang
int
gang_reduction (int n)
{
int i, s1 = 0, s2 = 0;
#pragma acc loop gang reduction(+:s1) /* { dg-error "gang reduction on an orphan loop" } */
for (i = 0; i < n; i++)
s1 = s1 + 2;
#pragma acc loop gang reduction(+:s2) /* { dg-error "gang reduction on an orphan loop" } */
for (i = 0; i < n; i++)
s2 = s2 + 2;
return s1 + s2;
}
#pragma acc routine worker
int
worker_reduction (int n)
{
int i, sum = 0;
#pragma acc loop worker reduction(+:sum)
for (i = 0; i < n; i++)
sum = sum + 3;
return sum;
}
#pragma acc routine vector
int
vector_reduction (int n)
{
int i, sum = 0;
#pragma acc loop vector reduction(+:sum)
for (i = 0; i < n; i++)
sum = sum + 4;
return sum;
}
|