Muskel overview
 
 
Javadoc
Follow this index.html to access the muskel javadoc (version May06)
 
Sample muskel program
In a muskel program programmers can express the program to compute in parallel using the Compute class. Compute class only requires the presence of a method Object Compute(Object) whose purpose is to provide the function compute by user code.
Sequential code may be wrapped subclassing Compute. Parallel code can be built arbitrary nesting Pipeline and Farm classes .Pipeline models a binary pipeline, with generic Compute (i.e. sequential code wrapped, Pipeline or Farm) stages. Farm models task farm (master-worker) computations with a generic Compute worker.
Provided F and G are two classess subclassing Compute with sequential Object Compute(Object) methods, the following is a legal parallel muskel program representation:
Compute worker = new F();
Compute stage1 = new Farm(worker);
Compute stage2 = new G();
Compute main = new Pipeline(stage1,stage2);
In order to run such code, a manager must be defined, that will take care of the execution of the whole program. Also, an input stream and output stream must be given, that is a place where input tasks are get and a place where output results are stored. Input stream can be provided subclassing the InputManger class, providing a boolean hasNext() and an Object next() methods. Output streams can be processed subclassing the OutputManager class, requiring the implementation of a method void deliver(Object) that will be invoked to process each result.
To declare a manager, simply use the constructor requiring three arguments: the program to be computed (a Compute object), the object providing the input stream (an InputManager object) and the object processing the output stream (an OutputManager object):
Manager manager = new Manager(main, myInputStream, myOutputStream);
The manager must be told the parallelism degree you want in the execution of your parallel program. This can be done providing the manager with a performance contract under the form of a ParDegree Objects, as follows (nw being the requested parallelism degree):
managet.setContract(new ParDegree(nw));
The evaluation of the program is to be asked with a call to the Manager void compute(void) method:
manager.compute();
This call terminates when all the input tasks presented by the InputManager have been processed, in parallel and each result computed has been delivered to the OutputManager.
 
How to run a muskel program
Suppose to have the code outlined above (the complete source can be retrieved here). In order to run the program you must have, on the local network, or anyway on the nodes reached by multicast messages from your machine, a set of muskel.RemoteInterpreter running. muskel.RemoteInterpreter is an instance of the macro data flow distributed interpreter used by muskel to run user code.
At the moment no facilities are provided to run remote interpreters on the remote nodes. Simple ssh based scripts can be used to the purpose. A Java muskel launcher is going to be fine tuned and will be available soon.
Let suppose you have run N copies of the muskel.RemoteIntepreter on your network and let suppose the requested parallelism degree is nw<N. You simply compile the main file and run it as any other Java program. All the management of the remote nodes is performed automatically by the muskel support. The video on the home page shows the program running while two remote interpreters are active with the debug writes turned on.