|
Maple is the only technical computing system that allows
you to take advantage of multithreading in your own programs. The Maple
programming language offers direct access to launching and controlling
threads. In addition, Maple also offers a task-based programming model
that simplifies thread management. Writing parallel algorithms using the
Task Programming Model reduces and removes many of the difficulties
associated with standard threaded programming.
Thread performance has been significantly enhanced in
Maple 15, and a number of important additions to the task-based API
allow you to write parallel programs more effectively and to take
advantage of all cores on your machine. These additions will simply your
code for a number of common situations.
The new Threads[Sleep] function allows you to pause a thread for a fixed duration. For example:
 
The Threads[Task][Start] function has been enhanced to accepts as arguments a specification of child tasks, similar to Threads[Task][Continue].
This argument sequence creates a continuation task and child tasks,
then waits for the continuation task to return. This syntax can be used
to replace cases where the root task is simply a call to Continue.
Here is an example of using this new functionality to compute a convex hull. Given X, a set of points in 2-D, the convex hull is the minimum set of points that define a polygon containing all the points of X.
If you imagine the points as pegs on a board, you can find the convex
hull by surrounding the pegs by a loop of string and then tightening the
string until there is no more slack.
By adding parallelism, which was relatively simple to do,
to the standard quick hull algorithm for computing convex hulls, you can
see substantial speedups:
You can find the complete code for running this example here

|