[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / tasking / omp_record_replay.cpp
blob69ad98003a0d69931e8beec19f224a8f343ccbf1
1 // REQUIRES: ompx_taskgraph
2 // RUN: %libomp-cxx-compile-and-run
3 #include <iostream>
4 #include <cassert>
5 #define NT 100
7 // Compiler-generated code (emulation)
8 typedef struct ident {
9 void* dummy;
10 } ident_t;
13 #ifdef __cplusplus
14 extern "C" {
15 int __kmpc_global_thread_num(ident_t *);
16 int __kmpc_start_record_task(ident_t *, int, int, int);
17 void __kmpc_end_record_task(ident_t *, int, int , int);
19 #endif
21 void func(int *num_exec) {
22 (*num_exec)++;
25 int main() {
26 int num_exec = 0;
27 int num_tasks = 0;
28 int x=0;
29 #pragma omp parallel
30 #pragma omp single
31 for (int iter = 0; iter < NT; ++iter) {
32 int gtid = __kmpc_global_thread_num(nullptr);
33 int res = __kmpc_start_record_task(nullptr, gtid, /* kmp_tdg_flags */ 0, /* tdg_id */0);
34 if (res) {
35 num_tasks++;
36 #pragma omp task
37 func(&num_exec);
39 __kmpc_end_record_task(nullptr, gtid, /* kmp_tdg_flags */0, /* tdg_id */0);
42 assert(num_tasks==1);
43 assert(num_exec==NT);
45 std::cout << "Passed" << std::endl;
46 return 0;
48 // CHECK: Passed