Re: Fortran assumed-shape array problems with MPI



On May 30, 6:20 pm, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
Jane Smith wrote:
Hi, I am using fortran 90 (PGI) with MPI (mpif90) and I faced a
situation that a scalar argument is passed to the subroutine that
declares the dummy argument as 4-dimensional assumed-shape array.

(snip)

Does anybody know a practical solution to this problem other than
just not using the assumed-shape array (making it all explicit-shaped
by passing the bounds together) ?

Passing a scalar variable (or constant) to an array dummy is
not standard in any version of Fortran, though it is
likely to work except in the assumed shape case.
(Assumed shape arrays are normally passed by descriptor.)

Passing an array element to an assumed size or explicit shape
dummy is legal, where the called routine can reference any array
element from the one specified to the end of the array.

I would say assign to a one element 4-D array and pass that instead.
(and copy back on return).

-- glen

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(:, :, :, :),
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. "
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?



.



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)