在两台主机上运行MPI

时间:2013-02-25 17:16:46

标签: cluster-computing mpi

我看了很多例子,我仍然感到困惑。我已经从here编译了一个简单的延迟检查程序,它在一台主机上运行完美,但是当我尝试在两台主机上运行时,它会挂起。但是,运行类似hostname的运行正常:

[hamiltont@4 latency]$ mpirun --report-bindings --hostfile hostfile --rankfile rankfile -np 2 hostname
[4:16622] [[5908,0],0] odls:default:fork binding child [[5908,1],0] to slot_list 0
4
[5:12661] [[5908,0],1] odls:default:fork binding child [[5908,1],1] to slot_list 0
5

但这是编译的延迟程序:

[hamiltont@4 latency]$ mpirun --report-bindings --hostfile hostfile --rankfile rankfile -np 2 latency 
[4:16543] [[5989,0],0] odls:default:fork binding child [[5989,1],0] to slot_list 0
[5:12582] [[5989,0],1] odls:default:fork binding child [[5989,1],1] to slot_list 0
[4][[5989,1],0][btl_tcp_endpoint.c:638:mca_btl_tcp_endpoint_complete_connect] connect() to 10.0.2.5 failed: Connection timed out (110)

我目前的猜测是我的防火墙规则有问题(例如主机名不在主机之间通信,但延迟程序会这样做。)

[hamiltont@4 latency]$ cat rankfile
rank 0=10.0.2.4 slot=0
rank 1=10.0.2.5 slot=0
[hamiltont@4 latency]$ cat hostfile 
10.0.2.4 slots=2
10.0.2.5 slots=2

1 个答案:

答案 0 :(得分:11)

运行Open MPI作业涉及两种通信。首先,必须启动工作。 Open MPI使用特殊框架来支持多种启动,您可能正在使用SSH上的rsh远程登录启动机制。显然,您的防火墙已正确设置为允许SSH连接。

当启动Open MPI作业并且进程是真正的MPI程序时,它们会连接回生成作业的mpirun进程并了解作业中的其他进程,最重要的是可用的网络端点在每个过程中。这条消息:

[4][[5989,1],0][btl_tcp_endpoint.c:638:mca_btl_tcp_endpoint_complete_connect] connect() to 10.0.2.5 failed: Connection timed out (110)

表示在主机4上运行的进程无法打开与在主机5上运行的进程的TCP连接。最常见的原因是防火墙的存在,这限制了入站连接。因此,首先要检查防火墙。

另一个常见原因是,如果在两个节点上都配置了额外的网络接口,并且具有兼容的网络地址,但无法在它们之间建立连接。这通常发生在较新的Linux设置上,默认情况下会启动各种虚拟和/或隧道接口。可以通过在btl_tcp_if_exclude MCA参数中列出它们(作为接口名称或CIDR网络地址)来指示Open MPI跳过这些接口,例如:

$ mpirun --mca btl_tcp_if_exclude "127.0.0.1/8,tun0" ...

(如果设置btl_tcp_if_exclude

,则必须添加环回接口

或者可以通过在btl_tcp_if_include MCA参数中列出它们来明确指定要用于通信的接口:

$ mpirun --mca btl_tcp_if_include eth0 ...

由于错误消息中的IP地址与主机文件中第二台主机的地址相匹配,因此问题必须来自主动防火墙规则。

相关问题