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 = "";
link = LinkCreate[LinkProtocol -> "TCPIP"];
linkname = First@link;
cmd = "ssh " <> $UserName <> "@" <> machine <> " \"" <> mathl[linkname] <> "\"";

The link created is 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 = "";
link = LinkCreate["@,@,",LinkProtocol -> "TCPIP"];
linkname = First@link;
cmd = "ssh " <> $UserName <> "@" <> machine <> " \"" <> mathl[linkname] <> "\""; is the remote Pi and is the local Pi

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

process = StartProcess[$SystemShell];

1 Answer 1


It turns out that remote kernel through SSH was the most useful guide. Setting up the remote Kernels manually was more succsessful compared to using FrontEndTokenExecute["PreferencesDialog"]

In addition, I connected the boards using the on-board wireless as opposed to the LAN connection which for some reason helped.

The following code launches 4 local and 4 remote Kernels (assuming you've done ssh-keygen, ssh-copy-id pi@<remote> - reference):



user = "pi";
machine = "<remote ip>";
number = 4;(*number of parallel kernels to launch*)

ssh = "export LD_LIBRARY_PATH=;ssh";
mathl[link_] := "wolfram" <> " -mathlink -linkmode Connect `4` 
                -linkname `2` -subkernel -noinit >& /dev/null &";

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

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


The following maxes all cores on both local and remote:

ParallelTable[Prime[100000000000], {8}];

Now that this works, I'm adding two more remote Pi boards to use the full 16 Kernel license!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.