3 #include <gomp-constants.h>
5 #define N (32*32*32+17)
7 #pragma acc routine worker
8 void __attribute__ ((noinline
)) worker (int ary
[N
])
10 #pragma acc loop worker
11 for (unsigned ix
= 0; ix
< N
; ix
++)
13 if (acc_on_device (acc_device_not_host
))
17 g
= __builtin_goacc_parlevel_id (GOMP_DIM_GANG
);
18 w
= __builtin_goacc_parlevel_id (GOMP_DIM_WORKER
);
19 v
= __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR
);
20 ary
[ix
] = (g
<< 16) | (w
<< 8) | v
;
34 for (ix
= 0; ix
< N
;ix
++)
37 #pragma acc parallel num_workers(32) vector_length(32) copy(ary) copy(ondev)
39 ondev
= acc_on_device (acc_device_not_host
);
43 for (ix
= 0; ix
< N
; ix
++)
52 expected
= (g
<< 16) | (w
<< 8) | v
;
55 if (ary
[ix
] != expected
)
58 printf ("ary[%d]=%x expected %x\n", ix
, ary
[ix
], expected
);