issactung
issactung

Reputation: 11

MPI_Barrier() does not work on a small cluster

I want to use MPI_Barrier() in my programme, but there are some fatal errors.

This is my code:

  1 #include <stdio.h>
  2 #include "mpi.h"
  3 
  4 int main(int argc, char* argv[]){
  5         int rank, size;
  6 
  7         MPI_Init(&argc, &argv);
  8         MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  9         MPI_Comm_size(MPI_COMM_WORLD, &size);
 10         printf("Hello, world, I am %d of %d. \n", rank, size);
 11         MPI_Barrier(MPI_COMM_WORLD);
 12         MPI_Finalize();
 13 
 14         return 0;
 15 }

And this is the output:

Hello, world, I am 0 of 2. 
Hello, world, I am 1 of 2. 
Fatal error in PMPI_Barrier: Other MPI error, error stack:
PMPI_Barrier(425).........: MPI_Barrier(MPI_COMM_WORLD) failed
MPIR_Barrier_impl(331)....: Failure during collective
MPIR_Barrier_impl(313)....: 
MPIR_Barrier_intra(83)....: 
dequeue_and_set_error(596): Communication error with rank 0

Any suggestions?

Thanks and Regards!

Upvotes: 0

Views: 2538

Answers (1)

Jonathan Dursi
Jonathan Dursi

Reputation: 50937

This generally reflects some sort of configuration error -- either host or username configurations are not consistent across nodes, or there is some sort of firewall blocking some ports. The MPICH2 FAQ discusses some places to look.

Upvotes: 2

Related Questions