10#define NUM_THREADS_PER_TEAM 3
12int main(
int argc,
char** argv) {
13 #pragma omp teams num_teams(NUM_TEAMS)
18 int nteams = omp_get_num_teams();
20 fprintf(stderr,
"error: too many teams: %d\n", nteams);
25 #pragma omp parallel num_threads(NUM_THREADS_PER_TEAM) private(i)
27 int tid = omp_get_thread_num();
28 int team_id = omp_get_team_num();
31 fprintf(stderr,
"error: detected number of threads (%d) is not %d\n",
35 if (tid < 0 || tid >= nthreads) {
36 fprintf(stderr,
"error: thread id is out of range: %d\n", tid);
39 if (team_id < 0 || team_id > omp_get_num_teams()) {
40 fprintf(stderr,
"error: team id is out of range: %d\n", team_id);
43 members[omp_get_thread_num()] = 1;
48 if (members[
i] != 1) {
49 fprintf(stderr,
"error: worker %d not flagged\n",
i);
#define NUM_THREADS_PER_TEAM
int omp_get_num_threads()