Re: Fortran assumed-shape array problems with MPI
- From: Jane Smith <claire.s.lim@xxxxxxxxx>
- Date: 30 May 2007 15:17:04 -0700
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?
.
- Follow-Ups:
- Re: Fortran assumed-shape array problems with MPI
- From: glen herrmannsfeldt
- Re: Fortran assumed-shape array problems with MPI
- References:
- Fortran assumed-shape array problems with MPI
- From: Jane Smith
- Re: Fortran assumed-shape array problems with MPI
- From: glen herrmannsfeldt
- Fortran assumed-shape array problems with MPI
- Prev by Date: Re: Running Windows Programs from Fortran
- Next by Date: Re: Fortran assumed-shape array problems with MPI
- Previous by thread: Re: Fortran assumed-shape array problems with MPI
- Next by thread: Re: Fortran assumed-shape array problems with MPI
- Index(es):
Relevant Pages
|