2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
11 main (int argc
, char **argv
)
17 a
= (float *) malloc (N
* sizeof (float));
18 b
= (float *) malloc (N
* sizeof (float));
19 c
= (float *) malloc (N
* sizeof (float));
21 for (i
= 0; i
< N
; i
++)
27 #pragma acc data copyin (a[0:N]) copyout (b[0:N])
33 for (ii
= 0; ii
< N
; ii
++)
38 for (i
= 0; i
< N
; i
++)
44 if (acc_is_present (&a
[0], (N
* sizeof (float))))
47 if (acc_is_present (&b
[0], (N
* sizeof (float))))
50 for (i
= 0; i
< N
; i
++)
56 #pragma acc data copyin (a[0:N]) copyout (b[0:N])
62 for (ii
= 0; ii
< N
; ii
++)
67 for (i
= 0; i
< N
; i
++)
73 if (acc_is_present (&a
[0], (N
* sizeof (float))))
76 if (acc_is_present (&b
[0], (N
* sizeof (float))))
79 for (i
= 0; i
< N
; i
++)
85 d
= (float *) acc_copyin (&a
[0], N
* sizeof (float));
87 for (i
= 0; i
< N
; i
++)
92 #pragma acc data present_or_copyin (a[0:N]) copyout (b[0:N])
98 for (ii
= 0; ii
< N
; ii
++)
103 for (i
= 0; i
< N
; i
++)
109 if (!acc_is_present (&a
[0], (N
* sizeof (float))))
112 if (acc_is_present (&b
[0], (N
* sizeof (float))))
117 for (i
= 0; i
< N
; i
++)
123 #pragma acc data copyin (a[0:N]) present_or_copyout (b[0:N])
129 for (ii
= 0; ii
< N
; ii
++)
134 for (i
= 0; i
< N
; i
++)
140 if (acc_is_present (&a
[0], (N
* sizeof (float))))
143 if (acc_is_present (&b
[0], (N
* sizeof (float))))
146 for (i
= 0; i
< N
; i
++)
152 d
= (float *) acc_copyin (&b
[0], N
* sizeof (float));
154 #pragma acc data copyin (a[0:N]) present_or_copyout (b[0:N])
160 for (ii
= 0; ii
< N
; ii
++)
165 for (i
= 0; i
< N
; i
++)
174 if (acc_is_present (&a
[0], (N
* sizeof (float))))
177 if (!acc_is_present (&b
[0], (N
* sizeof (float))))
182 if (acc_is_present (&b
[0], (N
* sizeof (float))))
185 for (i
= 0; i
< N
; i
++)
191 #pragma acc data copy (a[0:N]) copyout (b[0:N])
197 for (ii
= 0; ii
< N
; ii
++)
205 for (i
= 0; i
< N
; i
++)
214 if (acc_is_present (&a
[0], (N
* sizeof (float))))
217 if (acc_is_present (&b
[0], (N
* sizeof (float))))
220 for (i
= 0; i
< N
; i
++)
226 #pragma acc data present_or_copy (a[0:N]) present_or_copy (b[0:N])
232 for (ii
= 0; ii
< N
; ii
++)
240 for (i
= 0; i
< N
; i
++)
249 if (acc_is_present (&a
[0], (N
* sizeof (float))))
252 if (acc_is_present (&b
[0], (N
* sizeof (float))))
255 for (i
= 0; i
< N
; i
++)
261 d
= (float *) acc_copyin (&a
[0], N
* sizeof (float));
262 d
= (float *) acc_copyin (&b
[0], N
* sizeof (float));
264 #pragma acc data present_or_copy (a[0:N]) present_or_copy (b[0:N])
270 for (ii
= 0; ii
< N
; ii
++)
278 for (i
= 0; i
< N
; i
++)
287 if (!acc_is_present (&a
[0], (N
* sizeof (float))))
290 if (!acc_is_present (&b
[0], (N
* sizeof (float))))
293 d
= (float *) acc_deviceptr (&a
[0]);
294 acc_unmap_data (&a
[0]);
297 d
= (float *) acc_deviceptr (&b
[0]);
298 acc_unmap_data (&b
[0]);
302 for (i
= 0; i
< N
; i
++)
308 #pragma acc data copyin (a[0:N]) create (c[0:N]) copyout (b[0:N])
314 for (ii
= 0; ii
< N
; ii
++)
322 for (i
= 0; i
< N
; i
++)
331 if (acc_is_present (&a
[0], (N
* sizeof (float))))
334 if (acc_is_present (&b
[0], (N
* sizeof (float))))
337 if (acc_is_present (&c
[0], (N
* sizeof (float))))
340 for (i
= 0; i
< N
; i
++)
346 #pragma acc data copyin (a[0:N]) present_or_create (c[0:N]) copyout (b[0:N])
352 for (ii
= 0; ii
< N
; ii
++)
360 for (i
= 0; i
< N
; i
++)
369 if (acc_is_present (&a
[0], (N
* sizeof (float))))
372 if (acc_is_present (&b
[0], (N
* sizeof (float))))
375 if (acc_is_present (&c
[0], (N
* sizeof (float))))
378 for (i
= 0; i
< N
; i
++)
384 d
= (float *) acc_malloc (N
* sizeof (float));
385 acc_map_data (c
, d
, N
* sizeof (float));
387 #pragma acc data copyin (a[0:N]) present_or_create (c[0:N]) copyout (b[0:N])
393 for (ii
= 0; ii
< N
; ii
++)
401 for (i
= 0; i
< N
; i
++)
410 if (acc_is_present (a
, (N
* sizeof (float))))
413 if (acc_is_present (b
, (N
* sizeof (float))))
416 if (!acc_is_present (c
, (N
* sizeof (float))))
419 d
= (float *) acc_deviceptr (c
);
425 for (i
= 0; i
< N
; i
++)
431 d
= (float *) acc_malloc (N
* sizeof (float));
432 acc_map_data (c
, d
, N
* sizeof (float));
434 #pragma acc data copyin (a[0:N]) present (c[0:N]) copyout (b[0:N])
440 for (ii
= 0; ii
< N
; ii
++)
448 for (i
= 0; i
< N
; i
++)
457 if (acc_is_present (a
, (N
* sizeof (float))))
460 if (acc_is_present (b
, (N
* sizeof (float))))
463 if (!acc_is_present (c
, (N
* sizeof (float))))
468 if (acc_is_present (c
, (N
* sizeof (float))))
473 d
= (float *) acc_malloc (N
* sizeof (float));
474 acc_map_data (c
, d
, N
* sizeof (float));
476 if (!acc_is_present (c
, (N
* sizeof (float))))
479 d
= (float *) acc_malloc (N
* sizeof (float));
480 acc_map_data (b
, d
, N
* sizeof (float));
482 if (!acc_is_present (b
, (N
* sizeof (float))))
485 d
= (float *) acc_malloc (N
* sizeof (float));
486 acc_map_data (a
, d
, N
* sizeof (float));
488 if (!acc_is_present (a
, (N
* sizeof (float))))
491 #pragma acc data present (a[0:N]) present (c[0:N]) present (b[0:N])
497 for (ii
= 0; ii
< N
; ii
++)
506 if (!acc_is_present (a
, (N
* sizeof (float))))
509 if (!acc_is_present (b
, (N
* sizeof (float))))
512 if (!acc_is_present (c
, (N
* sizeof (float))))
515 acc_copyout (b
, N
* sizeof (float));
517 for (i
= 0; i
< N
; i
++)
526 d
= (float *) acc_deviceptr (a
);
532 d
= (float *) acc_deviceptr (c
);
538 for (i
= 0; i
< N
; i
++)
544 d
= (float *) acc_malloc (N
* sizeof (float));
546 #pragma acc parallel copyin (a[0:N]) deviceptr (d) copyout (b[0:N])
550 for (ii
= 0; ii
< N
; ii
++)
557 for (i
= 0; i
< N
; i
++)
566 if (acc_is_present (a
, (N
* sizeof (float))))
569 if (acc_is_present (b
, (N
* sizeof (float))))
574 for (i
= 0; i
< N
; i
++)
580 d
= (float *) acc_copyin (&a
[0], N
* sizeof (float));
582 for (i
= 0; i
< N
; i
++)
587 #pragma acc data pcopyin (a[0:N]) copyout (b[0:N])
593 for (ii
= 0; ii
< N
; ii
++)
598 for (i
= 0; i
< N
; i
++)
604 if (!acc_is_present (&a
[0], (N
* sizeof (float))))
607 if (acc_is_present (&b
[0], (N
* sizeof (float))))
612 for (i
= 0; i
< N
; i
++)
618 #pragma acc data copyin (a[0:N]) pcopyout (b[0:N])
624 for (ii
= 0; ii
< N
; ii
++)
629 for (i
= 0; i
< N
; i
++)
635 if (acc_is_present (&a
[0], (N
* sizeof (float))))
638 if (acc_is_present (&b
[0], (N
* sizeof (float))))
641 for (i
= 0; i
< N
; i
++)
647 #pragma acc data copyin (a[0:N]) pcreate (c[0:N]) copyout (b[0:N])
653 for (ii
= 0; ii
< N
; ii
++)
661 for (i
= 0; i
< N
; i
++)
670 if (acc_is_present (&a
[0], (N
* sizeof (float))))
673 if (acc_is_present (&b
[0], (N
* sizeof (float))))
676 if (acc_is_present (&c
[0], (N
* sizeof (float))))