1 // RUN: %libomptarget-compile-run-and-check-generic
3 // REQUIRES: unified_shared_memory
4 // UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
9 #pragma omp requires unified_shared_memory
16 int main(int argc
, char *argv
[]) {
17 int dev
= omp_get_default_device();
18 struct S s
= {10, 20};
20 #pragma omp target enter data map(close, to : s)
21 #pragma omp target map(alloc : s)
26 // To determine whether x needs to be transfered or deleted, the runtime
27 // cannot simply check whether unified shared memory is enabled and the
28 // 'close' modifier is specified. It must check whether x was previously
29 // placed in device memory by, for example, a 'close' modifier that isn't
30 // specified here. The following struct member case checks a special code
31 // path in the runtime implementation where members are transferred before
32 // deletion of the struct.
33 #pragma omp target exit data map(from : s.x, s.y)
35 // CHECK: s.x=11, s.y=21
36 printf("s.x=%d, s.y=%d\n", s
.x
, s
.y
);
38 printf("present: %d\n", omp_target_is_present(&s
, dev
));