3 #include <gomp-constants.h>
8 (acc_on_device (acc_device_not_host) \
9 ? __builtin_goacc_parlevel_id (GOMP_DIM_GANG) \
13 test_static(int *a
, int num_gangs
, int sarg
)
17 if (acc_on_device (acc_device_host
))
23 for (i
= 0; i
< N
/ sarg
; i
++)
24 for (j
= 0; j
< sarg
; j
++)
25 assert (a
[i
*sarg
+j
] == i
% num_gangs
);
29 test_nonstatic(int *a
, int gangs
)
33 if (acc_on_device (acc_device_host
))
36 for (i
= 0; i
< N
; i
+=gangs
)
37 for (j
= 0; j
< gangs
; j
++)
38 assert (a
[i
+j
] == i
/gangs
);
47 #pragma acc parallel loop gang (static:*) num_gangs (10)
48 for (i
= 0; i
< 100; i
++)
51 test_nonstatic (a
, 10);
53 #pragma acc parallel loop gang (static:1) num_gangs (10)
54 for (i
= 0; i
< 100; i
++)
57 test_static (a
, 10, 1);
59 #pragma acc parallel loop gang (static:2) num_gangs (10)
60 for (i
= 0; i
< 100; i
++)
63 test_static (a
, 10, 2);
65 #pragma acc parallel loop gang (static:5) num_gangs (10)
66 for (i
= 0; i
< 100; i
++)
69 test_static (a
, 10, 5);
71 #pragma acc parallel loop gang (static:20) num_gangs (10)
72 for (i
= 0; i
< 100; i
++)
75 test_static (a
, 10, 20);
77 /* Non-static gang. */
78 #pragma acc parallel loop gang num_gangs (10)
79 for (i
= 0; i
< 100; i
++)
82 test_nonstatic (a
, 10);
84 /* Static arguments with a variable expression. */
87 #pragma acc parallel loop gang (static:0+x) num_gangs (10)
88 for (i
= 0; i
< 100; i
++)
91 test_static (a
, 10, 20);
94 #pragma acc parallel loop gang (static:x) num_gangs (10)
95 for (i
= 0; i
< 100; i
++)
98 test_static (a
, 10, 20);