12 int d
= omp_get_default_device ();
13 int id
= omp_get_initial_device ();
15 if (d
< 0 || d
>= omp_get_num_devices ())
20 #pragma omp target enter data map (alloc: s)
21 #pragma omp target enter data map (alloc: s)
23 #pragma omp target exit data map (release: s.a)
24 #pragma omp target exit data map (release: s.b)
26 /* OpenMP 5.0 structure element mapping rules describe that elements of same
27 structure variable should allocate/deallocate in a uniform fashion, so
28 all elements of 's' should be removed together by above 'exit data's. */
31 if (omp_target_is_present (&s
, d
))
33 if (omp_target_is_present (&s
.a
, d
))
35 if (omp_target_is_present (&s
.b
, d
))
37 if (omp_target_is_present (&s
.c
, d
))
39 if (omp_target_is_present (&s
.d
, d
))
43 #pragma omp target enter data map (alloc: s.a, s.b)
44 #pragma omp target enter data map (alloc: s.a)
45 #pragma omp target enter data map (alloc: s.b)
47 #pragma omp target exit data map (release: s)
48 #pragma omp target exit data map (release: s)
49 #pragma omp target exit data map (release: s)
51 /* OpenMP 5.0 structure element mapping rules describe that elements of same
52 structure variable should allocate/deallocate in a uniform fashion, so
53 all elements of 's' should be removed together by above 'exit data's. */
56 if (omp_target_is_present (&s
, d
))
58 if (omp_target_is_present (&s
.a
, d
))
60 if (omp_target_is_present (&s
.b
, d
))
62 if (omp_target_is_present (&s
.c
, d
))
64 if (omp_target_is_present (&s
.d
, d
))