6 /* Test tasks with detach clause on an offload device. Each device
7 thread spawns off a chain of tasks, that can then be executed by
8 any available thread. Each thread uses taskwait to wait for the
9 child tasks to complete. */
13 int x
= 0, y
= 0, z
= 0;
15 omp_event_handle_t detach_event1
, detach_event2
;
17 #pragma omp target map (tofrom: x, y, z) map (from: thread_count)
18 #pragma omp parallel private (detach_event1, detach_event2)
21 thread_count
= omp_get_num_threads ();
23 #pragma omp task detach (detach_event1) untied
24 #pragma omp atomic update
27 #pragma omp task detach (detach_event2) untied
29 #pragma omp atomic update
31 omp_fulfill_event (detach_event1
);
34 #pragma omp task untied
36 #pragma omp atomic update
38 omp_fulfill_event (detach_event2
);
44 assert (x
== thread_count
);
45 assert (y
== thread_count
);
46 assert (z
== thread_count
);