12 int d
= omp_get_default_device ();
13 int id
= omp_get_initial_device ();
15 if (d
< 0 || d
>= omp_get_num_devices ())
19 #pragma omp target enter data map (alloc: s.a, s.b, s.c, s.d)
20 #pragma omp target enter data map (alloc: s.c)
21 #pragma omp target enter data map (alloc: s.b, s.d)
22 #pragma omp target enter data map (alloc: s.a, s.c, s.b)
24 #pragma omp target exit data map (release: s.a)
25 #pragma omp target exit data map (release: s.d)
26 #pragma omp target exit data map (release: s.c)
27 #pragma omp target exit data map (release: s.b)
29 /* OpenMP 5.0 structure element mapping rules describe that elements of same
30 structure variable should allocate/deallocate in a uniform fashion, so
31 all elements of 's' should be removed together by above 'exit data's. */
34 if (omp_target_is_present (&s
, d
))
36 if (omp_target_is_present (&s
.a
, d
))
38 if (omp_target_is_present (&s
.b
, d
))
40 if (omp_target_is_present (&s
.c
, d
))
42 if (omp_target_is_present (&s
.d
, d
))