Demonstrations of the Use of the Groovy Parallel Patterns (gpp)
copyright 2015-16 Jon Kerridge Edinburgh Napier University
contact j.kerridge @ napier.ac.uk
The demos package contains a number of different demonstration systems that show different aspects of the use of the Groovy Parallel Patterns Library. The examples cover a wide spectrum of applications scenarios showing the flexibility of the library and its ease of use.
The examples are presented in two different forms. First a version that uses the BuildGPP system to create the required communication infrastructure automatically. Secondly, a version in which the definition includes the required communication and parallel composition defined in-line.
The examples also show how the in-built logging system can be used to evaluate the time different parts of the solution take. Currently the output from the logger is a text file but future work will provide a visualisation of the data.
All the examples demonstrate that a valid network of process will always terminate and that the only programming required is contained in the user supplied data objects.
The version ending '_gpp' does not define the channels nor the channel declarations in the process definitions. The processes have to be defined in the order in which they occur in the dataflow through the application solution. The processes are preceded by the annotation //NETWORK and terminated by //END. The program GPPbuilder can then be used to create the channel definitions, channel declarations and the required parallel constructor required to invoke the process network.
The examples are:
Concordance – creating a concordance for large text files, demonstrating the use of a task parallel architecture containing data parallel components and vice-versa.
Prime and Goldbach – creating a list of prime numbers, up to some limit. It then validates the Goldbach conjecture for those primes. The solution uses a specifically created set of processes to achieve the effect.
Jacobi – undertakes the solution of a set of simultaneous equations using Jacobi’s method. The solution uses a Divide and Conquer architecture. Equations are provided up to a matrix 8192 x 8192.
Mandelbrot – implements a solution to the Mandelbrot set. Two basic solutions are used, one that evaluates each pixel individually and the other evaluates a line at a time. Two versions are then provided, one that does the calculation without a user interface and the other uses a Library provided graphical user interface. The version without interface is then extended to run on a cluster of multi-core workstations, showing a nearly linear speed up with the number of computing nodes in the cluster.
Montecarlo Pi (MCpi) – calculates the value of mathematical-pi using Montecarlo methods. This example demonstrates the use of a Data Parallel Pattern that is contained within the Library. A further version of the solution is provided that terminates when the difference between two iterations of the value are sufficiently small using a dedicated feedback mechanism.
QuickSort – implements Hoare’s QuickSort algorithm for a large data set. The input is distributed over a number of processes that each then undertake a QuickSort on their data. They then output their results in a sorted order to a process that undertakes an N-Way Merge operation.
nbody - implements a solution to the N-body problem using a Matrix based approach that is partitioned over a number of nodes as used in the solution to Jacobi.
solarSystem - implements another solution to the N-body problem, using the same architecture as nbody and Jacobi but using a List of Planet objects, similarly partitioned over a number of nodes.