1 // RUN: %libomp-compile-and-run
3 // test checks IN dep kind in depend clause on taskwait construct
4 // uses codegen emulation
7 // ---------------------------------------------------------------------------
8 // internal data to emulate compiler codegen
25 extern int __kmpc_global_thread_num(_id
*);
26 extern void __kmpc_omp_wait_deps(_id
*, int, int, _dep
*, int, _dep
*);
34 omp_set_num_threads(2);
35 printf("addresses: %p %p %p\n", &i1
, &i2
, &i3
);
38 int t
= omp_get_thread_num();
39 printf("thread %d enters parallel\n", t
);
42 #pragma omp task depend(in: i3)
44 int th
= omp_get_thread_num();
45 printf("task 0 created by th %d, executed by th %d\n", t
, th
);
47 #pragma omp task depend(in: i2)
49 int th
= omp_get_thread_num();
50 printf("task 1 created by th %d, executed by th %d\n", t
, th
);
52 // #pragma omp taskwait depend(in: i1, i2)
55 static _id loc
= {0, 2, 0, 0, ";test9.c;func;60;0;;"};
56 int gtid
= __kmpc_global_thread_num(&loc
);
57 sdep
[0].addr
= (size_t)&i2
;
58 sdep
[0].flags
= 1; // 1-in, 2-out, 3-inout, 4-mtx, 8-inoutset
59 sdep
[1].addr
= (size_t)&i1
;
60 sdep
[1].flags
= 1; // in
61 __kmpc_omp_wait_deps(&loc
, gtid
, 2, sdep
, 0, NULL
);
63 printf("single done\n");