Rmpi是否需要有效的Internet连接?

Bea*_*eld 5 parallel-processing macos r mpi

我刚刚Rmpi使用本教程安装:Mac OS-X Mountain Lion上的http://www.stats.uwo.ca/faculty/yu/Rmpi/mac_os_x.htm.我只需要使用Rmpi来使用所有内核,而不是在硬件集群或类似设备上进行部署.

实际上,一切正常,但现在我体验到,每当我没有活跃的互联网连接(如坐在火车上或只是转动无线)产卵奴隶就会失败,我想知道这是否应该像这样工作?

> require( Rmpi )
> mpi.spawn.Rslaves( nslaves=2 )

--------------------------------------------------------------------------
At least one pair of MPI processes are unable to reach each other for
MPI communications.  This means that no Open MPI device has indicated
that it can be used to communicate between these processes.  This is
an error; Open MPI requires that all MPI processes be able to reach
each other.  This error can sometimes be the result of forgetting to
specify the "self" BTL.

  Process 1 ([[56132,1],0]) is on host: ABC-MB02
  Process 2 ([[56132,2],0]) is on host: ABC-MB02
  BTLs attempted: self sm

Your MPI job is now going to abort; sorry.
--------------------------------------------------------------------------
    2 slaves are spawned successfully. 0 failed.
[ABC-MB02:53970] 2 more processes have sent help message help-mca-bml-r2.txt / unreachable proc
[ABC-MB02:53970] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
Run Code Online (Sandbox Code Playgroud)

然后我的CPU负载刚刚跳到100%,最终R会崩溃.

我有什么想法可以避免这种行为吗?这是我的sessionInfo

R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] graphics  grDevices datasets  stats     utils     methods   base     

other attached packages:
[1] Rmpi_0.6-3     ggplot2_0.9.3  stringr_0.6.2  reshape2_1.2.2 plyr_1.8      

loaded via a namespace (and not attached):
 [1] colorspace_1.2-1   dichromat_2.0-0    digest_0.6.3       grid_2.15.2        gtable_0.1.2       labeling_0.1      
 [7] MASS_7.3-23        munsell_0.4        proto_0.3-10       RColorBrewer_1.0-5 scales_0.2.3       tools_2.15.2
Run Code Online (Sandbox Code Playgroud)

Ste*_*ton 4

它不需要互联网连接,但如果您只有“self”和“sm”BTL可用,则当您生成进程时,Open MPI似乎会失败,并且在我的Mac笔记本电脑上,“tcp”BTL不可用,除非“网络偏好设置”中至少有一个“已连接”网络。有趣的是,当工作程序由 mpirun 启动而不是生成时,我能够成功使用 Rmpi​​。另外,当 Linux 机器完全拔掉插头时,我在它上生成进程时没有任何问题。

通过使用以太网电缆将笔记本电脑连接到另一台计算机,甚至是一个小型 Raspberry Pi,我能够让我的笔记本电脑成功生成进程。尽管电缆实际上不能用于任何用途,但它会欺骗 Mac 认为“以太网”已连接,因此“tcp”BTL 在 Open MPI 中可用,因此生成过程可以正常工作。

更新:

我终于找到了一个适用于我的 MacBook Pro 的解决方案。通过将btl_tcp_if_include MCA 参数设置为“lo0”,您可以在笔记本电脑未连接到任何外部网络时强制 Open MPI 使用环回接口进行 TCP 通信。设置它的一种方法是在 R 脚本中使用环境变量:

Sys.setenv(OMPI_MCA_btl_tcp_if_include='lo0')
library(Rmpi)
mpi.spawn.Rslaves(nslaves=2)
Run Code Online (Sandbox Code Playgroud)

只要您在加载之前Rmpi(即调用 MPI_INIT 时)设置环境变量,它似乎就可以工作。