Mathematica Programming » Higher-Level Functionality
Remote Kernels
As mentioned in the previous section, in addition to the front-end there is the kernel. One very useful feature of Mathematica, though, is that it allows for multiple kernels to be running.
Remember that the kernel is where your code runs, so if you have a particularly time-intensive calculation running in one kernel it can be convenient to have a secondary kernel running.
Add kernels
We start another kernel via the front end. Go to Evaluation ▶ Kernel Configuration Options...
and then click Add...
and give a name to your new kernel.
Then in a new notebook go to Evaluation ▶ Notebook's Kernel
and choose this new kernel you created.
Add kernels via FrontEndTokens
We'll discuss FrontEndTokens
more later, but for now just consider them a mechanism to use all front end functionality from the kernel.
For our cases here, we can make our lives a little bit easier by using a special FrontEndToken
FrontEndExecute@FrontEndToken["ModifyEvaluatorNames"]
or more simply:
FrontEndTokenExecute["ModifyEvaluatorNames"]
This gives us the add dialog. Unfortunately FrontEndTokens
are not particularly well documented and so the command for setting a notebook's kernel remains opaque.
Remote kernels
One useful feature of kernels is that they can be run anywhere—not just on your local computer. If, then, Mathematica exists on a remote server, call it "server.place.dom"
, say, a kernel can be initiated there and connected to your local front end, by passing X-Windows or a similar remote GUI system.
We can access this by going back to Evaluation ▶ Kernel Configuration Options...
or doing the same via the following:
FrontEndTokenExecute["ModifyEvaluatorNames"]
Then in Add...
under Basic Options
select Remote Machine
and input your info. If the server is "server.place.dom"
, put that as the Remote host
and give your info as the Remote user
.
Then whenever you give that kernel as a notebook name and try to evaluate anything or start the kernel, Mathematica will pop up a dialog asking for your password.
If you have RSA authentication enabled, this password step becomes unnecessary.