Skip to main content
2 of 4
added 158 characters in body
Young
  • 7.5k
  • 1
  • 22
  • 46

Remote Raspberry Pi Kernel from 2nd Raspberry Pi Front End

I've reviewed the following posts:

Connecting two Raspberry Pi's using MathLink

Remote kernel through SSH

How to connect the front end of one raspberry pi with the kernel of another

But have been unsuccessful in launching a remote kernel on a Pi from another Pi's front end.

I completed step 1 from the last referenced post and can access the remote Pi without a password using the terminal window but every other step fails once confined to the front end.

mathl[link_] := "wolfram -mathlink -linkmode Connect -linkprotocol TCPIP 
 -linkname " <> link <> " -subkernel -noinit &< /dev/null &";
machine = "169.254.160.100";
link = LinkCreate[LinkProtocol -> "TCPIP"];
linkname = First@link;
cmd = "ssh " <> $UserName <> "@" <> machine <> " \"" <> mathl[linkname] <> "\"";

The link created is 127.0.0.1 which doesn't work and seems wrong so I forced it to use the following:

mathl[link_] := "wolfram -mathlink -linkmode Connect -linkprotocol TCPIP 
 -linkname " <> link <> " -subkernel -noinit &< /dev/null &";
machine = "169.254.160.100";
link = LinkCreate["@169.254.160.120,@169.254.160.120,",LinkProtocol -> "TCPIP"];
linkname = First@link;
cmd = "ssh " <> $UserName <> "@" <> machine <> " \"" <> mathl[linkname] <> "\"";

169.254.160.100 is the remote Pi and 169.254.160.120 is the local Pi

No matter what I try it seems to hang on LinkWrite[link,Unevaluated@{$MachineName,Now[]}]; of

process = StartProcess[$SystemShell];
    WriteLine[process,cmd];
    LinkWrite[link,Unevaluated@{$MachineName,Now[]}];
LinkRead@link

I've also tried:

Needs["SubKernels`RemoteKernels`"]

Parallel`Settings`$MathLinkTimeout = 100

user = "pi";
machine = "169.254.160.100";
number = 1; (*number of parallel kernels to launch*)

ssh = "export LD_LIBRARY_PATH=;ssh"
mathl[link_] :=  "wolfram" <> " -mathlink -linkmode Connect `4` 
 -linkname " <> link <> " -subkernel -noinit >& /dev/null &";
link = LinkCreate["@169.254.160.120,@169.254.160.120,",LinkProtocol -> "TCPIP"];
linkname = First@link;

remote = SubKernels`RemoteKernels`RemoteMachine[machine, 
  ssh <> " " <> user <> "@" <> machine <>
    " \"" <> mathl[linkname] <> "\"", number]

Print[remote // InputForm]
kerns = LaunchKernels[remote]

ParallelEvaluate[$MachineName]

This second attempt seems more promising. I think it initiates the Kernels on the remote Pi but doesn't complete the operation for some reason and just hangs.

Young
  • 7.5k
  • 1
  • 22
  • 46