MPI_Barrier() does not work on a small cluster

蓝咒 提交于 2020-01-16 19:04:51

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/12854879/mpi-barrier-does-not-work-on-a-small-cluster

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!