OpenMP and Fortran 95 array operations
beliavsky_at_aol.com
Date: 12/29/04
- Next message: *** Hendrickson: "Re: question about negative indices in fortran 77"
- Previous message: Jose Miguel Pasini: "question about negative indices in fortran 77"
- Next in thread: Tim Prince: "Re: OpenMP and Fortran 95 array operations"
- Reply: Tim Prince: "Re: OpenMP and Fortran 95 array operations"
- Reply: B52B: "Re: OpenMP and Fortran 95 array operations"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Dec 2004 08:01:02 -0800
I am reading the book "Parallel Programming in OpenMP". Looking at the
code examples, I wonder how OpenMP directives can be used in a Fortran
95 code that uses the parallel constructs of that language, such as
array operations and FORALL.
For example, on page 47 there is code
subroutine sums(a,m,n)
integer m,n,a(0:m,n),i,j
!$omp parallel do
do j=1,n
a(0,j) = 0
do i=1,m
a(0,j) = a(0,j) + a(i,j)
end do
end do
end subroutine sums
In F95 I would write the body of the subroutine as
a(0,:) = sum(a(1:,:),dim=1)
or
forall (j=1:n) a(0,j) = sum(a(1:,j))
Most of the F77-style examples in the book could be written in a
parallel manner in F95. Can OpenMP directives be used to speed up an
F95 style code on a multi-CPU machine? Or does code need to be
rewritten in F77 style with loops, with OpenMP directives then added? I
would not like that approach, since the code becomes larger and a bit
less readable.
- Next message: *** Hendrickson: "Re: question about negative indices in fortran 77"
- Previous message: Jose Miguel Pasini: "question about negative indices in fortran 77"
- Next in thread: Tim Prince: "Re: OpenMP and Fortran 95 array operations"
- Reply: Tim Prince: "Re: OpenMP and Fortran 95 array operations"
- Reply: B52B: "Re: OpenMP and Fortran 95 array operations"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]