Message Boards Message Boards


Programmatic remote kernel creation via SSH

Posted 6 months ago
0 Replies
2 Total Likes

(Cross-post from Reddit)

So I recently picked up a Raspberry Pi, and after playing with it and realizing that it has a full-fledged Mathematica in it, I started thinking about the possible use cases for a handful of these and some good sensors. The problem I ran into was that kernel configuration was flakey, problematic, error prone, and if you had more than a couple it rapidly became unfeasible.

My approach was to spend some time and put together a package that simplified programmatic connection to remote machines, launching the remote process, and linking it with the front-end. Specifically, I didn't want to have the RPi kernel my notebook kernel, but rather as an available parallel kernel, so that I could still run the heavy lifting locally, and use the remote kernels for data collection/remote sensing/etc...

The result is SSHKernel, a small package that aims to do just this! I couldn't find anything like this kicking around, and the RemoteKernel internal stuff wasn't quite working for me, so I rolled it myself, but I'm just as happy if someone can point me in the direction of an existing solution.

MathematicaSSHKernels docs

Support for remote kernels built programmatically over SSH and dynamic remote port forwarding.


Stick the SSHKernel.m file into $UserBaseDirectory<>"\\Applications".

Example Usage

In[1]:= Needs["SSHKernel`"]

In[2]:= (* "raspberrypi" is the hostname configured in my ~/.ssh/config *)
        rk = SSHKernel["raspberrypi"]; // AbsoluteTiming
Out[2]= {11.535, Null}

In[3]:= ParallelEvaluate[$Version, rk]
Out[3]= "11.2.0 for Linux ARM (32-bit) (January 15, 2018)"

In[4]:= $Version
Out[4]= "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract