Chapter 12. Libraries, Headers, and Frameworks

 < Day Day Up > 

11.5. Xgrid

Xgrid is an application used to create a loosely coupled cluster of Macs that can be used to run an application in parallel. That is, in a manner such that the computational work of an application is partitioned into subtasks and the subtasks are distributed and executed simultaneously across machines in the cluster. The phrase distributed computing is often used to describe the situation. Applications that can benefit from distributed computing are those whose computations can be partitioned into relatively large independent tasks, each running on a different processor and requiring little communication with each other. An application in which the same computation is performed on independent chunks of data falls into this category. Such applications are often called embarrassingly parallel. The classic examples of embarrassingly parallel applications include Monte Carlo simulation, Mandelbrot set computation, and low level image processing. Creating a distributed cluster can be complicated, and Xgrid is designed to make this task easy.

Conceptually, Xgrid has three components: a client, a controller, and an agent. From the user perspective, the client submits a job to the controller, the controller partitions the job into independent tasks and sends these tasks to available agents in the cluster, then the agents execute the tasks. When an agent complete its task, the results are sent back to the controller, which collects the results and returns the job to the client after the job has completed.

For a job to run on a cluster, the job must not only be parallelizable, it must also be run without user interaction. For command-line applications, no account on the agent is required, since the job is run as user nobody. GUI-based applications, on the other hand, require a user account that must be logged on.

Although the full version of Xgrid, including GUI tools, is available for Tiger Server, a stripped down version of Xgrid is bundled with the desktop version of Tiger. This stripped down version includes a System Preference for enabling the Xgrid agent (System Preferences Sharing Services Xgrid), as well as the xgridctl command-line tool for starting the Xgrid controller, and xgrid, for submitting jobs to the controller as an Xgrid client.

To start the Xgrid controller daemon, xgridcontrollerd, enter the following command:

     $ sudo xgridctl controller start 

xgridcontrollerd starts whenever Tiger client boots up, after you enter the following command:

     $ sudo xgridctl controller on 

The controller daemon listens for submitted jobs from clients and advertises its presence on a LAN via Bonjour.

It's important to allow TCP traffic through port 4111 in case you're running Tiger's built-in firewall. (See the section on The Mac OS X Firewall in Chapter 16 for details.)


To enable the Xgrid agent, you must configure and enable the Xgrid service in the Sharing preference panel, as shown in Figure 11-1.

Figure 11-1. Configuring Xgrid Agent in Tiger


Agent configuration involves choosing a controller and either setting the agent to always be available or only when the computer is idle. Since Xgrid supports Bonjour, the hostnames of any controllers on the LAN show up in the drop-down menu of "Use a specific controller." You can also choose the authentication method as one of password, single sign-on (using Kerberos and Directory Services), or none. Xgrid in Tiger supports two-way password authentication between the controller and agents, although currently setting a controller password with xgridctl is not supported. In the full version of Xgrid that ships with Tiger Server, you can use Server Admin to set the Xgrid controller password. If the controller is running on Tiger Server with password authentication, you can supply the controller's password when submitting a job using the xgrid command, either with the -p password flag or by setting the environment variable:

     $ export XGRID_CONTROLLER_PASSWORD="good_password" 

Other Grid Solutions for Mac OS X

Xgrid is Apple's easy to configure and use clustering software, but other more powerful and configurable options are available to turn a cluster of Macs into a high performance computing environment. These include SUN's Grid Engine (http://gridengine.sunsource.net), Pooch (http://www.daugerresearch.com/pooh), Globus (http://www.globus.org), and Condor (http://www.cs.wisc.edu/condor).

For problems that can benefit from a tightly coupled algorithmic approach, various ports of Message Passing Interface (MPI) are available for Mac OS X including: MacMPI (used with Pooch), MPICH (http://www-unix.mcs.anl.gov/mpi/mpich), and LAM/MPI (http://www.lam-mpi.org). See "Introduction to MPI Distributed Programming With Mac OS X" (http://www.developer.apple.com/hardware/hpc/mpionmacosx.html) for a fairly detailed overview of MPI on Mac OS X options.

You can obtain more information on Xgrid by visiting the Xgrid web site at http://www.apple.com/acg/xgrid, and subscribing to the Apple-maintained Xgrid-users mailing list at http://www.lists.apple.com/mailman/listinfo/xgrid-users.


An Xgrid agent for Unix and Linux is available at http://www.novajo.ca/xgridagent.


You can submit an Xgrid job from a client with the xgrid command:

     $ xgrid -h hostname -out outdir -p password -job submit command args 

Here, hostname is the IP number or hostname of the machine running the Xgrid controller, outdir is the directory in which the results are placed, password is the controller's password, and command args is a Unix shell command with its arguments.

     < Day Day Up > 


    Mac OS X Tiger for Unix Geeks
    Mac OS X Tiger for Unix Geeks
    ISBN: 0596009127
    EAN: 2147483647
    Year: 2006
    Pages: 176

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net