appl.parallel.spmd
Class AbstractSPMDTask

java.lang.Object
  extended by appl.parallel.spmd.AbstractSPMDTask
All Implemented Interfaces:
SPMDTask, Serializable
Direct Known Subclasses:
AverageNeighborhoodTestTask, AverageNeighborhoodTestTask_MultiGrid, AVNTask, AVNTunedTask, ClueTask, ClueTaskTuned

public abstract class AbstractSPMDTask
extends Object
implements SPMDTask

This class may be used as the superclass to all SPMDTasks which should be executed on servers using the SPMD-paradigm. Subclasses should override the init() and the run(Object...) method, but never the initialize() method.

The Task provides access to the SPMDClientInterface and the AdvancedSPMDClientInterface.

Notice that the init() method is called exactly one time before execution for every instance (in multithreading there are multiple parallel instances of the same task, running on different parts of the resource).

Author:
Dominik Appl
See Also:
Serialized Form

Field Summary
protected  AdvancedSPMDServerInterface serverController
           
 
Constructor Summary
AbstractSPMDTask()
           
 
Method Summary
 AdvancedSPMDServerInterface getAdvancedSPMDServerController()
          Gives access the AdvancedSPMDServerInterface for advanced parallel programming, including performance optimizations like preloading.
 SPMDServerInterface getSPMDServerController()
          Gives access the SPMDServerInterface for parallel programming.
 void incomingUpdate(WritableGrid outgoingGrid, Rectangle location)
          Currently not used.
abstract  void init()
          Use this method to implement if you want t
 void initialize()
          Initializes the task.
 boolean isInitialized()
           
 void outgoingUpdate(WritableGrid incomingGrid, Rectangle location)
          Currently not used.
abstract  Object run(Object... parameters)
          Starts the task with the given parameters.
 void setSPMDServerController(AdvancedSPMDServerInterface controller)
          Associates the given SPMDController with the task.
 boolean supportsMultiThreading()
          returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverController

protected transient AdvancedSPMDServerInterface serverController
Constructor Detail

AbstractSPMDTask

public AbstractSPMDTask()
Method Detail

incomingUpdate

public void incomingUpdate(WritableGrid outgoingGrid,
                           Rectangle location)
Description copied from interface: SPMDTask
Currently not used. May be used later when introducing write access on neighborhood regions.

Specified by:
incomingUpdate in interface SPMDTask

outgoingUpdate

public void outgoingUpdate(WritableGrid incomingGrid,
                           Rectangle location)
Description copied from interface: SPMDTask
Currently not used. May be used later when introducing write access on neighborhood regions.

Specified by:
outgoingUpdate in interface SPMDTask

run

public abstract Object run(Object... parameters)
Description copied from interface: SPMDTask
Starts the task with the given parameters. Overwrite this method to implement the task.

Specified by:
run in interface SPMDTask
Returns:
the result of the task computation (if any)

getSPMDServerController

public SPMDServerInterface getSPMDServerController()
Description copied from interface: SPMDTask
Gives access the SPMDServerInterface for parallel programming.

Specified by:
getSPMDServerController in interface SPMDTask
Returns:
the interface

getAdvancedSPMDServerController

public AdvancedSPMDServerInterface getAdvancedSPMDServerController()
Description copied from interface: SPMDTask
Gives access the AdvancedSPMDServerInterface for advanced parallel programming, including performance optimizations like preloading.

Specified by:
getAdvancedSPMDServerController in interface SPMDTask
Returns:
the interface

setSPMDServerController

public void setSPMDServerController(AdvancedSPMDServerInterface controller)
Description copied from interface: SPMDTask
Associates the given SPMDController with the task. Will be called e.g. by the XuluServer.

Specified by:
setSPMDServerController in interface SPMDTask

init

public abstract void init()
Use this method to implement if you want t


initialize

public final void initialize()
Description copied from interface: SPMDTask
Initializes the task. Initializing is only done once!

Specified by:
initialize in interface SPMDTask

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface SPMDTask
Returns:
whether the task is initialized or SPMDTask.initialize() must be called

supportsMultiThreading

public boolean supportsMultiThreading()
returns false. Override this method to enable multithreading

Specified by:
supportsMultiThreading in interface SPMDTask
Returns:
whether multithreading can be used by this task
See Also:
SPMDTask.supportsMultiThreading()