12

I'm writing a parallel program using Open MPI. I'm running Snow Leopard 10.6.4, and I installed Open MPI through the homebrew package manager.

When I run my program using mpirun -np 8 ./test, every process reports that it has rank 0, and believes the total number of processes to be 1, and 8 lines of process rank: 0, total processes: 1 get spit out to the console.

I know it's not a code issue, since the exact same code will compile and run as expected on some Ubuntu machines in my college's computer lab. I've checked homebrew's bug tracker, and no-one's reported an issue with the Open MPI package. I'm at a loss.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
aperiodic
  • 121
  • 1
  • 1
  • 3
  • Does this happen if you build from source yourself, or use the OS X (Snow Leopard) provided open-mpi? – Adam Vandenberg Oct 29 '10 at 03:00
  • Uninstalling homebrew's open-mpi caused the OS X-provided open-mpi to work. Hmm. – aperiodic Nov 16 '10 at 03:04
  • 5
    This is almost always a result of compiling with one MPI distribution and (accidentally or otherwise) running it with the mpirun of another. Make sure all your paths and dynamic library search paths have only the one distribution in them. – Jonathan Dursi Feb 16 '11 at 22:34
  • possible duplicate of [MPI\_Rank return same process number for all process](http://stackoverflow.com/questions/20287564/mpi-rank-return-same-process-number-for-all-process) – Jonathan Dursi Dec 04 '14 at 15:14

4 Answers4

7

Check which mpirun you are invoking. The mpirun that is being executed is launching 8 independent instances of the binary. So each instance is an MPI application with a universe size of 1 and rank 0.

Also, unless you are planning to run the final code on a cluster of OS X boxes, I highly recommend installing a Linux version in a VM, like virtualbox, to test & develop these codes.

powerrox
  • 1,334
  • 11
  • 21
6

Uninstall previous MPI implementation completely.

In my case I installed MPICH2 first, then uninstalled it, and changed to OpenMPI. Then same case occured, all process' rank were 0. What I did to fix this problem is: uninstall MPICH2 completely from my system (I use Ubuntu/Debian Linux).

# apt-get remove mpich2
# apt-get autoremove
Auriza Akbar
  • 61
  • 1
  • 1
4

Today I met the same problem like you. And finally I got the solution.

See https://wiki.mpich.org/mpich/index.php/Frequently_Asked_Questions#Q:_All_my_processes_get_rank_0

Simply speaking, the answer says, MPI needs suitable PMI to tell processes about their ranks and something else. Therefore, we need to use corresponding mpirun/mpiexec to run the MPI program.

I guess that your problem is related to the mismatch between mpi program compiler and the mpirun tool. So try to uninstall all, and install MPICH/openMPI(make sure just install one of them).

罗泽轩
  • 1,603
  • 2
  • 14
  • 19
2

I have had the same problem with openMPI in C on linux. Using MPIch2 in stead , the problem was fixed (but remember to run MPI_Finalize() at the end or it gets weird.)