r parallel :: makeCluster()在Mac上挂起

时间:2018-09-20 09:47:53

标签: r macos parallel-processing

这有点类似于here,但从未解决过。

我正在使用parallel软件包为R程序使用多个内核的第一步。 (仅供参考,该应用程序是最大似然估计器和一些引导程序标准误差。)

当我运行以下命令以使用两个内核启用集群时

cl <- parallel::makeCluster(2)

R无限期地挂起。

按照上面链接的问题,我尝试通过运行来了解可能出了什么问题

cl <- future::makeClusterPSOCK(1, outfile = NULL, verbose = TRUE)

给出:

Workers: [n = 1] ‘localhost’
Base port: 11662
Creating node 1 of 1 ...
- setting up node
Starting worker #1 on ‘localhost’: '/Library/Frameworks/R.framework/Resources/bin/Rscript' --default-packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11662 OUT= TIMEOUT=2592000 XDR=TRUE
Waiting for worker #1 on ‘localhost’ to connect back
starting worker pid=89528 on localhost:11662 at 09:36:27.211
Error in socketConnection(master, port = port, blocking = TRUE, open = "a+b",  : 
  cannot open the connection
Calls: <Anonymous> ... doTryCatch -> recvData -> makeSOCKmaster -> socketConnection
In addition: Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2018e.1.0/zoneinfo/Europe/London'
2: In socketConnection(master, port = port, blocking = TRUE, open = "a+b",  :
  localhost:11662 cannot be opened
Execution halted
Error in socketConnection("localhost", port = port, server = TRUE, blocking = TRUE,  : 
  reached elapsed time limit

我尝试重新启动R,RStudio,笔记本电脑,清理工作区等,但无济于事。有人知道会发生什么吗?

感谢您的帮助!

Sessioninfo:

R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

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

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

loaded via a namespace (and not attached):
 [1] compiler_3.4.1      parallel_3.4.1      tools_3.4.1         listenv_0.7.0       yaml_2.2.0         
 [6] optimParallel_0.7-3 codetools_0.2-15    gdata_2.18.0        matrixcalc_1.0-3    digest_0.6.15      
[11] Formula_1.2-3       globals_0.12.3      gtools_3.5.0        future_1.9.0  

2 个答案:

答案 0 :(得分:1)

对于其他可能遇到相同问题的人,最终的工作是将192.0.0.1本地主机添加到我的/etc/hosts文件中

答案 1 :(得分:0)

我有同样的问题。在工作目录中更改权限(以递归方式)使用chmod -R u+rwx解决了该问题。