The canonical example detailed in this manual.
The task algorithm for this example returns :ping-ok if presented with
a :ping argument, or otherwise :ping-not-ok. The
interesting aspect of this example is the use of the general
target number API for the in memory tasks. Billions of tasks can
be run through this application, but only a small number are kept in
memory at any give time to prevent memory exhaustion.
This example implements the Monte Carlo algorithm to compute pi. Each
task runs N trials and returns N and the number of trials in the
circle. The master keeps a running sum of the total trials and
the total number of trials in the circle. At the end of the maximum
number of iterations, the approximation algorithm is performed with
the computed ratio and the approximation to pi is produced. You may
specify ---max-trial-sets integer to the master process
to state the total number of trial sets that must be performed. The
number of trials performed by each trial-set is non-configurable.
This example shows that task algorithms can be quite versatile. Here the
horder task algorithm compiles a function presented to it as an argument
and applies it to the data also presented to it returning the result
of the application. The master algorithm creates a unique function for each task
and associates it with the data for that task. All results are printed
out when gotten back from the slaves. While this example shows the
fundamental sketch of producing higher order task algorithms, more work would
be needed to handle signaled errors or other problems that could show
up in the task algorithm.
This example shows how to define task algorithms that use the optional and
available lambda list keywords. The returned result from each task
shows the values of the parameters passed to the task algorithm.