Parallel Computing Toolkit
Examples

An Animation

This example uses the uniform polyhedra package from The Mathematica Programmer Vol. II to render an animation of a rotating uniform polyhedron.

Reference:
Roman E. Maeder, The Mathematica Programmer II. Academic Press, 1996. ISBN 0-12-464992-0.

Init

Parallel Processing Toolkit

Load the Parallel Computing Toolkit and the package with the parallel commands.

Needs["Parallel`Parallel`"]
Needs["Parallel`Commands`"]

Now, start any number of remote kernels. This command assumes that you have set up the list $AvailableMachines to list all normally available remote computers.

LaunchSlaves[] // TableForm

Find the number of available parallel kernels.

Length[$Slaves]

Optionally enable latency hiding.

$LoadFactor = 2;

Uniform Polyhedra

Read the uniform polyhedra package locally. Note: this package is not part of Mathematica. It comes with the CD-ROM included in Roman Maeder, The Mathematica Programmer Vol. II, Academic Press, 1996. ISBN 0-12-464992-0. See also the book's Web site.

Needs["MathProg`PolyhedraExamples`"]

For the benefit of those users who have not installed the book's packages, a copy of PolyhedraExamples.m and UniformPolyhedra.m is included with the Parallel Computing Toolkit. Use this command to read this copy of the package instead of the one above.

Needs["Parallel`PolyhedraExamples`"]

This standard package is used to rotate the polyhedron. Read it locally and on all remote kernels.

Needs["Graphics`Shapes`"]

RemoteEvaluate[Needs["Graphics`Shapes`"]]

Note that the polyhedra package need not be available to the remote kernels.

The Great Icosidodecahedron

We generate the graphic data of the Great Icosidodecahedron, which is no. 54 on the standard list of uniform polyhedra.

poly = Graphics3D[NumberedPolyhedron[54]]

We determine the plot range for later correct positioning of the rotating object in a steady frame.

FullOptions[poly, PlotRange]

We export the polyhedral data structure to all remote kernels.

ExportEnvironment[poly]

Here is a quick sequential check with an animation with a small number of frames.

Animate[
      Show[RotateShape[poly, phi, 0, 0], SphericalRegion -> True, 
        Boxed -> False], {phi, 0, 0.2, 0.1}]

Now, the high-resolution parallel animation. Because of the symmetry of the polyhedron around the axis of revolution we need to rotate it only by 180°.

ParallelAnimate[
      Show[RotateShape[poly, phi, 0, 0], SphericalRegion -> True, 
        Boxed -> False, 
        PlotRange -> 1.8 {{-1, 1}, {-1, 1}, {-1, 1}}], {phi, 0, 
        Pi}, Frames -> 24, Closed -> True]

Cleanup

CloseSlaves[]