Re: Array puzzle



Jugoslav Dujic wrote:
Roy Lewallen wrote:
| I'm a relatively inexperienced Fortran programmer, so please go gently.
| | While looking through the IVF documentation, I learned that it's
| inefficient to pass an assumed shape or allocatable array to a
| procedure, inside of which it's referenced as a non-deferred shape
| array. Further reading discourages using assumed size arrays. So I
| looked through the very old code I'd been using for some time, and found
| this:

Um, could you please point to that particular piece of documentation?
It doesn't seem quite true, especially regarding allocatable arrays (which, once allocated, behave quite like "normal" explicit-shape
arrays).

Virtually the same wording can be found at the bottom of the page at http://www.nersc.gov/vendor_docs/intel/f_ug2/prg_arrs.htm. A web search found it several other places, including Compaq documentation.
The basic issue at stake is *contiguity* of the array [section] passed
as the real argument for an assumed-size or explicit-shape dummy. If the
section (can be proven to be) discontiguous, a "copy-in/copy-out" to/from
a stack temporary must be generated, causing a performance penalty in most
cases. For assumed-shape dummies, that is [almost] never an issue.

My understanding of the explanation in the documentation is that this is indeed the case. Maybe I'm just not paraphrasing it properly -- a lot of the array terminology is new to me.

> . . .

The example you provide is standard-conforming, and uses "sequence association" between elements of arrays of different rank. The
following works for me on IVF 0.0.029 for Windows:

Program Old
REAL A
INTEGER N
DIMENSION A(30)
>
> INTERFACE
> SUBROUTINE P2(B,N)
> REAL B
> INTEGER N
> DIMENSION B(N,*)
> END SUBROUTINE
> END INTERFACE

> . . .

As I mentioned, I modified the program some time ago to make A allocatable. So it seemed to me that when I pass it to the subroutines in my example, it violates the guideline in the Intel (and other) documentation. Your routine seems to be doing exactly what I have now, which I thought was the case to be discouraged. I tried in the P1 INTERFACE block to declare:

SUBROUTINE P1(B)
REAL :: B(:)

which works fine, but I can't find any similar thing I can do in P2's INTERFACE block. I get one error if I declare it B(:) and a different one if I declare it (:,:).

. . .

Roy Lewallen
.



Relevant Pages

  • Re: Setting based 1 Arrays
    ... Generally I don't have documentation from last century on my PC so no I have no read it. ... some other areas of vb6 are most definately 1 based. ... Which areas are 1 based and which are zero based appears to be random. ... I probably would not have used it in our WCVB.BAS header interface file because it has the explicit lower and upper range defined for the arrays field we have. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: 10gR2 RAC: Mirroring OCR and voting disks
    ... Two individual iSCSI storage arrays connected via HBA. ... I've perused the documentation but I can't find any mention of what I ... Puget Sound Oracle Users Group ...
    (comp.databases.oracle.server)
  • Re: 10gR2 RAC: Mirroring OCR and voting disks
    ... Two individual iSCSI storage arrays connected via HBA. ... I've perused the documentation but I can't find any mention of what I need. ... Testing shows that if even one of the OCR / VD mirrors becomes lost (plugging out one of the arrays) the node loosing the mirror restarts, and in my case, both nodes restart. ...
    (comp.databases.oracle.server)
  • Re: 10gR2 RAC: Mirroring OCR and voting disks
    ... Two individual iSCSI storage arrays connected via HBA. ... I've perused the documentation but I can't find any mention of what I ... Oracle 9i Certified Professional ...
    (comp.databases.oracle.server)
  • Re: Linux / Windows GUI application with assembly
    ... I have just read the "CreateGC" documentation in the "X Window ... Suppose there is a program where only a very small subroutine ... HL graphics library) which will need much less computing power. ... assembly programming and the internal working of a CPU. ...
    (alt.lang.asm)