OpenMPI: All nodes run as node 0

I have a c++ program that is using the openMPI library to pass messages between different processors. It is a parallel program that uses a genetic algorithm to get a good solution for the traveling salesperson problem. I am trying to set up the MPI environment on my two dual processor computers at my house so that I can run it. When I first created this program a year ago, I was able to run it fine on a cluster that was not set up by me. The problem that I am having now is that whenever I run it, all the processes are saying that they are of rank 0. If I have 3 nodes, instead of them being nodes 1, 2, and 3, they are all node 0. If anyone knows what is going on, I would sure appreciate some help. Thanks.


I found out what the problem was. I had two packages installed that both used the mpirun command. I believe it was both openmpi and mpich packages. I removed openmpi and it worked.


Perhaps your initialization is wrong or you have some error checking the rank. This should be the right way to do this:

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("I am process %d of %d.n", rank, size);

But I assume you did that right, so I agree to Harleqin, showing the commands/scripts you use would be helpful.

链接地址: http://www.djcxy.com/p/42132.html

上一篇: .net中的crypt()函数?

下一篇: OpenMPI:所有节点都以节点0运行