Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: parallel makePSOCKcluster hangs

I'm trying to connect to another computer via makePSOCKcluster:

library(parallel)    
cl <- makePSOCKcluster('10.0.0.107')

Unfortunatelly it hangs. I have done passwordless login with the help of ssh-keygen and ssh command in the console works on both computers.

I have also tried:

cl <- makePSOCKcluster('10.0.0.107', outfile = '')

and got the following error:

starting worker pid=2937 on blabla:11225 at 17:41:20.364
Error in socketConnection(master, port = port, blocking = TRUE, open = "a+b",  : 
  cannot open the connection
Calls: <Anonymous> ... doTryCatch -> recvData -> makeSOCKmaster -> socketConnection
In addition: Warning message:
In socketConnection(master, port = port, blocking = TRUE, open = "a+b",  :
  blabla:11225 cannot be opened
Execution halted

Then suggested by Steve Weston's answer I have tried the manual mode. I went step by step with debugging slaveRSOCK function. I got stuck on:

Error in socketConnection(master, port = port, blocking = TRUE, open = "a+b",  :
  cannot open the connection
In addition: Warning message:
In socketConnection(master, port = port, blocking = TRUE, open = "a+b",  :
  blabla:11225 cannot be opened

I have also tried to open any port using

sudo iptables -A INPUT -p tcp --dport 11000 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --dport 11000 -j ACCEPT

and it's variations on both computers.

On both laptops I have the same version of R (R.3.2.2) and parallel package. One computer has Ubuntu 14.04 and the other - Kubuntu 14.04.

Please help.

like image 878
potockan Avatar asked Dec 21 '25 15:12

potockan


1 Answers

  1. Open a port on machine 1 for listening sudo nc -l <portnumber> and leave the terminal open

  2. From another terminal check if netstat -an |grep <portnumber> |grep LISTEN is showing the port as LISTENING

  3. from machine 2 , run nc machine1 <portnumber> and see if u are able to connect and type something

If the above works fine , then your router setup is correct.

90% chance that the issue is due to router and firewall settings.

like image 69
niths4u Avatar answered Dec 23 '25 07:12

niths4u



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!