## Before Installing grid*Mathematica*

grid*Mathematica* adds more power to parallel computations in *Mathematica*. *Mathematica* Core Extension runs more computation processes on the machine on which *Mathematica* is installed. In contrast, grid*Mathematica* runs computation processes on other machines across a network, orchestrated from a controlling *Mathematica* process. The computers on which computation processes run are compute nodes; the computers on which the controlling *Mathematica* processes run are controlling nodes.

Depending on your grid configuration, either grid*Mathematica* Server or *Mathematica* must be installed on each compute node. Each compute node must be networked or on a networked file system accessible to each machine. The *Mathematica* license manager (*MathLM*) must also be installed and configured on a machine able to serve passwords to all computation nodes. You also need software to allow *Mathematica* to launch computation kernels on each computer across the network; this is discussed further in the next section.

## Grid Management Options

There are three ways of controlling the grid: Wolfram Lightweight Grid Manager, grid-management software, and manual remote kernel connections. In *Mathematica* these are called Lightweight Grid, Cluster Integration and Remote Kernels, respectively. The most appropriate choice is determined by your grid configuration.

For parallel computing, *Mathematica* runs computation kernels on grid*Mathematica* Server computers. The Wolfram Lightweight Grid System provides an intuitive way to manage your grid. The system, comprising Lightweight Grid Client and Lightweight Grid Manager, is useful if you have a collection of computers but do not have any special grid-management software. Each copy of *Mathematica* 8 contains Lightweight Grid Client, allowing it to control compute nodes in the grid. Lightweight Grid Manager, which is provided by the grid*Mathematica* Server installer, allows you to easily connect control and compute nodes.

You do not have to use Lightweight Grid Manager. Instead, you can use your own cluster management system such as Windows HPC Server 2008, Platform LSF, or Sun Grid Engine. You can also make manual remote kernel connections using SSH or RSH. *Mathematica* contains tools that enable you to use these alternatives.

## Configuration Layout

Before installing grid*Mathematica* Server, you must decide how to install the different components. Choose the layout that best matches your system configuration.

For any configuration, the following must be true:

*Mathematica*must be installed on any controlling computer- the network must allow the controlling computers to freely communicate directly with all compute nodes
- the network must allow each compute node to contact the machine on which
*MathLM*is installed

### Distributed Grid

With a distributed grid, you must install grid*Mathematica* Server on each node or on a shared file system. You should install *MathLM* on a separate dedicated server. This configuration is well suited to Lightweight Grid Manager. You may instead use a separate grid management system, for example if you need scheduled access to compute nodes.

### Mixed Workgroup Cluster

A mixed workgroup cluster may be controlled by Lightweight Grid; in this case, you must install grid*Mathematica* Server on each compute node and choose the option to configure Lightweight Grid Manager. However, if many computers already have *Mathematica* installed, you might elect to install grid*Mathematica* Server on the remaining computers and control the cluster using remote kernels. You must install *MathLM* on a machine that is accessible by all compute nodes.

### High-Performance Cluster

In a high-performance cluster (with or without multiprocessor systems), nodes typically have a shared file system or cloned file systems on which grid*Mathematica* Server must be installed. If your cluster has a grid-management system, as most clusters do, you would not configure Lightweight Grid Manager. If yours does not, when you install grid*Mathematica* Server, you must choose the option to configure Lightweight Grid Manager. Install *MathLM* on one of the cluster nodes or on an external machine. If you install *MathLM* on an external machine, the network must be configured so that the cluster nodes can resolve the IP address of that machine.

Controlling kernels can be run from either one of the cluster nodes or from a machine external to the cluster; if an external machine, *Mathematica* must also be installed on it. If the controlling node is a cluster node, *Mathematica* should be installed on it as well as grid*Mathematica* Server. You may want to connect to it from a *Mathematica* front end on a separate workstation. The controlling node can use *Mathematica*‘s built-in cluster integration or must be able to connect to all other nodes without a password via RSH or SSH. If a workstation is used to access the controlling node, it must be able to do so using RSH or SSH.

## Setting Up grid*Mathematica*

### Install *MathLM*

Install *MathLM* on the appropriate machine for your configuration, as described in the previous section. This machine must be able to serve passwords to machines that are running grid*Mathematica* Server. See the Wolfram *Mathematica* Documentation Center for installation instructions.

### Setting up grid*Mathematica* with Lightweight Grid

After *MathLM* is installed, you will install grid*Mathematica* Server on each compute node, making sure to configure Lightweight Grid Manager when prompted. You can follow the instructions in the Lightweight Grid Manager User Guide; see screencasts below showing the Lightweight Grid Manager installation process on Windows, Mac OS X, and Linux respectively. When configuring the license information for Lightweight Grid Manager, specify the hostname of the *MathLM* server that you set up. To control these kernels, use the “Lightweight Grid” tab in *Mathematica*‘s Parallel Kernel Configuration dialog.

The following screencasts show how to install and set up Wolfram Lightweight Grid Manager.

For further installation assistance, please see the user guide or contact Wolfram Support.

### Setting up grid*Mathematica* with Cluster Integration

First install and configure *MathLM* and your grid management system. If the cluster is using a shared file system, install grid*Mathematica* Server on the shared file system and do not choose the option to configure Lightweight Grid Manager. If there is no shared file system, you must install grid*Mathematica* Server on each compute node, again not configuring Lightweight Grid Manager. To activate your copy of grid*Mathematica* Server, follow the instructions for activating *Mathematica*, and choose the activation option “Connect to a network license server”. If installing on the Mac OS X platform, see the section below for activation on Mac OS X.

If the cluster prevents direct connection to the compute nodes from external workstations, you must install *Mathematica* on the head node; this will be the control node. If the cluster allows direct connections to the compute nodes, then any computer with *Mathematica* may be used as a control node.

Finally, to control the compute nodes, use the “Cluster Integration” tab in *Mathematica*‘s Parallel Kernel Configuration dialog.

### Setting up grid*Mathematica* with Remote Kernels

After *MathLM* is installed, you need to set up passwordless SSH or RSH on all control and compute nodes, such that all control nodes can connect to the compute nodes without a password. In this configuration, each computer may be a control node, a compute node, or both. On each control node, install Mathematica if it is not already present. Then install grid*Mathematica* Server on any remaining compute nodes. To activate your copy of grid*Mathematica* Server, follow the instructions for activating *Mathematica*, and choose the activation option “Connect to a network license server”. If installing on the Mac OS X platform, see the section below for activation on Mac OS X.

Finally, to control the compute nodes, use the “Remote Kernels” tab in *Mathematica*‘s Parallel Kernel Configuration dialog.

### Activating grid*Mathematica* Server on Mac OS X

Once you have installed grid*Mathematica* Server on Mac OS X, you need to activate it by telling grid*Mathematica* Server the fully-qualified hostname of your *MathLM* server. You can do this in one of two ways: you can use the *Mathematica* front end or you can manually create the mathpass file. Refer to the tutorial Registration and Passwords for full details on the mathpass file and network *Mathematica* passwords.

In order to activate grid*Mathematica* Server with the *Mathematica* front end, use Finder to locate the folder where you installed gridMathematicaServer. Right-click on the grid*Mathematica* Server icon and select “Show Package Contents”. In the finder window that opens, click Contents, then Mac OS, and finally double-click on *Mathematica*. The Wolfram Product Activation window will open and you can follow the instructions for activating *Mathematica*, choosing the option “Connect to a network license server”.

You may choose to activate grid*Mathematica* Server by manually creating the mathpass file. First locate the directory where you installed grid*Mathematica* Server and create a directory named “Licensing”. Then use a text editor to create a file named mathpass in the Licensing directory. For example, if you installed grid*Mathematica* Server to its default location, your mathpass file would be in /Applications/gridMathematicaServer.app/Licensing/mathpass. In this text file put a single line beginning with an exclamation point and followed by the fully-qualified hostname of your mathpass server.

You can perform these steps in a Terminal window. For this example, we assume the default installation directory and that the *MathLM* server is named mathlmserver.example.com:

```
prompt% cd /Applications/gridMathematicaServer.app
prompt% mkdir Licensing
prompt% cd Licensing
prompt% cat > mathpass
!mathlmserver.example.com
```

Press Ctrl-d after typing the last line to finish creating the mathpass file.