Re: forall and do loop
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Sun, 29 Jul 2007 17:02:22 GMT
highegg wrote:
I think we're basically in agreement about everything here. It'sFORALL was added in 1995 and was
essentially copied from the High Performance Fortran language.
Yes, but even in HPF, FORALL was no parallel DO - it was an assignment
with explicit indices. I think HPF had another directive to make
parallel DOs.
HPFwas aimed at the kind of multi-processors being built in the 80's and
early 90's. They thought FORALL mapped highly parallel code naturally
onto the hardware. 65,000 processors is different from a duel core
chip. If you're working on a highly parallel code for a multi-processor
complex, why not tell the compiler that you know things can be done in
parallel. The problem is that FORALL wasn't well enough specified to
allow the expected gains.
How would you specify it better? It seems well specified to me.
totally specified by the standard. It's just that the specification
doesn't allow as much optimization on today's kind of computers as
it did for computers being designed in the 80's. As a result,
I think it's generally a mistake to use FORALL unless you have some
good reason. Clarity of code is a good reason, so is [hardware
specific] optimization. The main (only?) "problem" with FORALL
is that people are surprised by the general need for temporaries
when storing.
Again, you seem to want FORALL to be a parallel DO. FORALL is not a
means to tell the compiler "that you know things can be done in
parallel", - any array assignment can always be, but the compiler
needs to make necessary temporaries for that.
But it is sort of a parallel DO. Yes, I know it isn't, but
it has some similarities. I don't want it to be a parallel DO.
It was added to Fortran 95 as a way to allow parallel processors
to do some optimizations. It also is a nice syntax to do array
like operations that depend on subscript values, like access the
diagonal of an array, which are awkward to do in "normal" array
syntax.
There is a _fundamental_ difference between saying
DO CONCURRENT i=1,n ! I'm not sure of the F08 syntax
lhs(i) = rhs(i)
END DO
For what it's worth, the formal syntax is
DO [,] CONCURRENT forall-header
and saying
FORALL(i=1:n)
lhs(i) = rhs(i)
END FORALL
One probblem with HPF is that few real-life parallel computations can
be neatly expressed by a sequence of parallelized array expressions
and assignments (like FORALL). That's why even Fortran parallel CFD
codes use MPI.
On the other hand, given that HPF had a parallel DO directive,
why OpenMP was so much more successful?
I don't know. One problem was that HPF was so complicated that there
were never (AFAIK) complete compilers and the various compilers
implemented different subsets.
*** Hendrickson
.
regards,
Jaroslav
- Follow-Ups:
- Re: forall and do loop
- From: highegg
- Re: forall and do loop
- From: Tim Prince
- Re: forall and do loop
- References:
- forall and do loop
- From: aeroguy
- Re: forall and do loop
- From: glen herrmannsfeldt
- Re: forall and do loop
- From: aeroguy
- Re: forall and do loop
- From: *** Hendrickson
- Re: forall and do loop
- From: highegg
- Re: forall and do loop
- From: *** Hendrickson
- Re: forall and do loop
- From: highegg
- forall and do loop
- Prev by Date: Re: Execution Timing
- Next by Date: Re: forall and do loop
- Previous by thread: Re: forall and do loop
- Next by thread: Re: forall and do loop
- Index(es):