On Mon, 22 Mar 2004, Richard Maine wrote:
> --On Monday, March 22, 2004 1:54 PM -0600 Renchi Raju
> <[log in to unmask]> wrote:
>
> > 77 codes perform better than f90 codes and they used (and still do) to
> > use adjustable/assumed-size arrays.
>
> Yes, but... the big problem area is not with pure f77 codes or what I might
> call pure f90 code, but with codes that mix f77 and f90 styles. In
> particular, those f77 codes never have array slices, allocatables, or
> pointers as actual arguments. That's where you get into trouble - those
> kinds of actual arguments don't always mesh well with f77-style dummies.
very true. fortunately for me, i can get away with passing in the whole
array and not slices and that (hopefully) should not trigger a copy.
> > the reason for why i want to use adjustable dummy arrays, is that i want
> > to use a global array as a storage array and want to use it in different
> > contexts with different dimensions ( for eg, in one case (nx,ny/3,nz) and
> > in another case as (nx,ny,nz/3) ). as the global array is an
> > allocatable/pointer array, i can't use equivalence.
>
> Ok. I understand that one. This is an area where other people have also
> noticed some of the strict requirements of f90/f95 getting in the way. I
> realize that you can't get f2003 compilers yet, but I'll note that there is
> an f2003 feature specifically to help with this. In particular, if you
> allocate the base array with rank 1, you can point at it with pointers of
> other ranks/shapes as long as you stay within the allocated size. Much
> like a pointer form of the equivalence tricks you are referring to.
that is pretty cool. but the rule of thumb for performance oriented codes
_currently_ seems to be avoiding use of pointers, at least in
time-critical parts of the code. i tend to use pointers at a global level,
but in computationally intensive codes i would pass it in as argument with
bounds in procedure to speed up things. hopefully, the compilers get
better with time and there will be little performance penalty with using
pointers.
i'm still not very convinced that pointers to sub-arrays or strided arrays
should have been allowed in the first place. it is very tempting to write
code using that and end up with pathetically slow code.
renchi
|