1 /* Test of reduction on parallel directive (with async). */
2 /* See also Fortran variants in "../libgomp.oacc-fortran/par-reduction-2*". */
4 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
5 aspects of that functionality. */
11 main (int argc
, char *argv
[])
13 int res
, res1
= 0, res2
= 0;
15 #if defined(ACC_DEVICE_TYPE_host)
20 #pragma acc parallel num_gangs(GANGS) num_workers(32) vector_length(32) \
21 reduction(+:res1) copy(res1, res2) async(1)
22 /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction', 'atomic'" { xfail { ! openacc_host_selected } } .-2 } */
23 /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 } */
24 /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } */
39 res
= res1
= res2
= 1;
41 #if defined(ACC_DEVICE_TYPE_host)
46 #pragma acc parallel num_gangs(GANGS) num_workers(32) vector_length(32) \
47 reduction(*:res1) copy(res1, res2) async(1)
48 /* { dg-bogus "warning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction', 'atomic'" { xfail { ! openacc_host_selected } } .-2 } */
49 /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 } */
50 /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } */
57 for (int i
= 0; i
< GANGS
; ++i
)
60 acc_async_wait_all ();