summaryrefslogtreecommitdiff
path: root/flang/test/Semantics/OpenMP/nested-teams.f90
blob: 80c59e07fbaa686f69c3efe81ba8879591dd7b8d (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
! RUN: %python %S/../test_errors.py %s %flang -fopenmp

! OpenMP Version 5.0
! Check OpenMP construct validity for the following directives:
! 2.7 Teams Construct

program main
  integer :: i, j, N = 10
  real :: a, b, c

  !$omp teams
  a = 3.14
  !$omp end teams

  !$omp target
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end target

  !$omp target
  !$omp parallel
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end parallel
  !$omp end target

  !$omp parallel
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end parallel

  !$omp do
  do i = 1, N
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  end do

  !$omp master
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end master

  !$omp target parallel
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end target parallel

  !$omp target
  !$omp teams
  !ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end teams
  !$omp end target

  !$omp target teams
  !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end target teams

  !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
  !$omp target
  do i = 1, N
    !$omp teams
    a = 3.14
    !$omp end teams
  enddo
  !$omp end target

  !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
  !$omp target
  if (i .GT. 1) then
    if (j .GT. 1) then
      !$omp teams
      a = 3.14
      !$omp end teams
    end if
  end if
  !$omp end target

  !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
  !$omp target
  b = 3.14
  !$omp teams
  a = 3.14
  !$omp end teams
  !$omp end target

  !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
  !$omp target
  !$omp teams
  a = 3.14
  !$omp end teams
  c = 3.14
  !$omp end target

end program main