[mpich-discuss] strange behavior with fortran derived type [RESOLVED]
Christopher Gilbreth
christopher.gilbreth at yale.edu
Wed Nov 19 13:01:28 CST 2008
Hi,
I found the problem here -- the variable I was passing as the 'status'
parameter to mpi_recv was an integer, and not an array of integers of length
MPI_STATUS_SIZE. Thanks to anyone who thought about this!
Chris
On Wed, Nov 19, 2008 at 1:14 PM, Christopher Gilbreth
<cngilbreth at gmail.com>wrote:
> Hi,
>
> I'm having a strange problem with derived types and mpich2 using certain
> compiler configurations. The attached Fortran 90 sample program (main3.f90)
> defines a type
>
> type sample
> sequence
> complex*16 :: H
> complex*16 :: rho(MAX_R_VALS)
> end type sample
>
> type(sample) :: s
>
> and then just tries to send s%H (not the entire struct, just the one
> component) from process 1 to process 0. This works, but it seems that the
> variable which I use to store the rank of the process (I call this 'iam'),
>
> integer :: iam
> ! ...
> call MPI_COMM_RANK(MPI_COMM_WORLD, iam, mpierr)
>
> is modified during mpi_recv in process 0, depending on the compiler that I
> use and the options I pass. On my machine, with mpich2-1.0.8, iam is 0
> before mpi_recv and 1 afterward. I actually tried this with openmpi as well
> on a cluster and found a value of 16 afterward. *However*, if I comment out
> the line
>
> complex*16 :: rho(MAX_R_VALS)
>
> in type sample above, then the problem goes away on both machines.
>
> The compilers I've been trying are:
>
> - GNU Fortran (Ubuntu 4.3.2-1ubuntu11) 4.3.2
> - ifort (IFORT) 10.1 20080801
>
> gfortran gives the strange behavior with any compiler flags I've tried,
> including all -O flags.
>
> ifort gives the strange behavior with -O2 and above, but not -O0 or -O1.
>
> To compile and run:
>
> mpif90 main3.f90 -o test
> mpiexec -l -n 2 ./test
>
> Does anyone have any insight into this? Is there an error in my usage of
> the MPI calls?
>
> Thanks,
> Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20081119/665053b9/attachment.htm>
More information about the mpich-discuss
mailing list