First of all I wanted to point out that I'm beginner regarding openMPI and all
I try to achieve is to get a simple program working on two PCs.
So far I've installed openMPI 1.2.6 on two PCs (one running OpenSUSE 10.2, the
other one Gentoo).
I set up two identical users on both systems and made sure that I can make an
SSH connection between them using private/public key authentication.
Next I ran the command
mpirun -np 2 --hostfile myhosts uptime
which gave the result
6:41pm up 1 day 5:16, 4 users, load average: 0.00, 0.07, 0.17
18:43:45 up 7:36, 6 users, load average: 0.00, 0.02, 0.05
so I concluded that MPI should work in principle.
Next I tried the following code which I copied from Boost.MPI:
int main(int argc, char* argv)
if (rank == 0)
std::cout << "Rank 0 is going to send" << std::endl;
int value = 17;
int result = MPI_Send(&value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
if (result == MPI_SUCCESS)
std::cout << "Rank 0 OK!" << std::endl;
else if (rank == 1)
std::cout << "Rank 1 is waiting for answer" << std::endl;
int result = MPI_Recv(&value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD,
if (result == MPI_SUCCESS && value == 17)
std::cout << "Rank 1 OK!" << std::endl;
Starting a parallel job using
mpirun -np 2 --hostfile myhosts mpi-test
I get the answer
Rank 0 is going to send
Rank 1 is waiting for answer
Rank 0 OK!
and than the program locks. So the strange thing is that obviously the
recv()-command is blocking, which is what I do not understand.
Could anybody provide some hints, where I should start looking for the
mistake? Any help is welcome!
Institute of Medical Engineering
Graz University of Technology