Mathematica 9 is now available
Previous section-----Next section

Parallel Computing Toolkit — Examples

Interval Minimum

Preparation

Make sure you have at least two kernels available.

Auxiliary Data Types

This example makes use of a number of ad hoc data types that are defined in this section.

Domain/Range Pairs

Priority Queue

We need to queue pairs of {domain rectangle, range interval}, sorted by the decreasing lower bound of the range. We can use PCT's priority queue.
Note: For this example the Parallel/Queue directory of PCT must be installed on all remote machines. The copyright of the queue packages allows you to do that even if PCT itself is not licensed on the remote machines.
Client-side access

Interval Arithmetic

Merge Domain Intervals

One-dimensional case, slow.

Interval Driver Loop

Bag for Remote Result Storage

We choose the fastest queue implementation; the order in which items are stored is not important.

Remote Priority Queues

Here are the priority queues on the remote kernels.

Synchronization

The idea is to do all in one call: update minmax, look at the global queue size, and get an interval and the current minmax value.
Atomic update

Driver Code

This procedure will be run on each remote kernel.

Sequential Test

We define an example function and run the driver code sequentially on the master kernel for testing.

Go for It

This section contains several test examples.
Optionally you may enable tracing to see how the computation is synchronized. When you do so, you should use larger tolerance values to avoid too much output.

1D Example 1 (With Annotations)

Define the function whose minimum should be found.
Define the rectangle or interval over which the search should be performed.
Choose a search tolerance. The smaller it is, the longer it will take to find the minimum.
A few initial splits of the domain are used to initialize the queue.
Initialize the queue by entering the rectangles into it.
Initialize the shared variables and start the driver code on all remote kernels. Before it finishes, the driver will print statistics about its performance.
Here is the minimum found.
We collect all intervals in which the minimum may lie.
Here is the interval containing the minimum and the list of domain intervals where it lies.

1D Example 2

Here are a few initial splits to prime the queue.

2D

Here are a few initial splits to prime the queue.

2D (Janos Pinter)

Here are a few initial splits to prime the queue.

Wood (4D)

Here are a few initial splits to prime the queue.

Performance

Define Performance[] from the Performance Measurement and Calibration example notebook.
Set up an example function as before, then adjust the desired tolerance.
Run it.
Here is the remote processor utilization in %.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.