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?