1 /* Test transitioning of data lifetimes between structured and dynamic. */
3 /* { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } } */
14 char *block1
= (char *) malloc (SIZE
);
17 acc_copyin (block1
, SIZE
);
18 acc_copyin (block1
, SIZE
);
20 #pragma acc enter data copyin(block1[0:SIZE])
21 #pragma acc enter data copyin(block1[0:SIZE])
24 #pragma acc data copy(block1[0:SIZE])
27 acc_copyin (block1
, SIZE
);
29 #pragma acc enter data copyin(block1[0:SIZE])
33 assert (acc_is_present (block1
, SIZE
));
36 acc_copyout (block1
, SIZE
);
37 assert (acc_is_present (block1
, SIZE
));
38 acc_copyout (block1
, SIZE
);
39 assert (acc_is_present (block1
, SIZE
));
40 acc_copyout (block1
, SIZE
);
41 assert (!acc_is_present (block1
, SIZE
));
43 #pragma acc exit data copyout(block1[0:SIZE])
44 assert (acc_is_present (block1
, SIZE
));
45 #pragma acc exit data copyout(block1[0:SIZE])
46 assert (acc_is_present (block1
, SIZE
));
47 #pragma acc exit data copyout(block1[0:SIZE])
48 assert (!acc_is_present (block1
, SIZE
));
57 char *block1
= (char *) malloc (SIZE
);
60 acc_copyin (block1
, SIZE
);
62 #pragma acc enter data copyin(block1[0:SIZE])
65 #pragma acc data copy(block1[0:SIZE])
68 acc_copyout (block1
, SIZE
);
70 #pragma acc exit data copyout(block1[0:SIZE])
72 /* This should stay present until the end of the structured data
74 assert (acc_is_present (block1
, SIZE
));
77 assert (!acc_is_present (block1
, SIZE
));
85 char *block1
= (char *) malloc (SIZE
);
88 acc_copyin (block1
, SIZE
);
90 #pragma acc enter data copyin(block1[0:SIZE])
93 #pragma acc data copy(block1[0:SIZE])
96 acc_copyout (block1
, SIZE
);
97 acc_copyin (block1
, SIZE
);
99 #pragma acc exit data copyout(block1[0:SIZE])
100 #pragma acc enter data copyin(block1[0:SIZE])
102 assert (acc_is_present (block1
, SIZE
));
105 assert (acc_is_present (block1
, SIZE
));
107 acc_copyout (block1
, SIZE
);
109 #pragma acc exit data copyout(block1[0:SIZE])
111 assert (!acc_is_present (block1
, SIZE
));
119 char *block1
= (char *) malloc (SIZE
);
120 char *block2
= (char *) malloc (SIZE
);
121 char *block3
= (char *) malloc (SIZE
);
123 #pragma acc data copy(block1[0:SIZE], block2[0:SIZE], block3[0:SIZE])
125 /* The first copyin of block2 is the enclosing data region. This
126 "enter data" should make it live beyond the end of this region.
127 This works, though the on-target copies of block1, block2 and block3
128 will stay allocated until block2 is unmapped because they are bound
129 together in a single target_mem_desc. */
131 acc_copyin (block2
, SIZE
);
133 #pragma acc enter data copyin(block2[0:SIZE])
137 assert (!acc_is_present (block1
, SIZE
));
138 assert (acc_is_present (block2
, SIZE
));
139 assert (!acc_is_present (block3
, SIZE
));
142 acc_copyout (block2
, SIZE
);
144 #pragma acc exit data copyout(block2[0:SIZE])
146 assert (!acc_is_present (block2
, SIZE
));
154 main (int argc
, char *argv
[])