1 // RUN: %libomptarget-compile-and-run-generic
8 int d
= omp_get_default_device();
9 int id
= omp_get_initial_device();
10 int a
[128], b
[64], c
[32], e
[16], q
[128], i
;
13 if (d
< 0 || d
>= omp_get_num_devices())
16 p
= omp_target_alloc(130 * sizeof(int), d
);
20 for (i
= 0; i
< 128; ++i
)
22 for (i
= 0; i
< 64; ++i
)
24 for (i
= 0; i
< 32; i
++)
26 for (i
= 0; i
< 16; i
++)
31 #pragma omp parallel num_threads(5)
34 #pragma omp task depend(out : p)
35 omp_target_memcpy(p
, a
, 128 * sizeof(int), 0, 0, d
, id
);
37 #pragma omp task depend(inout : p)
38 omp_target_memcpy(p
, b
, 64 * sizeof(int), 0, 0, d
, id
);
40 #pragma omp task depend(out : c)
41 for (i
= 0; i
< 32; i
++)
44 #pragma omp depobj(obj[0]) depend(inout : p)
45 #pragma omp depobj(obj[1]) depend(in : c)
46 omp_target_memcpy_async(p
, c
, 32 * sizeof(int), 0, 0, d
, id
, 2, obj
);
48 #pragma omp task depend(in : p)
49 omp_target_memcpy(p
, e
, 16 * sizeof(int), 0, 0, d
, id
);
54 for (i
= 0; i
< 128; ++i
)
56 omp_target_memcpy(q
, p
, 128 * sizeof(int), 0, 0, id
, d
);
57 for (i
= 0; i
< 16; ++i
)
60 for (i
= 16; i
< 32; ++i
)
63 for (i
= 32; i
< 64; ++i
)
66 for (i
= 64; i
< 128; ++i
)
70 omp_target_free(p
, d
);