-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathftest.f95
More file actions
43 lines (33 loc) · 725 Bytes
/
ftest.f95
File metadata and controls
43 lines (33 loc) · 725 Bytes
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
!Double loop sum
real*8 function doubleloop(inp,n)
implicit none
integer, intent(in) :: n
real*8, intent(in) :: inp(n,n)
real*8 :: dum,b,temp(n)
integer :: i,j
dum = 0
!$omp parallel do private(i,j,b) reduction(+:dum)
do i=1,n
temp = inp(i,:)
do j=1,n
dum = dum + temp(j)
end do
end do
!$omp end parallel do
doubleloop = dum
end function doubleloop
!Double loop sum
real*8 function singleloop(inp,n)
implicit none
integer, intent(in) :: n
real*8, intent(in) :: inp(n)
real*8 :: dum
integer :: i
dum = 0
!$omp parallel do private(i) reduction(+:dum)
do i=1,n
dum = dum + inp(i)
end do
!$omp end parallel do
singleloop = dum
end function singleloop