We've seen some interesting demonstrations at the TUNA project meetings; here's some information about them for people who're interested in studying or modifying them.
Most of this software was implemented in occam-pi; to compile it, you'll need a recent version of the KRoC compiler compiled with pony support. Binaries are for IA32 PCs running Linux; you'll need the SDL and OpenGL libraries installed. If you have trouble getting the software to work, please ask Adam Sampson ( email@example.com ).
Life (Adam Sampson and Damian Dimmich)
With OpenGL 3D display (./life -f 5 -c -w -x 100 -y 100 -o opengl):
With SDL 2D bitmap display (./life -f 5 -c -w -o sdlraster):
The Life demo implements John Conway's Game of Life cellular automaton, and shows off some notable features of occam-pi:
- very large numbers of lightweight processes (400,000 by default)
- using shared channels for communication
- using barriers (multiway events) for fast synchronisation
- graphical output to SDL using sdlraster
- graphical output to OpenGL using SWIG-generated OpenGL bindings
A full discussion of the strategies used by this and other process-oriented Life implementations can be found in our CPA2005 paper Lazy Cellular Automata with Communicating Processes; there's also the presentation Adam gave at CPA2005.
Invoke the program as ./life --help to see the options available.
CDX (Fred Barnes and Adam Sampson)
cdxmandel with three workers:
The CDX library provides simple visualisation of bitmap graphics generated across a cluster of machines, and a (rather inefficient) network barrier implementation. I wouldn't suggest using CDX for new applications now that pony is stable -- see below.
The demonstration renders the Mandelbrot set, assigning a horizontal stripe to each worker. The output from the workers is coloured according to their number.
To run the demo on a single host with three worker processes, you'll need to run all these processes at the same time (i.e. in different terminal windows):
./netbard 2346 3
three copies of ./cdxmandel
To run across a network, you'll need to edit cdxmandel.occ to set the network hostnames of the cdxview and netbard hosts.
Clotting (Peter Welch)
This shows a couple of different approaches to a process-based model of blood clotting: one based on Steve Schneider's CSP model using multiway events, and one using occam-pi mobile channels.
Various agent-based simulations (Mark D'inverno)
mandelbauer (Mario Schweigler and Adam Sampson)
This is one of the examples for Mario's pony project, a networked-channels framework for occam-pi, included in recent development versions of the KRoC distribution. It renders the Mandelbrot set in a distributed manner using a farming algorithm.
See the mandelbauer presentation from the TUNA meeting in May 2006, which includes process diagrams and benchmark results.
Download source code -- or just look in the pony/examples directory of the KRoC distribution. You'd probably do best to update your KRoC source tree to the latest Subversion version by doing ./build --svn-update; that'll ensure you have the very latest version of the pony code.
To run mandelbauer, using the above binaries, with the master and one worker on the same host:
Start the pony Application Name Server (ANS) in one window: ./ponyanstcpip
Start mandelbauer in master mode in another window: ./mandelbauer -m
Start mandelbauer in slave mode in another window: ./mandelbauer
If you've built it from source, then ponyanstcpip should have been installed into KRoC's bin directory.
To run mandelbauer (and, indeed, pony programs in general) across multiple hosts, you need to make sure that the .pony.tcpip.ans file in the current directory contains a line to set the hostname of the machine running the ANS. For example:
You should then be able to start the master on one host, and slaves on as many others as you like. The -n option can be used to set node names explicitly. (See Mario's thesis for more information.)
By default, mandelbauer will operate in an interactive graphical mode. Hold down the left mouse button to zoom in, or the right mouse button to zoom out; the point under the mouse pointer will stay in the same place, so you can move around while zooming by moving the mouse while holding down a mouse button. You can press the U and D keys on the keyboard to change the iteration limit. If you're more interested in benchmarking than in pretty graphics, invoke mandelbauer with the -b option to put it in benchmark mode, and it won't do the display. There are various other options available; run ./mandelbauer --help to list them.
pony farming examples (Adam Sampson)
Since mandelbauer is rather complex, I've written basic implementations of the two approaches to farming described in the presentation which should be easier to read; these farm out a trivial job (generating lists of numbers) to a set of worker processes in the same ways mandelbauer does.
View the difference between the two programs, which shows the lines that I changed between farming_shared and farming_alting. Note that the code that generates, processes and receives jobs is the same in both (which is how it's possible for the mandelbauer program to use either approach at the cost of a bit more complexity in the framework code).
3D blood clotting (Carl Ritson)
This demonstration makes use of a number of new occam-pi features to simulate and visualise blood clotting in a large vessel, distributing the work across a cluster of machines. For more information, see the 3D Blood Clotting page.