aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/icv-4.c
blob: 9da0d635bf5152d7e779a1c68befeb6131ab12e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* { dg-set-target-env-var OMP_NUM_TEAMS "6" } */
/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT "12" } */

#include <omp.h>
#include <stdlib.h>
#include <string.h>

int
main ()
{
  if (getenv ("OMP_NUM_TEAMS") != NULL
      && strcmp (getenv ("OMP_NUM_TEAMS"), "6") == 0)
    {
      if (omp_get_max_teams () != 6)
	abort ();
    }
  else
    omp_set_num_teams (6);
  if (getenv ("OMP_TEAMS_THREAD_LIMIT") != NULL
      && strcmp (getenv ("OMP_TEAMS_THREAD_LIMIT"), "12") == 0)
    {
      if (omp_get_teams_thread_limit () != 12)
	abort ();
    }
  else
    omp_set_teams_thread_limit (12);
  #pragma omp teams
  {
    #pragma omp parallel if(0)
    if (omp_get_max_teams () != 6
	|| omp_get_teams_thread_limit () != 12
	|| omp_get_num_teams () < 1
	|| omp_get_num_teams () > 6
	|| omp_get_team_num () < 0
	|| omp_get_team_num () >= omp_get_num_teams ()
	|| omp_get_thread_limit () < 1
	|| omp_get_thread_limit () > 12)
      abort ();
  }
  return 0;
}