|
Special Ways to Run the Kernel
|
Your first calculation in a Mathematica session will automatically start a kernel. You can also run the Mathematica kernel directly from a command line or run a Mathematica kernel on a remote machine.
|
To run the kernel from a command line:
1. Type math at a command line and then press to start the kernel. All Mathematica input and output will appear in the command-line window.

On Mac OS X, to launch the kernel, type the full pathname in a Terminal window. For example, if you installed Mathematica in the Applications folder, type
"/Applications/Mathematica 5.0.app/Contents/MacOS/MathKernel"
To quit Mathematica on any platform, type Exit[]. You will be returned to the command-line prompt.
Batch files
When doing very large calculations, you may find it convenient to run Mathematica in batch mode. You can prepare a file with many lines of Mathematica input, read it into Mathematica, and save the result to another file using the command:
math < infile > outfile
It is sometimes useful to make the first line in the file AppendTo[$Echo, "stdout"] so that the input lines will also be included in the output file.
Running the kernel remotely
The front end can be connected to a kernel running on a remote machine. When you run a remote kernel, remember that kernel commands involving files act on the remote computer's file system, not the local computer's file system. Mathematica 5 supports kernels from Version 3.0.1 and later.
Version 5 normally connects to other kernels using the TCP/IP MathLink device to make kernel connections. Earlier versions of Mathematica do not support TCP/IP connections. See support.wolfram.com/mathematica/mathlink for more information.
Remote kernel connection on a trusted host
1. Choose Kernel Kernel Configuration Options.
2. In the dialog box that appears, click Add.
3. Fill out the Kernel Name text field, which will be the name given in the list of available kernels.
4. Specify that the kernel is on a remote machine.
5. Give the hostname of the remote machine.
6. Type your username for the remote machine.
7. Click OK to close the Kernel Properties dialog box.
8. Click OK to close the first dialog box.

To use the new kernel, go to the Kernel menu and choose the new kernel from either the Start Kernel, Default Kernel, or Notebook's Kernel submenu.
Remote kernel setup on a nontrusted host
If the remote computer does not consider your computer a trusted host, you should change the remote kernel configuration to allow you to enter your password for the remote computer.
To modify a remote kernel configuration to request entry of a password:
1. Set up a remote kernel according to the previous instructions. In the Kernel Properties dialog box, check the box labeled "Request password when connecting".
2. Click OK.
To use a remote kernel that requests a password
1. Choose the remote kernel from either the Start Kernel, Default Kernel, or Notebook's Kernel submenu.
2. If you have selected the remote kernel as the default kernel or as the cureent notebook's kernel, launch it by entering an expression and pressing   . As the remote kernel is started up, a Remote Login dialog box will pop up.
3. Enter your password for the remote machine in the Password field.
2. Click Connect. The Remote Login dialog box will disappear.
On some computers, it may take several seconds for the Mathematica kernel to start up and produce output for your first calculation.
If a kernel connection fails to start up correctly, the Mathematica front end will treat that connection as idle. If you wish to try opening the connection again, you should first choose Kernel Quit Kernel and click the name of the idle connection to close it.
|