On Tue, 7 Aug 2001 11:23:09 -0500 Dick Hendrickson <[log in to unmask]>
wrote:
snip
> New topic
>
> One thing I haven't seen discussed is the effect of array dimensions
> on vector syntax. In physics problems there tend to be lots of
> arrays, but very few actual dimension sets. Most arrays have the
> same shape or are sub-shapes of other arrays. But given a
> Subroutine like
>
> Subroutine add_em_up(a,b,c,d,e,f)
> real a(:,:), b(:,:), c(:,:), d(:,:), e(:,:), f(:,:)
> a = b+c
> d = e+f
> end
>
> a compiler won't know that. It will almost for sure translate
> that into 2 DO loop nests when almost for sure one nest would
> be good enough. Also, it's likely to have to compute an index
> function ("I-1 + d1*(J-1))" for each of the 6 arrays, rather than
> one function for all 6. This isn't much of a problem for smallish
> codes, it's only 3 integer adds in the inner loop and that shouldn't
> be a major time hit. But in bigger codes it adds to register
> pressure and potentially adds a couple of cycles.
>
> Dick Hendrickson
> Not necessarily speaking for my employer
Dick,
I remember having a "discussion" and losing during the F90 development on
this topic. I proposed that
REAL,DIMENSION(:,:) :: a,b,c,d,e,f
should all assume the same shape as distinct from the above where each would
assume their shape independently. The idea being that since there was only
one set of :s to receive the shape info that was all that would be passed and
all the rest had better be the same. Too late now! You will need an
additional keyword to get this effect,
REAL,DIMENSION(:,:),ALL :: a,b,c,d,e,f
possibly.
--
Lawrie Schonfelder
Honorary Senior Fellow, University of Liverpool
Home: 1 Marine Park, West Kirby, Wirral, UK CH48 5HN
Phone: +44(151)625 6986
|