| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */ |
| 3 |
|
| 4 |
#include <openacc.h> |
| 5 |
#include <string.h> |
| 6 |
#include <stdio.h> |
| 7 |
#include <stdlib.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
int |
| 11 |
main (int argc, char **argv) |
| 12 |
{ |
| 13 |
int N = 8; |
| 14 |
float *a, *b, *c, *d; |
| 15 |
int i; |
| 16 |
|
| 17 |
a = (float *) malloc (N * sizeof (float)); |
| 18 |
b = (float *) malloc (N * sizeof (float)); |
| 19 |
c = (float *) malloc (N * sizeof (float)); |
| 20 |
|
| 21 |
d = (float *) acc_malloc (N * sizeof (float)); |
| 22 |
acc_map_data (c, d, N * sizeof (float)); |
| 23 |
|
| 24 |
fprintf (stderr, "CheCKpOInT\n"); |
| 25 |
#pragma acc data present (a[0:N]) present (c[0:N]) present (b[0:N]) |
| 26 |
{ |
| 27 |
#pragma acc parallel |
| 28 |
{ |
| 29 |
int ii; |
| 30 |
|
| 31 |
for (ii = 0; ii < N; ii++) |
| 32 |
{ |
| 33 |
c[ii] = a[ii]; |
| 34 |
b[ii] = c[ii]; |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
d = (float *) acc_deviceptr (c); |
| 40 |
acc_unmap_data (c); |
| 41 |
acc_free (d); |
| 42 |
|
| 43 |
free (a); |
| 44 |
free (b); |
| 45 |
free (c); |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |
| 49 |
|
| 50 |
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ |
| 51 |
/* { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" } */ |
| 52 |
/* { dg-shouldfail "" } */ |