es.udc.gii.common.eaf.algorithm.parallel.topology
Class Topology

java.lang.Object
  extended by es.udc.gii.common.eaf.algorithm.parallel.topology.Topology
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
EvaluationTopology, MigrationTopology, MSTopology

public abstract class Topology
extends java.lang.Object
implements Configurable

This class encapsulates the topology of the processing nodes in a parallel environment and is responsible for the "low-level" communication between the nodes. It represents an interconnection pattern between nodes.

Each process has an integer associated with it, beeing that number the rank of this process within the topology.

A topology makes it easy to communicate with other nodes by giving methods to send and receive data.

Before using a topology the method initialize() should be called. This method might perform communications with the other processes within the parallel environment depending on the parameters of the topology and will configure the topology by itself. If the user doesn't call this method, a call to any method who uses the state of the class will call it.

Note: 'nodes' and 'processes' are used as synonyms. Note for implementors: Subclasses must populate the protected atributes.

Author:
Rafael Tedin Alvarez

Field Summary
protected  mpi.Intracomm communicator
          For this implementation MPI is used.
private  boolean initialized
           
private  int races
          The number of races in the parallel environment.
protected  int[] receivers
          The ranks of the processes who receive from the process of this object.
protected  int[] senders
          The ranks of the processes who send to the process of this object.
protected  int topologyRank
          The rank of this process within this topology.
 
Constructor Summary
Topology()
          Creates a new instance of Topology.
Topology(int races)
          Creates a new instance of Topology.
 
Method Summary
 void configure(org.apache.commons.configuration.Configuration conf)
          Configures the topology.
protected abstract  void doConfigure()
          A subclass might need additional configuration.
protected abstract  void doConfigure(org.apache.commons.configuration.Configuration conf)
          A subclass might need additional configuration.
protected abstract  void doInitialize()
          A subclass might need additional initialization.
 mpi.Intracomm getCommunicator()
           
 int getRaces()
           
 int[] getReceivers()
           
 int[] getSenders()
           
 int getSize()
           
 int getTopologyRank()
           
 void initialize()
          Initializes this topology.
 boolean isConnected()
          Returns true if the process is connected to this topology and can hence make use of it.
 boolean isInitialized()
          Returns true if this topology is initialized and can hence be used.
protected  void setInitialized(boolean initialized)
           
 void setRaces(int races)
           
 void synchronize()
          Synchronizes all processes within this topology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

races

private int races
The number of races in the parallel environment.


communicator

protected mpi.Intracomm communicator
For this implementation MPI is used. A communicator is used for each topology separately so that messages between to nodes which are in different topologies don't interfere with each other.


topologyRank

protected int topologyRank
The rank of this process within this topology.


receivers

protected int[] receivers
The ranks of the processes who receive from the process of this object.


senders

protected int[] senders
The ranks of the processes who send to the process of this object.


initialized

private boolean initialized
Constructor Detail

Topology

public Topology()
Creates a new instance of Topology.


Topology

public Topology(int races)
Creates a new instance of Topology.

Method Detail

isConnected

public boolean isConnected()
Returns true if the process is connected to this topology and can hence make use of it. Returns false otherwise.


isInitialized

public boolean isInitialized()
Returns true if this topology is initialized and can hence be used. Returns false otherwise.


setInitialized

protected void setInitialized(boolean initialized)

doInitialize

protected abstract void doInitialize()
A subclass might need additional initialization.


initialize

public void initialize()
Initializes this topology.


synchronize

public void synchronize()
Synchronizes all processes within this topology. All the processes within the topology have to call this method in order to work.


doConfigure

protected abstract void doConfigure()
A subclass might need additional configuration.


doConfigure

protected abstract void doConfigure(org.apache.commons.configuration.Configuration conf)
A subclass might need additional configuration.


configure

public void configure(org.apache.commons.configuration.Configuration conf)
Configures the topology.

Specified by:
configure in interface Configurable

getCommunicator

public mpi.Intracomm getCommunicator()

getTopologyRank

public int getTopologyRank()

getRaces

public int getRaces()

getSize

public int getSize()

setRaces

public void setRaces(int races)

getReceivers

public int[] getReceivers()

getSenders

public int[] getSenders()