Re: Fortran assumed-shape array problems with MPI



Jane Smith wrote:

(snip)

I think that I did not explain my problem very well.
The exact situation is I try to pass an array X(3, 5, 7, 9) to a
subroutine
and declare that array inside the subroutine (dummy argument) as
X(:, :, :, :),

You mean like CALL SUB(X(3,5,7,9))?

In that case it just passes the one element to the called routine.

CALL SUB(X)

passes the whole array, including the dimensions.

CALL SUB(X(3:5,2:3,4:7,5:9))

passes a subarray of the appropriate starting and ending bounds.

Also, you should have an interface so that the calling
routine knows that it is passing as an assumed shape
array. This is most important.

and when I tried to access, say, the value of X(1,2,2,2) inside the
subroutine, it gives a message
"Subscript out of range" and shows a message that the array vector has
lower bound=1,
upper bound=1, dimension=1, which means that it is recognizing X as a
scalar argument.
The ANL webpage that I posted above expresses this problem as
" An MPI subroutine with an assumed-size dummy argument may be passed
an actual scalar argument. "

This is a different problem. First, this is for assumed size
arrays and is for MPI routines, that is, those that belong to
the MPI system. It is not legal in Fortran, but likely works
much of the time, to pass a scalar variable in place of a one
element array. Note that it is legal in C, where MPI originated.
(That is, a pointer to a scalar is equivalent to a one element
array.)

by which I think they meant that MPI-using fortran recognizes
> assumed-shape dummy-argument array as a scalar.
> Does anybody know of a good solution other than passing
the bounds to the subroutine together?

-- glen

.



Relevant Pages

  • Re: VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.fortran)
  • VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.basic.visual.misc)
  • Re: VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.basic.visual.misc)
  • Re: memory leak help!
    ... a loop from the main program. ... REPLACE THE NEW COMPLEX INTO ORIGINAL ARRAY x ... END OF SUBROUTINE SCEUA ... IMPLICIT NONE ...
    (comp.lang.fortran)
  • VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.fortran)