我已经用ompi配置了两个主机,并且我能够成功地在两个示例代码下面分别运行。
#include "mpi.h"
#include <stdio.h>
int main(argc,argv)
int argc;
char *argv[]; {
int numtasks, rank, dest, source, rc, count, tag=1;
char inmsg, outmsg='x';
MPI_Status Stat;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
dest = 1;
source = 1;
rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);
}
else if (rank == 1) {
dest = 0;
source = 0;
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);
rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);
}
rc = MPI_Get_count(&Stat, MPI_CHAR, &count);
printf("Task %d: Received %d char(s) from task %d with tag %d \n",
rank, count, Stat.MPI_SOURCE, Stat.MPI_TAG);
MPI_Finalize();
}
-np 2发送Receive.o
效果很好。
mpirun -np 2--主机host1,host1 sendReceive.o
[ip-172-31-71-xx:11221] [[55975,0],1] ORTE_ERROR_LOG: Data unpack would read past end of buffer in file base/odls_base_default_fns.c at line 398
--------------------------------------------------------------------------
ORTE has lost communication with a remote daemon.
HNP daemon : [[55975,0],0] on node ip-172-31-78-xx
Remote daemon: [[55975,0],1] on node ip-172-31-71-xx
This is usually due to either a failure of the TCP network
connection to the node, or possibly an internal failure of
the daemon itself. We cannot recover from this failure, and
therefore will terminate the job.
--------------------------------------------------------------------------
我验证了我可以在主机之间进行ssh并正确地配置。我不能把范围缩小到这里的问题上。有什么建议吗?
答:在每个系统中,我错误地采取了不同版本的mpi。当我更正版本,它的工作!
发布于 2017-06-15 19:25:03
您必须允许您的安全组在主机内部传递mpi通信。您可以首先将MPI通信限制在特定的端口范围内,并允许在自定义TCP端口范围下在安全组中使用此端口范围来修复此问题。那么,您应该能够像预期的那样处理这个问题。要限制端口范围,请参考openmpi-mca-params.conf (根据配置文件:)
默认情况下,搜索两个文件(按顺序排列):
$HOME/.openmpi/mca-params.conf
:用户提供的一组值具有最高优先级。$prefix/etc/openmpi-mca-params.conf
:系统提供的一组值具有较低的优先级。
若要允许安全组通信自定义TCP端口,
https://stackoverflow.com/questions/44573328
复制相似问题