1 /* Test for omp_target_memcpy_async considering dependence objects. */
9 int d
= omp_get_default_device ();
10 int id
= omp_get_initial_device ();
11 int a
[128], b
[64], c
[32], e
[16], q
[128], i
;
14 if (d
< 0 || d
>= omp_get_num_devices ())
17 p
= omp_target_alloc (130 * sizeof (int), d
);
21 for (i
= 0; i
< 128; ++i
)
23 for (i
= 0; i
< 64; ++i
)
25 for (i
= 0; i
< 32; i
++)
27 for (i
= 0; i
< 16; i
++)
32 #pragma omp parallel num_threads(5)
35 #pragma omp task depend(out: p)
36 omp_target_memcpy (p
, a
, 128 * sizeof (int), 0, 0, d
, id
);
38 #pragma omp task depend(inout: p)
39 omp_target_memcpy (p
, b
, 64 * sizeof (int), 0, 0, d
, id
);
41 #pragma omp task depend(out: c)
42 for (i
= 0; i
< 32; i
++)
45 #pragma omp depobj(obj[0]) depend(inout: p)
46 #pragma omp depobj(obj[1]) depend(in: c)
47 omp_target_memcpy_async (p
, c
, 32 * sizeof (int), 0, 0, d
, id
, 2, obj
);
49 #pragma omp task depend(in: p)
50 omp_target_memcpy (p
, e
, 16 * sizeof (int), 0, 0, d
, id
);
55 for (i
= 0; i
< 128; ++i
)
57 omp_target_memcpy (q
, p
, 128 * sizeof(int), 0, 0, id
, d
);
58 for (i
= 0; i
< 16; ++i
)
61 for (i
= 16; i
< 32; ++i
)
64 for (i
= 32; i
< 64; ++i
)
67 for (i
= 64; i
< 128; ++i
)
71 omp_target_free (p
, d
);