1 /* float reductions. */
10 float result
, array
[n
];
14 #pragma acc parallel vector_length (vl)
15 #pragma acc loop reduction (+:result)
16 for (i
= 0; i
< n
; i
++)
20 #pragma acc parallel vector_length (vl)
21 #pragma acc loop reduction (*:result)
22 for (i
= 0; i
< n
; i
++)
25 // /* 'max' reductions. */
26 // #pragma acc parallel vector_length (vl)
27 // #pragma acc loop reduction (+:result)
28 // for (i = 0; i < n; i++)
29 // result = result > array[i] ? result : array[i];
31 // /* 'min' reductions. */
32 // #pragma acc parallel vector_length (vl)
33 // #pragma acc loop reduction (+:result)
34 // for (i = 0; i < n; i++)
35 // result = result < array[i] ? result : array[i];
37 /* '&&' reductions. */
38 #pragma acc parallel vector_length (vl)
39 #pragma acc loop reduction (&&:lresult)
40 for (i
= 0; i
< n
; i
++)
41 lresult
= lresult
&& (result
> array
[i
]);
43 /* '||' reductions. */
44 #pragma acc parallel vector_length (vl)
45 #pragma acc loop reduction (||:lresult)
46 for (i
= 0; i
< n
; i
++)
47 lresult
= lresult
|| (result
> array
[i
]);