muskel
Class Manager

java.lang.Object
  extended by muskel.Manager

public class Manager
extends java.lang.Object

takes care of a program execution request, with contract (#PEs). A manager object should be instantiated to run muskel programs. The manager is to be given the program, the input and output stream and a performance contract. The manager can be asked to "compute" the program by invoking the homonimous method.


Field Summary
static boolean debug
           
 
Constructor Summary
Manager()
          this constructs the manager without giving all the parameters.
Manager(Compute ppgm, InputManager iism, OutputManager oosm)
          This constructs the manager.
 
Method Summary
 void compute()
          the method starts the parallel computation of the program stored in the manager.
 CodeStorage getCodeStorage()
          this method returns a pointer to the CodeStorage.
 MdfGraph newGraph(Compute pgm)
          gives the programmer the ability to retrieve the compiler graph of a skeleton program.
This can be used to merge with ad hoc data flow graphs, provided by the user, that express parallelism exploitation patterns not provided within the native skeletons.
 void setContract(Contract c)
          the method is used to set up the performance contract with the manager.
 void setInputManager(InputManager im)
          accessor method to set the input manager
 void setOutputManager(OutputManager om)
          accessor method to set the output manager
 void setProgram(Compute pgm)
          accessor method to set program
 int storeOpCode(Compute opc)
          sets a new Compute code in the CodeStorage, returning the index in the CodeStorage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values
Constructor Detail

Manager

public Manager(Compute ppgm,
               InputManager iism,
               OutputManager oosm)
This constructs the manager.

Parameters:
ppgm - the program to be computed. It must implement the Compute interface
iism - the input manager, a class implementing the InputManager Interface that requires the methods boolean hasNext() (telling whether or not the input stream has further items) and an Object next() method that returns the next item of the input stream
oosm - the output manager. Its void deliver(Object res) method is called each time a new result is available

Manager

public Manager()
this constructs the manager without giving all the parameters. It is used when user defined MDF graphs are supplied in the program via the ParCompute class. Later on the missing parameters are set up with the proper accessor methods.

Method Detail

setProgram

public void setProgram(Compute pgm)
accessor method to set program

Parameters:
pgm - the program to be computed by the manager

setInputManager

public void setInputManager(InputManager im)
accessor method to set the input manager

Parameters:
im - the input manager

setOutputManager

public void setOutputManager(OutputManager om)
accessor method to set the output manager

Parameters:
om - the output manager

setContract

public void setContract(Contract c)
the method is used to set up the performance contract with the manager. The user asks a given parallelism degree by stating it in the contract. AT the moment, the request is satisfied all or nothing. IF less than the requested number of remote intepreters are found, then the manager blocks on the compute method.

Parameters:
c - the performance contract to be satisfied by the manager

getCodeStorage

public CodeStorage getCodeStorage()
this method returns a pointer to the CodeStorage. It is used to implement user defined macro data flow instructions. User defined Compute code is used as the MDFi opcode. The Compute code has to be stored into the CodeStorage, in such a way it can be retrieved (with an integer pointer) when the MDFi has to be executed.

Parameters:
-
Returns:
the current CodeStorage pointer

storeOpCode

public int storeOpCode(Compute opc)
sets a new Compute code in the CodeStorage, returning the index in the CodeStorage

Parameters:
the - Compute program to be stored in the CodeStorage
Returns:
the index in the CodeStorage

newGraph

public MdfGraph newGraph(Compute pgm)
gives the programmer the ability to retrieve the compiler graph of a skeleton program.
This can be used to merge with ad hoc data flow graphs, provided by the user, that express parallelism exploitation patterns not provided within the native skeletons.

Parameters:
pgm -
Returns:

compute

public void compute()
the method starts the parallel computation of the program stored in the manager. A number of remote processing elements is recruited, according to the performance constract passed to the manager then an according number of control threads are started. Eventually, they cooperate to compute the program on the distributed network of MDF interpreters