appl.parallel.spmd
Class SPMDServerController

java.lang.Object
  extended by appl.parallel.spmd.SPMDServerController
All Implemented Interfaces:
SPMDServerInterface
Direct Known Subclasses:
AdvancedSPMDServerController

public class SPMDServerController
extends Object
implements SPMDServerInterface

This class controls all the parallelization action on the server side and is the counterpart to SPMDClientController. It is accessed by the model developer by retrieving the SPMDServerInterface from a SPMDTask.

Author:
Dominik Appl

Field Summary
protected  int mapPosition
          the partition position (used for splitmaps)
 
Constructor Summary
SPMDServerController(PartitionDataManager dataManager, int referenceResouceID)
          Creates a new instance
 
Method Summary
 void destroyMultiPartition(String name, int idx)
          Removes the partition from memory.
 void destroyPartition(String name)
          Removes the partition from memory.
 Object getBaseParameter(String parameterName)
          Returns the base parameter with the specified id.
 Rectangle getGlobalBounds(DataPartition partition)
          Gives back the global bounds, which are the bounds of all partitions over all servers.
 Rectangle getLocalBounds()
          Gives back the area which is available for local access (including Neighborhood)
 Rectangle getLocalBounds(DataPartition partition)
          Gives back the area which is available for local access (including Neighborhood)
 int getLocalCalcMaxX()
          Convenience method.
 int getLocalCalcMaxY()
          Convenience method.
 int getLocalCalcMinX()
          Convenience method.
 int getLocalCalcMinY()
          Convenience method.
 Rectangle getLocalCalculationBounds()
          Gives back the area which is actively used for read/write (in contrast to neighborhood area, which is often accessed will be accessed read only).
 Rectangle getLocalCalculationBounds(DataPartition partition)
          Gives back the area which is actively used for read/write (in contrast to neighborhood area, which is often accessed will be accessed read only).
 MultiDataObject getMultiData(String name)
          Gives back a MultiDataObject.
 DataPartition[] getMultiPartition(String name)
          Gets the array of DataPartitions which were submitted on client side via SPMDClientController.addToMultiDataSplitControl(Object[], String) All resources are retrieved from the data source and given back.
 DataPartition getMultiPartition(String name, int idx)
          Gets a DataPartition which was submitted on client side via SPMDClientController.addToMultiDataSplitControl(Object[], String).
 DataPartition getPartition(String name)
          The whole DataPartition available for this task.
 void setLocalCalculationBounds(Rectangle newBounds)
          This method sets new calculation bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapPosition

protected final int mapPosition
the partition position (used for splitmaps)

Constructor Detail

SPMDServerController

public SPMDServerController(PartitionDataManager dataManager,
                            int referenceResouceID)
Creates a new instance

Parameters:
dataManager - the partition data server responsible for managing the data on the server
referenceResouceID - the id of the reference resource
Method Detail

setLocalCalculationBounds

public void setLocalCalculationBounds(Rectangle newBounds)
This method sets new calculation bounds. This is used to divide the rasters for parallel computation on one machine (using multiple cpu's or cpu cores)

Parameters:
newBounds - the new calculation bounds

getBaseParameter

public Object getBaseParameter(String parameterName)
Description copied from interface: SPMDServerInterface
Returns the base parameter with the specified id.

Specified by:
getBaseParameter in interface SPMDServerInterface
Parameters:
parameterName - the name of the parameter specified on client side
Returns:
the base parameter
See Also:
SPMDClientInterface.addBaseParameter(Object, String)

getLocalCalculationBounds

public Rectangle getLocalCalculationBounds(DataPartition partition)
Description copied from interface: SPMDServerInterface
Gives back the area which is actively used for read/write (in contrast to neighborhood area, which is often accessed will be accessed read only).

Specified by:
getLocalCalculationBounds in interface SPMDServerInterface
Parameters:
partition - a partition for which the the bounds are requested
Returns:
the calculation bounds in local coordinates (local means relative to the upper left corner of all available data)

getLocalBounds

public Rectangle getLocalBounds(DataPartition partition)
Description copied from interface: SPMDServerInterface
Gives back the area which is available for local access (including Neighborhood)

Specified by:
getLocalBounds in interface SPMDServerInterface
Parameters:
partition - a partition for which the the bounds are requested
Returns:
the calculation bounds in local coordinates - the upper left corner of the Rectangle will be (0,0)

getGlobalBounds

public Rectangle getGlobalBounds(DataPartition partition)
Description copied from interface: SPMDServerInterface
Gives back the global bounds, which are the bounds of all partitions over all servers. To be clear: This are the bounds of the unsplitted data!

Specified by:
getGlobalBounds in interface SPMDServerInterface
Parameters:
partition - partition for which the bounds are queried
Returns:
the global bounds

getLocalCalculationBounds

public Rectangle getLocalCalculationBounds()
Description copied from interface: SPMDServerInterface
Gives back the area which is actively used for read/write (in contrast to neighborhood area, which is often accessed will be accessed read only).

Specified by:
getLocalCalculationBounds in interface SPMDServerInterface
Returns:
the calculation bounds in local coordinates (local means relative to the upper left corner of all available data) of the reference resource (which is the first resource added to split-control on client side)
See Also:
SPMDClientController.addToSplitControl(Object, String), SPMDClientController.setReferenceResource(Object)

getLocalBounds

public Rectangle getLocalBounds()
Description copied from interface: SPMDServerInterface
Gives back the area which is available for local access (including Neighborhood)

Specified by:
getLocalBounds in interface SPMDServerInterface
Returns:
the calculation bounds in local coordinates of the reference resource (which is the first resource added to split-control on client side) - the upper left corner of the Rectangle will be (0,0)
See Also:
SPMDClientController.addToSplitControl(Object, String), SPMDClientController.setReferenceResource(Object)

getPartition

public DataPartition getPartition(String name)
Description copied from interface: SPMDServerInterface
The whole DataPartition available for this task. In contrast to SPMDServerInterface.getLocalCalculationBounds() the neighborhood is included!

Specified by:
getPartition in interface SPMDServerInterface
Parameters:
name - the name of the splittable
Returns:
the partition of the resource which is available for local calculation
See Also:
SPMDClientController.addToSplitControl(Object, String)

getMultiPartition

public DataPartition[] getMultiPartition(String name)
Description copied from interface: SPMDServerInterface
Gets the array of DataPartitions which were submitted on client side via SPMDClientController.addToMultiDataSplitControl(Object[], String) All resources are retrieved from the data source and given back. If you only need a specific resource you can use SPMDServerInterface.getMultiPartition(String, int) to avoid loading all data.

Specified by:
getMultiPartition in interface SPMDServerInterface
Parameters:
name - the name of the splittable
Returns:
the partition of the resource which is available for local calculation
See Also:
SPMDClientController.addToMultiDataSplitControl(Object[], String), SPMDServerInterface.getMultiPartition(String, int)

getMultiData

public MultiDataObject getMultiData(String name)
Description copied from interface: SPMDServerInterface
Gives back a MultiDataObject. A MultiDataObject can encapsulate multiple objects and is especially intended for use with GridList and MultiGrid types. See MultiDataObject for more details.

Specified by:
getMultiData in interface SPMDServerInterface
Parameters:
name - the name associated with the object on client side
Returns:
the MDO

getMultiPartition

public DataPartition getMultiPartition(String name,
                                       int idx)
Description copied from interface: SPMDServerInterface
Gets a DataPartition which was submitted on client side via SPMDClientController.addToMultiDataSplitControl(Object[], String). Only the grid with the index is returned. All other partitions are NOT retrieved.

Specified by:
getMultiPartition in interface SPMDServerInterface
Parameters:
name - the name of the splittable
Returns:
the partition of the resource which is available for local calculation
See Also:
SPMDClientController.addToMultiDataSplitControl(Object[], String), SPMDServerInterface.getMultiPartition(String)

getLocalCalcMinX

public int getLocalCalcMinX()
Description copied from interface: SPMDServerInterface
Convenience method. Gets the coordinate out from the Rectangle which the SPMDServerInterface.getLocalCalculationBounds() returns

Specified by:
getLocalCalcMinX in interface SPMDServerInterface
Returns:
the x-coordinate upperleft corner of the calcarea
See Also:
getLocalCalculationBounds(), getLocalCalcMinX(), getLocalCalcMaxX(), getLocalCalcMinY(), getLocalCalcMaxY()

getLocalCalcMinY

public int getLocalCalcMinY()
Description copied from interface: SPMDServerInterface
Convenience method. Gets the coordinate out from the Rectangle which the SPMDServerInterface.getLocalCalculationBounds() returns

Specified by:
getLocalCalcMinY in interface SPMDServerInterface
Returns:
the y-coordinate upper left corner of the calculation area
See Also:
getLocalCalculationBounds(), getLocalCalcMinX(), getLocalCalcMaxX(), getLocalCalcMinY(), getLocalCalcMaxY()

getLocalCalcMaxX

public int getLocalCalcMaxX()
Description copied from interface: SPMDServerInterface
Convenience method. Gets the coordinate out from the Rectangle which the SPMDServerInterface.getLocalCalculationBounds() returns

Specified by:
getLocalCalcMaxX in interface SPMDServerInterface
Returns:
the x-coordinate lower right corner of the calculation area
See Also:
getLocalCalculationBounds(), getLocalCalcMinX(), getLocalCalcMaxX(), getLocalCalcMinY(), getLocalCalcMaxY()

getLocalCalcMaxY

public int getLocalCalcMaxY()
Description copied from interface: SPMDServerInterface
Convenience method. Gets the coordinate out from the Rectangle which the SPMDServerInterface.getLocalCalculationBounds() returns

Specified by:
getLocalCalcMaxY in interface SPMDServerInterface
Returns:
the y-coordinate lower right corner of the calculation area
See Also:
getLocalCalculationBounds(), getLocalCalcMinX(), getLocalCalcMaxX(), getLocalCalcMinY(), getLocalCalcMaxY()

destroyPartition

public void destroyPartition(String name)
Description copied from interface: SPMDServerInterface
Removes the partition from memory. You may want to call System.gc() afterwards

Specified by:
destroyPartition in interface SPMDServerInterface
Parameters:
name - the name of the partition to remove

destroyMultiPartition

public void destroyMultiPartition(String name,
                                  int idx)
Description copied from interface: SPMDServerInterface
Removes the partition from memory. You may want to call System.gc() afterwards

Specified by:
destroyMultiPartition in interface SPMDServerInterface
Parameters:
name - the name of the multidata
idx - the index of the partition to remove