我是使用MPI的初学者。在这里,我编写了一个非常简单的程序来测试MPI能否运行。这是我的头盔。
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(processor_name, &namelen);
MPI_Barrier(MPI_COMM_WORLD);
printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);
MPI_Finalize();
}我用节点来测试,主机文件是: node1 node2
所以我有两台叫做node1和node2的机器。我可以在没有密码的情况下互相交流。
我通过键入:mpirun -np 2 -f hostfile ./hello启动程序。
可执行文件hello位于两台机器的同一个目录中。
然后,在我跑完之后,我得到了一个错误:
PMPI_Barrier中的致命错误:其他MPI错误,错误堆栈:PMPI_Barrier(425).:MPI_Barrier(MPI_COMM_WORLD) Failure MPIR_Barrier_impl(331).:MPIR_Barrier_impl(313).:MPIR_Barrier_intra(83).:dequeue_and_set_error(596):PMPI_Barrier中具有0级致命错误的通信错误:其他MPI错误,错误堆栈:PMPI_Barrier(425).:MPI_Barrier(MPI_COMM_WORLD) Failure MPIR_Barrier_impl(331).:MPIR_Barrier_impl(313).:MPIR_Barrier_intra(83).:dequeue_and_set_error(596):等级为1的通信错误
如果我注释掉MPI_Barrier(),它可以正常工作。好像机器之间的通讯有问题吗?还是我没有正确安装openmpi?有什么想法吗?
我用的是Ubuntu 12.10
我得到了一些提示:这在MPICH2中不能很好地工作,如果我使用openmpi,那么它就能工作。我只是通过sudo apt安装mpich2来安装MPICH。我错过了什么吗?mpich2的大小比openmpi小得多
发布于 2014-06-27 22:53:30
在/etc/host中,一些Linux发行版的更新版本在文件的顶部添加了以下类型的行:
127.0.0.1 localhost
127.0.0.1 [hostname]这应该被更改,以便主机名行包含您的实际IP地址。如果您不使用以下错误进行此更改,则MPI hydra进程将中止:
Fatal error in PMPI_Barrier: Other MPI error, error stack:
PMPI_Barrier(425)...........: MPI_Barrier(MPI_COMM_WORLD) failed
MPIR_Barrier_impl(292)......:
MPIR_Barrier_or_coll_fn(121):
MPIR_Barrier_intra(83)......:
dequeue_and_set_error(596)..: Communication error with rank 0https://stackoverflow.com/questions/15984061
复制相似问题