43#pragma omp task firstprivate(low, high)
48 }
else if (low < high) {
49 int mid = (high - low) / 2 + low;
56#ifdef USE_HIDDEN_HELPERS
58void task_inc_a_hidden_helper(
int *
a) {
59#pragma omp target map(tofrom : a[0]) nowait
68#pragma omp task detach(handle)
72 omp_fulfill_event(handle);
80 "FAIL: a = %d instead of expected = %d. Compile with "
81 "-DVERBOSE for more verbose output.\n",
88void test_tasks(omp_event_handle_t *handles,
int expected,
int *
a) {
89 int tid = omp_get_thread_num();
99#ifdef USE_HIDDEN_HELPERS
100 task_inc_a_hidden_helper(
a);
117 printf(
" test_base(%d)\n", nthreads);
120 omp_event_handle_t *handles;
121 handles = (omp_event_handle_t *)malloc(
sizeof(omp_event_handle_t) * nthreads);
122#pragma omp parallel num_threads(nthreads) shared(a)
133 printf(
" test_nest(%d, %d)\n", first, second);
135#pragma omp parallel num_threads(first)
146 printf(
" test_nest2(%d, %d, %d)\n", first, second, third);
148#pragma omp parallel num_threads(first)
157void test_nest3(
int first,
int second,
int third,
int fourth) {
160 printf(
" test_nest3(%d, %d, %d, %d)\n", first, second, third, fourth);
162#pragma omp parallel num_threads(first)
172void test_nest4(
int first,
int second,
int third,
int fourth,
int fifth) {
175 printf(
"test_nest4(%d, %d, %d, %d, %d)\n", first, second, third, fourth,
178#pragma omp parallel num_threads(first)
185 int tid = omp_get_thread_num();
196#ifdef USE_HIDDEN_HELPERS
197 task_inc_a_hidden_helper(
a);
215 printf(
" test_base_split(%d)\n", nthreads);
218 omp_event_handle_t *handles;
219 handles = (omp_event_handle_t *)malloc(
sizeof(omp_event_handle_t) * nthreads);
220#pragma omp parallel num_threads(nthreads) shared(a)
231 printf(
" test_nest_split(%d, %d)\n", first, second);
233#pragma omp parallel num_threads(first)
244 printf(
"test_nest2_split(%d, %d, %d)\n", first, second, third);
246#pragma omp parallel num_threads(first)
250template <
typename... Args>
252 for (
int i = 0;
i < n; ++
i) {
#define omp_set_max_active_levels
void task_inc_a_detached(int *a, omp_event_handle_t handle)
void test_nest_split(int first, int second)
void test_nest2_split(int first, int second, int third)
void test_nest2(int first, int second, int third)
void test_tasks_split(omp_event_handle_t *handles, int expected, int *a)
void test_base_split(int nthreads)
void test_nest4(int first, int second, int third, int fourth, int fifth)
void test_nest3(int first, int second, int third, int fourth)
void run_ntimes(int n, void(*func)(Args...), Args... args)
void check_a(int *a, int expected)
void task_inc_split_a(int *a, int low, int high)
void test_base(int nthreads)
void test_nest(int first, int second)