File: openmp_61.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (22 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
program openmp_61
    use omp_lib
    implicit none
integer :: array(1005), i,sum=0
!$omp teams num_teams(4)
!$omp distribute
do i = 1, 1000
  array(i) = i * 2
end do
!$omp end distribute
!$omp end teams

! Sum of all elements
!$omp parallel do reduction(+:sum)
do i=1,1000
sum=sum+array(i)
end do
!$omp end parallel do

print *,sum
if(sum/=1001000) error stop
end program openmp_61