[OMPI users] MPI_Allreduce fail (minGW gfortran + OpenMPI 1.6.1)

2012-09-06 Thread Yonghui
Dear mpi users and developers,



I am having some trouble with MPI_Allreduce. I am using MinGW (gcc 4.6.2)
with OpenMPI 1.6.1. The MPI_Allreduce in c version works fine, but the
fortran version failed with error. Here is the simple fortran code to
reproduce the error:



program main

implicit none

include 'mpif.h'

character * (MPI_MAX_PROCESSOR_NAME)
processor_name

integer myid, numprocs, namelen, rc, ierr

integer, allocatable :: mat1(:, :, :)



call MPI_INIT( ierr )

call MPI_COMM_RANK( MPI_COMM_WORLD, myid,
ierr )

call MPI_COMM_SIZE( MPI_COMM_WORLD,
numprocs, ierr )

allocate(mat1(-36:36, -36:36, -36:36))

mat1(:,:,:) = 111

print *, "Going to call MPI_Allreduce."

call MPI_Allreduce(MPI_IN_PLACE, mat1(-36,
-36, -36), 389017, MPI_INTEGER, MPI_BOR, MPI_COMM_WORLD, ierr)

print *, "MPI_Allreduce done!!!"

call MPI_FINALIZE(rc)

endprogram



The command that I used to compile:

gfortran Allreduce.f90 -IC:\OpenMPI-win32\include
C:\OpenMPI-win32\lib\libmpi_f77.lib



The MPI_Allreduce fail. [xxx:02112] [[17193,0],0]-[[17193,1],0]
mca_oob_tcp_msg_recv: readv failed: Unknown error (108).

I am not sure why this happens. But I think it is the windows build MPI
problem. Since the simple code works on a Linux system with gfortran.



Any ideas? I appreciate any response!



Yonghui





Re: [OMPI users] MPI_Allreduce fail (minGW gfortran + OpenMPI 1.6.1)

2012-09-08 Thread Yonghui
Hi Jeff,



Thanks for your response. Like you said, the code works for you in a Linux
system. And I am sure that the code works on Linux and even Mac os x. But if
you use MinGW (basically you have all gnu things on windows) to compile, the
code abort when running to MPI_Allreduce.



In my opinion, fortran don't visit the memory address directly. In c you use
a memory address as the receive buf, but in fortran you just pass a number
(the number defined as a macro, MPI_IN_PLACE in my example) to the
subroutine (as a wrapper, the code pass the correct address to c function
when it sees the number).



PS: the fortran function allocate can be used to dynamically tell the system
to make enough room for a matrix. Then you have a matrix instead of a
pointer. In general, you don't need to taking care of the RAM address in
fortran. If you know the name and the index of a matrix, then you have
everything. Though people introduce the concept "pointer" in fortran 90, but
to me is something similar to reference in c. I think this is just want to
introduce some data structure things.



You can find MinGW here: http://sourceforge.net/projects/mingw/files/

And it can be used by just extracting. If you compile my little code with
MinGW gfortran, then you'll see the program abort. I have no idea of
checking it. It probably a windows related error, since MinGW has nothing to
do with POSIX.



That's what I can tell so far. Any suggestions?



Yonghui