Start a local kernel (the command to do so may depend on the operating system):
![[Graphics:../Images/MSRI98_gr_3.gif]](../Images/MSRI98_gr_3.gif)
Start a remote kernel with rsh or ssh:
remote=LinkLaunch["ssh urania math -MathLink -noinit"]
You can also start the remote kernel manually with math -MathLink -linkcreate and then connect to the resulting port using LinkConnect.
Swallowing initial line-number packet.
![[Graphics:../Images/MSRI98_gr_6.gif]](../Images/MSRI98_gr_6.gif)
![[Graphics:../Images/MSRI98_gr_8.gif]](../Images/MSRI98_gr_8.gif)
Avoid blocking:
![[Graphics:../Images/MSRI98_gr_10.gif]](../Images/MSRI98_gr_10.gif)
Sending expressions for evaluation:
![[Graphics:../Images/MSRI98_gr_12.gif]](../Images/MSRI98_gr_12.gif)
Polling for result
![[Graphics:../Images/MSRI98_gr_13.gif]](../Images/MSRI98_gr_13.gif)
Dealing with other packets
![[Graphics:../Images/MSRI98_gr_15.gif]](../Images/MSRI98_gr_15.gif)
![[Graphics:../Images/MSRI98_gr_16.gif]](../Images/MSRI98_gr_16.gif)
![[Graphics:../Images/MSRI98_gr_18.gif]](../Images/MSRI98_gr_18.gif)
![[Graphics:../Images/MSRI98_gr_20.gif]](../Images/MSRI98_gr_20.gif)
Ending session
![[Graphics:../Images/MSRI98_gr_22.gif]](../Images/MSRI98_gr_22.gif)
Higher-level routines for starting/closing MathLink connections (OS dependent).
LaunchSlave["host", "cmdTemplate", options...]
ConnectSlave["port@host", options...]
cmdTemplate is a string used in StringForm, `1` will be replaced by the hostname. The second form connects to a waiting kernel; this form can be used if security prevents you from executing a remote command directly.
Start local kernel:
LaunchSlave["localhost", $mathkernel]
List of all available remote kernels
![[Graphics:../Images/MSRI98_gr_24.gif]](../Images/MSRI98_gr_24.gif)
Basic remote evaluation (blocking):
SetAttributes[RemoteEvaluate, HoldRest]
RemoteEvaluate[expr_, link_LinkObject]:=
Module[{},
Send[link, expr];
Receive[link]
]
RemoteEvaluate[cmd] sends cmd to all kernels in parallel, gives list of all results.
Here we gather information about the remote kernels currently running.
![[Graphics:../Images/MSRI98_gr_25.gif]](../Images/MSRI98_gr_25.gif)
| "" | "host" | "system" | "process" | "Mathematica Version" |
| 1 | "prokyon" | "Solaris" | 4409 | "Solaris 3.0 (April 26, 1997)" |
| 2 | "prokyon" | "Solaris" | 4410 | "Solaris 3.0 (April 26, 1997)" |
| 3 | "urania" | "Linux" | 3392 | "Linux 3.0 (April 25, 1997)" |
Document converted by Mathematica of Wolfram Research