Re: forall and do loop




FORALL 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.

HPF
was 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.

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.

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

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?

regards,
Jaroslav

.


Quantcast