Re: forall and do loop



Gary Scott wrote:
*** Hendrickson wrote:

aeroguy wrote:

Thanks guys. Ok so i don't want to manually modify my code for any
optimization? But then there are these two ways to do so...which one
should be followed. Both are correct ? right? Then how should i
determine which one i should use.... why i should give the first
preference or the latter one?

Is there a staright answer without going into compilers?


Yes, the straight answer is "Never use a FORALL unless you are sure
you have a specific processor dependent need for it." It's not a
general looping concept. It was added to give some support for
some forms of multi-processors. Unfortunately, it has some "features"
that make it difficult for a compiler to optimize. Unless you have
a problem that maps well to multi-processors, DO loops will always
generate code that is at least as good as FORALL code for any useful
loop; they'll often do better.

So is it a target for obsolescence or will it become more useful in the future?

Probably not to both questions. My personal guess is that nothing of
any scope or significance will become obsolescent in the future. I
think the "let's delete stuff and it'll go away" experiment is over.
It's also not likely to be improved. The F2008 DO CONCURRENT and
co-arrays are likely to be a much better solution for the class of
machines that currently exist (or will soon). FORALL was ultimately
tied to a class of parallel processors that never caught on; at least
that's what I remember.

*** Hendrickson
.