[Beowulf] array shape difference
lindahl at pbm.com
Thu Nov 12 19:46:31 EST 2009
On Thu, Nov 12, 2009 at 08:26:13AM -0500, Stuart Barkley wrote:
> If the fortran code is doing virtual subscripts (e.g. array2(i*2 + j))
> it would likely generate about the same code as the compiler would
> generate for 2 dimensions. In theory, the compiler can generate
> better subscript computation but I suspect in most reasonable (or
> simple testing) cases the actual code size difference is a wash.
Putting my "I used to work near a compiler group" hat on, I suspect a
good compiler guy would tell you that they've worked hard to make sure
both methods generate the same code for address computation. Strength
reduction and the like are elementary optimizations these days.
However, there is an issue that the compiler may have a better idea of
the dimensions of the 2-dimensional array at compile time, leading to
better optimization. That has nothing to do with the address
computations, but everything to do with loop fusion, splitting,
unrolling, pipelining, SIMDizing, cache effects, etc.
Beowulf mailing list, Beowulf at beowulf.org sponsored by Penguin Computing
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf