Hi,
I am thinking about an example where Fortran 90 array syntax is much
preferred from an optimization point of view compared to F77 nested loops,
just to convince some skeptics...In my codes indirections of the
gather-scatter type are very frequent:
integer, dimension(1000) :: A, B, I
...
A=B(I) ! Gather
A(I)=B ! Scatter
Now, assume we know that I is a correct permutation of [1:1000], that is, it
is a one-to-one mapping. The Fortran standard requires this for A(I)=B, and
this obviously gives the compiler a lot of room for optimization. In
particular , if we have something like A(I)=function(A(I),B) the compiler
can schedule the generated loop as it pleases, unrolling it and pipelining
at will.
As far as I know, the Fortran standard does not have any such guarantees or
requirements about the gather operation, right? On a shared memory machine,
knowing that I is a permuation would exclude read conflicts and this
facilitate optimization greatly. Is there any way in pure F95 to say this?
As far as I remember, FORALLs too only require that the order of evaluation
be independent, which is true for the gather even if I is one-to-many?
Thanks,
Aleksandar
_____________________________________________
Aleksandar Donev
http://www.pa.msu.edu/~donev/
[log in to unmask]
(517) 432-6770
Department of Physics and Astronomy
Michigan State University
East Lansing, MI 48824-1116
_____________________________________________
|