mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
24 lines
377 B
Fortran
24 lines
377 B
Fortran
! @@name: reduction.7f
|
|
! @@type: F-free
|
|
! @@compilable: yes
|
|
! @@linkable: no
|
|
! @@expect: success
|
|
program array_red
|
|
|
|
integer,parameter :: n=100
|
|
integer :: j
|
|
real :: a(n), b(n,n)
|
|
|
|
call init(n,b)
|
|
|
|
a(:) = 0.0e0
|
|
|
|
!$omp parallel do reduction(+:a)
|
|
do j = 1, n
|
|
a(:) = a(:) + b(:,j)
|
|
end do
|
|
|
|
print*, " a(1) a(n): ", a(1), a(n)
|
|
|
|
end program
|