38#pragma omp teams default(shared)
41 int team_num = omp_get_team_num();
43 nteams = omp_get_num_teams();
44 priv_nteams = omp_get_num_teams();
48 int thread_num = omp_get_thread_num();
49 int teams_ub, teams_lb, thr_limit;
50 if (team_num == 0 && thread_num == 0)
54 teams_ub = (num_teams_ub ? num_teams_ub : priv_nteams);
55 teams_lb = (num_teams_lb ? num_teams_lb : teams_ub);
56 thr_limit = (thread_limit ? thread_limit : priv_nthreads);
58 if (priv_nteams < teams_lb || priv_nteams > teams_ub) {
59 fprintf(stderr,
"error: invalid number of teams=%d\n", priv_nteams);
62 if (priv_nthreads > thr_limit) {
63 fprintf(stderr,
"error: invalid number of threads=%d\n", priv_nthreads);
70 if (
a != nteams * nthreads) {
71 fprintf(stderr,
"error: a (%d) != nteams * nthreads (%d)\n",
a,
75 printf(
"#teams %d, #threads %d: Hello!\n", nteams, nthreads);
79int main(
int argc,
char *argv[]) {
93 printf(
"Test Passed\n");
void __kmpc_push_num_teams_51(ident_t *, kmp_int32, kmp_int32, kmp_int32, kmp_int32)
int __kmpc_global_thread_num(ident_t *)
void check_num_teams(int num_teams_lb, int num_teams_ub, int thread_limit)
#define omp_set_num_threads
The ident structure that describes a source location.
char const * psource
String describing the source location.
kmp_int32 reserved_1
might be used in Fortran; see above
kmp_int32 reserved_2
not really used in Fortran any more; see above
kmp_int32 reserved_3
source[4] in Fortran, do not use for C++
kmp_int32 flags
also f.flags; KMP_IDENT_xxx flags; KMP_IDENT_KMPC identifies this union member
int omp_get_num_threads()