[mpich-discuss] strange behavior with fortran derived type
Christopher Gilbreth
cngilbreth at gmail.com
Wed Nov 19 12:14:58 CST 2008
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/298bcf95/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main3.f90
Type: text/x-fortran
Size: 2181 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20081119/298bcf95/attachment.bin>
More information about the mpich-discuss
mailing list