Let's
say you are sitting at home, surfing internet via your wireless router,
and suddenly feel the unexplained urge to run some Mathematica
computations. You can not do that using your laptop: the urge is
too powerful, it requires 16 parallel kernels. But you can do that
using your workstation which is sitting at your office 10 miles away
(it's raining outside). “Remote kernel is a solutions”, you think.
So you open “Kernel Configuration Options” in your local copy of Mathematica and add a remote kernel with just basic options:
Machine Name: my.office.work.edu
Remote Login: killbull
Kernel Program: math
You type “2+2” in the Front End, enter ssh password and get, instead of “4”, the frustrating error message:
The
kernel New Kernel failed to connect to the front end. (Error =
MLECONNECT). You should try running the kernel connection outside the
front end.
Being a smart person you immediately realize the following:
- Remote kernel can’t talk to your local Front End since you have firewall running. You add exception for the remote workstation’s IP address right away.
- Since you use the router your IP is 192.168.1.10 and is not visible from the ourside world. You have to make a VPN connection to your office network to allow the remote kernel to talk to your local Front End. It’s done in no time.
$ math -mathlink -linkcreate -linkprotocol TCPIP
Link created on: 33234@129-3-222-111.vpn.uh.edu,23253@129-3-222-111.vpn.work.edu
So remote Mathematica’s kernel will happily communicate with 129-3-222-111.vpn.work.edu. Obviously, you can google "what is my IP" and it instead.
Now
you return to Mathematica’s “Kernel Configuration Options” and edit
your remote kernel's properties. You click “Advanced Options” and instead
of Mathematica’s default
`java`
-jar `mathssh` killbull@my.office.work.edu math -mathlink -LinkMode
Connect -LinkProtocol TCPIP -LinkName "`linkname`" -LinkHost `ipaddress`
you enter
ssh
killbull@my.office.work.edu /home/killbull/install/bin/MathKernel
-mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`"
-LinkHost `129-3-222-111.vpn.work.edu`
Here
-
“ssh” is instead of “`java` -jar `mathssh`“ so that Mathematica will
use regular OpenSSH to communicate. This will allow you to make use of
your huge .ssh/config file.
-
“/home/killbull/install/bin/MathKernel” instead of just “math” since
your Mathematica binaries on the remove machine are not in the PATH.
- “129-3-222-111.vpn.work.edu” instead of “ipaddress” so that remote Kernel will know where to find you local Front End.
Now everything work’s, and you can start to satisfy your urge immediately.