r parallel::makeCluster() 在 Mac 上挂起 [英] r parallel::makeCluster() hangs on Mac

查看:77
本文介绍了r parallel::makeCluster() 在 Mac 上挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有点类似于这里的问题,但从来没有解决了.​​

This is somewhat similar to what was asked here but never solved.

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

I'm moving my first steps in using multiple cores for my R programs, using the parallel package. (FYI the application is a maximum likelihood estimator and some bootstrap standard errors.)

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

When I run the following to enable a cluster using two cores

cl <- parallel::makeCluster(2)

R 只是无限期挂起.

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

Following the question linked above, I try to understand what might be going wrong by running

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、我的笔记本电脑、清理工作区等,但无济于事.有人知道会发生什么吗?

I've tried restarting R, RStudio, my laptop, clearing workspace, etc. but to no avail. Does anyone know what might be going on?

感谢您的帮助!

会话信息:

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  

推荐答案

对于可能遇到同样问题的其他人,最终有效的是将 192.0.0.1 localhost 添加到我的 /etc/hosts 文件

For others who might be experiencing the same problem, what ended up working was adding 192.0.0.1 localhost to my /etc/hosts file

这篇关于r parallel::makeCluster() 在 Mac 上挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆