2
$\begingroup$

I am trying to connect a Raspberry pi front end (notebook) to a remote kernel running Ubuntu with the free Wolfram engine.

I have researched this answer but it never worked.

Using the code below I can launch remote kernels but I want the front end to NOT use the local kernel but to use the remote kernel for all evaluations as the memory on the Pi is too small (I even have the 4 GB Pi4).

Is this even possible?

I am having trouble in the kernel configuration options dialog. Its frustrating as I can launch remote kernels but can't connect a front end. Maybe this is by design?

I keep getting the error The kernel CONNECTION_NAME failed to connect to the front end. (Error = MLECONNECT). You should try running the kernel connection outside the front end.

Needs["SubKernels`RemoteKernels`"];
Parallel`Settings`$MathLinkTimeout = 1000;

createConnectionString[user_, ip_] := Module[
  {ssh, math, number, machine, connectionString, remote},

  ssh = "export LD_LIBRARY_PATH=;ssh";
  math = "/usr/local/Wolfram/WolframEngine/12.0/Executables/\
WolframKernel" <> 
    " -wstp -linkmode Connect `4` -linkname `2` -subkernel -noinit >& \
 /dev/null &";

  number = 6;
  machine = ip;

  connectionString = 
   ssh <> " " <> user <> "@" <> machine <> " \"" <> math <> "\"";

  remote = 
   SubKernels`RemoteKernels`RemoteMachine[machine, connectionString, 
    number]

  ]

kernel = createConnectionString[USERNAME, "192.168.1.2"];

kerns = LaunchKernels[kernel]

Out[5]= {"KernelObject"[1, "192.168.1.2"], 
 "KernelObject"[2, "192.168.1.2"], "KernelObject"[3, "192.168.1.2"], 
 "KernelObject"[4, "192.168.1.2"], "KernelObject"[5, "192.168.1.2"], 
 "KernelObject"[6, "192.168.1.2"]}

In[6]:= ParallelEvaluate[$MachineName]

Out[6]= {"USERNAME-System-Product-Name", \
"USERNAME-System-Product-Name", "USERNAME-System-Product-Name", \
"USERNAME-System-Product-Name", "USERNAME-System-Product-Name", \
"USERNAME-System-Product-Name"}
$\endgroup$
2
  • $\begingroup$ I’m not sure how well this can be done seemlessly, but why not something like submitting them via remote connection using command line? $\endgroup$ Commented Feb 20, 2020 at 4:11
  • $\begingroup$ Can you elaborate a little please? Maybe a little code? I am not all the comfortable with the command line and sending them. Thanks. $\endgroup$
    – Ray Troy
    Commented Feb 28, 2020 at 15:31

0

Your Answer

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