File: orphan-reductions-1.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (210 lines) | stat: -rw-r--r-- 4,249 bytes parent folder | download | duplicates (2)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
! Verify that gang reduction on orphan OpenACC loops reported as errors.

! { dg-do compile }

subroutine s1
  implicit none

  integer, parameter :: n = 100
  integer :: i, sum
  sum = 0

  !$acc parallel reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do
  !$acc end parallel

  !$acc parallel loop gang reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do

  !$acc parallel
  !$acc loop gang reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do
  !$acc end parallel
end subroutine s1

subroutine s2
  implicit none
  !$acc routine gang

  integer, parameter :: n = 100
  integer :: i, j, sum
  sum = 0

  !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
  do i = 1, n
     sum = sum + 1
  end do

  !$acc loop reduction(+:sum)
  ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
  do i = 1, n
     !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
     do j = 1, n
        sum = sum + 1
     end do
  end do
end subroutine s2

integer function f1 ()
  implicit none

  integer, parameter :: n = 100
  integer :: i, sum
  sum = 0

  !$acc parallel reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do
  !$acc end parallel

  !$acc parallel loop gang reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do

  !$acc parallel
  !$acc loop gang reduction(+:sum)
  do i = 1, n
     sum = sum + 1
  end do
  !$acc end parallel

  f1 = sum
end function f1

integer function f2 ()
  implicit none
  !$acc routine gang

  integer, parameter :: n = 100
  integer :: i, j, sum
  sum = 0

  !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
  do i = 1, n
     sum = sum + 1
  end do

  !$acc loop reduction(+:sum)
  ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
  do i = 1, n
     !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
     do j = 1, n
        sum = sum + 1
     end do
  end do

  f2 = sum
end function f2

module m
contains
  subroutine s3
    implicit none

    integer, parameter :: n = 100
    integer :: i, sum
    sum = 0

    !$acc parallel reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do
    !$acc end parallel

    !$acc parallel loop gang reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do

    !$acc parallel
    !$acc loop gang reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do
    !$acc end parallel
  end subroutine s3

  subroutine s4
    implicit none
    !$acc routine gang

    integer, parameter :: n = 100
    integer :: i, j, sum
    sum = 0

    !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
    do i = 1, n
       sum = sum + 1
    end do

    !$acc loop reduction(+:sum)
    ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
    do i = 1, n
       !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
       do j = 1, n
          sum = sum + 1
       end do
    end do
  end subroutine s4

  integer function f3 ()
    implicit none

    integer, parameter :: n = 100
    integer :: i, sum
    sum = 0

    !$acc parallel reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do
    !$acc end parallel

    !$acc parallel loop gang reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do

    !$acc parallel
    !$acc loop gang reduction(+:sum)
    do i = 1, n
       sum = sum + 1
    end do
    !$acc end parallel

    f3 = sum
  end function f3

  integer function f4 ()
    implicit none
    !$acc routine gang

    integer, parameter :: n = 100
    integer :: i, j, sum
    sum = 0

    !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
    do i = 1, n
       sum = sum + 1
    end do

    !$acc loop reduction(+:sum)
    ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
    do i = 1, n
       !$acc loop gang reduction(+:sum) ! { dg-error "gang reduction on an orphan loop" }
       do j = 1, n
          sum = sum + 1
       end do
    end do

    f4 = sum
  end function f4
end module m