Contents Previous Next
3 Grid Computing Toolbox
3.1 Introduction to the Grid Computing Toolbox
The Grid Computing Toolbox provides tools for performing Maple computations in parallel, allowing you to distribute computations across a network of workstations, a supercomputer, or the CPUs of a multiprocessor machine. It includes a personal grid server, allowing you to simulate and test your parallel applications before running them on a real grid network.
Features of this toolbox include:
A self-assembling grid in local networks, with an easy-to-use interactive interface for launching parallel jobs.
Integration with job scheduling systems, such as PBS.
High-level parallelization operations, such as map and seq, as well as a generic, parallel divide-and-conquer algorithm.
Automatic deadlock detection and recovery.
Before installing the Grid Computing Toolbox, you must install and activate Maple 2023. For details and installation instructions, see the Install.html file on the product disc.
You need a purchase code to activate the Grid Computing Toolbox. This code has been emailed to you. If you have not received your purchase code, contact Maplesoft Customer Service at firstname.lastname@example.org, or the Maplesoft office or reseller in your region (visit http://www.maplesoft.com/contact/).
Note that if you do not have a valid Grid license, the Grid Computing Toolbox will run in a limited capacity, allowing at most one server per machine and eight nodes in a job.
After installation, the GridComputing.mw file appears on your desktop (Windows and Mac) or in your home directory (Linux). Open this file.
3.2 Getting Started with the Grid Computing Toolbox
Establishing a Server and Network
You can run a server on your desktop machine to develop and test your parallel applications. The Personal Grid Server worksheet is an interactive Maple document that can help you start a personal server with any number of nodes.
The following Maple commands are a guideline for configuring your computer for a personal server. The given broadcast mask should ensure that you will not be added to any Grid networks. Note that these settings can be set by default. See the Install.html file for instructions. Configuration details can be found on the Grid/Properties help page.
gridhost ≔ localhost: gridport ≔ 2000:
GridSetup hpc, host=gridhost, port=gridport
To run Grid Computing applications on a network of machines, you must start Grid servers on each machine that you want to be part of the network. The toolbox will automatically detect new machines as they are added to the network, or you can turn off auto-discovery for use in a controlled environment, such as a PBS setup.
You will need to re-configure the Grid so that you can create or be added to a Grid network. Change the broadcastAddress and broadcastPort to your network's settings, and then start a server with those settings.
A few simple interactive examples using multiple nodes over multiple machines are in the Grid Computing worksheet.
You are now ready to use the Grid Computing Toolbox, either on your own computer as a test server, or on a network of computers to run parallel applications.
Help with Grid Computing
For a list of commands in Maple to support the Grid Computing Toolbox, see the Grid help page.
3.3 Working with the Grid Computing Toolbox
As mentioned in the previous section, a few simple examples using multiple nodes over multiple machines can be found in the Grid Computing worksheet.
The following provides a sample of the commands required to execute such examples. To begin, start a personal server using the local settings from the previous section, or use your network settings to connect with other computers running servers in the Grid Computing Toolbox. The code for this example can be found in the Grid Computing worksheet.
Define the application or procedure that you want to perform, call it sampleCode. Then execute the following commands to deploy the application sampleCode over the network.
result ≔ Launchnumnodes=AvailableNodes,sampleCode
When you are finished, make sure to close the connection before you close Maple, by executing the following command.
ServerStopServerport=2000, numnodes= 4
The following is a more detailed example of how you can use the Grid Computing Toolbox to create and perform parallel applications on a network of computers.
Consider a fractal, specifically a Julia set, that you want to create and display in Maple. For any more than a few iterations, this can take a long time on a single computer. But you can divide the construction between an arbitrary sized network of computers by using the Grid Computing Toolbox.
First define a Julia set as a procedure, which will determine the color of the plot at point a,b. A Julia set is formally defined as
where c is a constant.
JuliaSet ≔ proca, b global c1,c2; local z1,z2,z1s,z2s,m; z1,z2 ≔ a,b: z1s ≔ z1^2: z2s ≔ z2^2; for m from 1 to 30 while z1s + z2s < 4 do z1,z2 ≔ z1s − z2s+c1, 2*z1*z2+c2 : z1s ≔ z1^2: z2s ≔ z2^2; end do; m; end proc:
Here it is assumed that for m over 30, the sequence z converges. Increasing this number will make the computation more accurate, but take much more time. Define the constant c=c1+I⋅c2 and an appropriate view and grid size for this fractal. If c is changed, then v and gridsize may also need to be changed for the fractal to display properly.
v ≔ −1.7..1.6, −1..1:
gridsize ≔ 250, 250:
To display the fractal as a plot, use the Julia Set as the color. The procedure plotsegment displays the fractal, and is called by the nodes of the grid separately for each section of the plot.
plotsegment ≔ subsjs=evalJuliaSet, procviewgrid plot3d0,viewgrid1, viewgrid2, orientation=−90,0, grid=viewgrid3,style=patchnogrid, scaling=constrained,color=js: end proc:
Define the procedure to be run by the Launch command, which includes a procedure for splitting up the computation.
code≔proc local msg,split; split ≔ procview, gridsize, n local i,gs,splitview,viewi,viewn;global vlength, vs; vs≔opview11: vlength≔absopview12 − opview11/n: gs≔floorgridsize1/n: splitview≔vs..vs+vlength, view2, gs,gridsize2: vs≔vs+vlength: for i from 2 to n do if i=n then viewn≔vs..opview12: splitview ≔splitview,viewn,view2,gridsize1−n−1⋅gs,gridsize2: else viewi≔vs..vs+vlength: vs≔vs+vlength: splitview≔splitview,viewi, view2,gs,gridsize2: end if: end do: splitview; end proc: msg≔Grid:-Mapplotsegment, splitv,gridsize,N: msg;end proc:
Restart the Grid with your computer as the server, as in the above example. Configure the server for your network to run this example over a Grid.
Now you are ready to perform the computation and display the results. Ensure that you pass all assigned variables to the Launch command, or they will not be available on the other nodes of the grid.
The printer is specified as printf, but could be any method of output, including writing to a text area component or a text file. The procedure provides a mechanism for you to stop the computation at any time, on all nodes. In this example, it is always false, so the computation cannot be stopped.
picture ≔ Launchcode, numnodes=N, imports=plotsegment, v, gridsize,JuliaSet,c1,c2,N:
With the basic tools shown here, you are now ready to use the Grid Computing Toolbox to solve many large mathematical problems. See the Maple help system for more information about the commands used in this guide, or more examples illustrating how the Grid Computing Toolbox can help you.
Download Help Document