Debian Codegraph @

libgomp/testsuite/libgomp.fortran/unroll-1.f90

raw
1 ! { dg-do run }
2
3 module test_functions
4 contains
5 integer function compute_sum() result(sum)
6 implicit none
7 integer :: i,j
8
9 sum = 0
10 !$omp parallel do reduction(+:sum) private(j)
11 do i = 1,10,3
12 !$omp unroll full
13 do j = 1,10,3
14 sum = sum + 1
15 end do
16 end do
17 end function
18
19 integer function compute_sum2() result(sum)
20 implicit none
21 integer :: i,j
22
23 sum = 0
24 !$omp parallel do reduction(+:sum) private(i, j)
25 !$omp unroll partial(2)
26 do i = 1,10,3
27 do j = 1,10,3
28 sum = sum + 1
29 end do
30 end do
31 end function
32 end module test_functions
33
34 program test
35 use test_functions
36 implicit none
37
38 integer :: result
39
40 result = compute_sum ()
41 if (result .ne. 16) then
42 stop 1
43 end if
44
45 result = compute_sum2 ()
46 if (result .ne. 16) then
47 stop 2
48 end if
49 end program