1 // RUN: %libomp-compile-and-run
3 // The test checks the teams construct pseudocode executed on host
18 // Internal library staff to emulate compiler's code generation:
31 static ident_t dummy_loc
= {0, 2, 0, 0, ";dummyFile;dummyFunc;0;0;;"};
33 int __kmpc_global_thread_num(void*);
34 void __kmpc_push_num_teams(ident_t
const*, int, int, int);
35 void __kmpc_fork_teams(ident_t
const*, int argc
, void *microtask
, ...);
41 // Outlined entry point:
42 void foo(int *gtid
, int *tid
, int *nt
)
43 { // start "serial" execution by master threads of each team
45 printf(" team %d, param %d\n", omp_get_team_num(), *nt
);
47 printf("ERROR: teams before parallel: gtid, tid: %d %d, bad pointer: %p\n", *gtid
, *tid
, nt
);
56 int th
= __kmpc_global_thread_num(NULL
); // registers initial thread
57 __kmpc_push_num_teams(&dummy_loc
, th
, N_TEAMS
, N_THR
);
58 __kmpc_fork_teams(&dummy_loc
, 1, &foo
, &nt
); // pass 1 shared parameter "nt"
60 printf("failed with %d errors\n",err
);