1

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

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 just hangs indefinitely.

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

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

which gives:

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

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

Thanks for your help!

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  
gmason
  • 95
  • 8

2 Answers2

2

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

gmason
  • 95
  • 8
0

I had the same problem. Changing permission in the working directory (recursively) solved it with chmod -R u+rwx solved it.

divibisan
  • 11,659
  • 11
  • 40
  • 58
thibault
  • 11
  • 2