Skip to content

Commit 7c040ec

Browse files
committed
Adding a scan testcase
1 parent 86ad3af commit 7c040ec

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

openmp/runtime/test/scan/scan.f90

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
! RUN: %flang %flags %openmp_flags -fopenmp-version=51 %s -o %t.exe
2+
! RUN: %t.exe | FileCheck %s --match-full-lines
3+
program inclusive_scan
4+
implicit none
5+
integer, parameter :: n = 100
6+
integer a(n), b(n)
7+
integer x, k, y, z
8+
9+
! initialization
10+
x = 0
11+
do k = 1, n
12+
a(k) = k
13+
end do
14+
15+
! a(k) is included in the computation of producing results in b(k)
16+
!$omp parallel do reduction(inscan, +: x)
17+
do k = 1, n
18+
x = x + a(k)
19+
!$omp scan inclusive(x)
20+
b(k) = x
21+
end do
22+
23+
print *,'x =', x
24+
end program
25+
!CHECK: x = 5050

0 commit comments

Comments
 (0)