Re: forall and do loop



*** 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?


*** Hendrickson


thanks for you time and responses




--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.


Quantcast