es.udc.gii.common.eaf.algorithm.parallel.topology.migration
Class GridMigrationTopology

java.lang.Object
  extended by es.udc.gii.common.eaf.algorithm.parallel.topology.Topology
      extended by es.udc.gii.common.eaf.algorithm.parallel.topology.migration.MigrationTopology
          extended by es.udc.gii.common.eaf.algorithm.parallel.topology.migration.GridMigrationTopology
All Implemented Interfaces:
Configurable

public class GridMigrationTopology
extends MigrationTopology

A grid migration topology is a migration topology where the nodes are arranged in a (perhaps multidimensional) grid.

Each dimension of the grid might be periodic, i.e. the first element of the dimension is connected to the last. Thus this topology can be used to construct a ring, which is a periodic one-dimensional grid, a torus, hypercubes, etc.

Configuration example:

 <Topology>
     <Class>...topology.GridMigrationTopology</Class>
     <Races>18</Races>
     <Dimension count="3" periodic="true"/>
     <Dimension count="2" periodic="false"/>
     <Dimension count="3"/>
 </Topology>
 

This example configures a GridMigrationTopology with 3 dimensions. Dimension 1 has 3 nodes and is periodic, dimension has 2 nodes and is not periodic and dimension 3 has 3 nodes and is not periodic. There are hence 3 x 2 x 3 = 18 nodes needed.

Since:
1.0
Author:
Grupo Integrado de IngenierĂ­a (www.gii.udc.es)

Field Summary
private  boolean[] dimIsPeriodic
           
private  int[] nodesPerDimension
           
 
Fields inherited from class es.udc.gii.common.eaf.algorithm.parallel.topology.Topology
communicator, receivers, senders, topologyRank
 
Constructor Summary
GridMigrationTopology()
          Creates a new instance of GridMigrationTopology.
GridMigrationTopology(int races, int[] nodesPerDimension, boolean[] dimIsPeriodic)
          Creates a new instance of GridMigrationTopology.
 
Method Summary
protected  void doConfigure()
          A subclass might need additional configuration.
protected  void doConfigure(org.apache.commons.configuration.Configuration conf)
          A subclass might need additional configuration.
protected  void doInitialize()
          A subclass might need additional initialization.
 boolean[] getDimIsPeriodic()
           
 int[] getNodesPerDimension()
           
private  int neededNodes()
          Calculates how many nodes (races) are needed for the current configuration.
 void setDimIsPeriodic(boolean[] dimIsPeriodic)
          Sets if a dimension of the grid is periodic (i.e. the last node an the first are connected) for each dimension.
 void setNodesPerDimension(int[] nodesPerDimension)
          Sets how many nodes will each dimension have.
 
Methods inherited from class es.udc.gii.common.eaf.algorithm.parallel.topology.migration.MigrationTopology
doReceive, doSend, finish, receive, send
 
Methods inherited from class es.udc.gii.common.eaf.algorithm.parallel.topology.Topology
configure, getCommunicator, getRaces, getReceivers, getSenders, getSize, getTopologyRank, initialize, isConnected, isInitialized, setInitialized, setRaces, synchronize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodesPerDimension

private int[] nodesPerDimension

dimIsPeriodic

private boolean[] dimIsPeriodic
Constructor Detail

GridMigrationTopology

public GridMigrationTopology()
Creates a new instance of GridMigrationTopology.


GridMigrationTopology

public GridMigrationTopology(int races,
                             int[] nodesPerDimension,
                             boolean[] dimIsPeriodic)
Creates a new instance of GridMigrationTopology. For an explanation of nodesPerDimension and dimIsPeriodic see setNodesPerDimension(int[]) and setDimIsPeriodic(boolean[]).

Method Detail

neededNodes

private int neededNodes()
Calculates how many nodes (races) are needed for the current configuration.


doInitialize

protected void doInitialize()
Description copied from class: Topology
A subclass might need additional initialization.

Specified by:
doInitialize in class Topology

doConfigure

protected void doConfigure()
Description copied from class: Topology
A subclass might need additional configuration.

Specified by:
doConfigure in class Topology

doConfigure

protected void doConfigure(org.apache.commons.configuration.Configuration conf)
Description copied from class: Topology
A subclass might need additional configuration.

Specified by:
doConfigure in class Topology

getNodesPerDimension

public int[] getNodesPerDimension()

setNodesPerDimension

public void setNodesPerDimension(int[] nodesPerDimension)
Sets how many nodes will each dimension have. The number of dimensions is thus the length of the array nodesPerDimension.

This parameter should be set before the method Topology.initialize() is called. After Topology#initialize is called, setting the nodes per dimension will have no effect.


getDimIsPeriodic

public boolean[] getDimIsPeriodic()

setDimIsPeriodic

public void setDimIsPeriodic(boolean[] dimIsPeriodic)
Sets if a dimension of the grid is periodic (i.e. the last node an the first are connected) for each dimension. Thus the length of dimIsPeriodic must be equal to the number of dimensions of the grid.

This parameter should be set before the method Topology.initialize() is called. After Topology#initialize is called, setting this parameter will have no effect.