| 1 |
/* Exercise acc_copyin and acc_copyout. */ |
| 2 |
|
| 3 |
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */ |
| 4 |
|
| 5 |
#include <stdio.h> |
| 6 |
#include <stdlib.h> |
| 7 |
#include <openacc.h> |
| 8 |
|
| 9 |
int |
| 10 |
main (int argc, char **argv) |
| 11 |
{ |
| 12 |
const int N = 256; |
| 13 |
int i; |
| 14 |
unsigned char *h1, *h2; |
| 15 |
|
| 16 |
h1 = (unsigned char *) malloc (N); |
| 17 |
|
| 18 |
for (i = 0; i < N; i++) |
| 19 |
{ |
| 20 |
h1[i] = 0xab; |
| 21 |
} |
| 22 |
|
| 23 |
(void) acc_copyin (h1, N); |
| 24 |
|
| 25 |
h2 = (unsigned char *) malloc (N); |
| 26 |
|
| 27 |
for (i = 0; i < N; i++) |
| 28 |
{ |
| 29 |
h2[i] = 0xde; |
| 30 |
} |
| 31 |
|
| 32 |
(void) acc_copyin (h2, N); |
| 33 |
|
| 34 |
fprintf (stderr, "CheCKpOInT\n"); |
| 35 |
acc_copyout (h1, N + N); |
| 36 |
|
| 37 |
free (h1); |
| 38 |
free (h2); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |
| 42 |
|
| 43 |
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ |
| 44 |
/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+512\\\] outside mapped block \\\[\[0-9a-fA-FxX\]+,\\\+256\\\]" } */ |
| 45 |
/* { dg-shouldfail "" } */ |