Class Network
java.lang.Object
Network
public class Network
- extends java.lang.Object
Network is the object through which all the nodes (Resource blocks) and all
the communication switches are connected to perform the desired goal into one
unit. According to the input parameters the network is built up. Different
types of network topologies can be created but for simulation at a time only
one type of network is instantiated. Mesh, Torus, Butterfly Fat Tree and
Extended Butterfly Fat Tree, Octal are among the different types of network.
N.B. Extended Butterfly Fat Tree (an extension of the Butterfly Fat Tree) and
Octal (an extension of the Octagon topology) are two architectures originally
proposed by the researchers in Dept. of CSE, BUET)
- Version:
- 1.0
Field Summary |
private java.util.Vector |
nodeList
A vector type variable holding the reference of all the resource nodes of
the network. |
private java.util.Vector |
switchList
A vector type variable holding the reference of all the communication
switches of the network. |
Constructor Summary |
Network(int networkType)
Constructor of the Network. |
Method Summary |
void |
createExFatTreeNetwork()
Instantiates all the nodes and Extended Butterfly Fat Tree switches of
the extended fat tree network as well as assigns which node will be
connected with which extended fat tree switch. |
void |
createFatTreeNetwork()
Instantiates all the nodes and Butterfly Fat Tree switches of the fat
tree network as well as assigns which node will be connected with which
fat tree switch. |
void |
createMeshNetwork()
Instantiates all the nodes and mesh switches of the mesh network as well
as assigns which node will be connected with which mesh switch. |
void |
createOctalNetwork()
Instantiates all the nodes and mesh switches of the Octal network as well
as assigns which node will be connected with which Octal switch. |
private int |
getStartOfLevel(int level)
Invoked by Network.setAdjacentFatSwitch() and
Network.setAdjacentExFatSwitch() to find out the first parent switch
exists in the upper level by using current switch’s level and index in
level values. |
void |
moveNodeTrafficFromInputBufferToNodeMsgCenter(int nCycle)
This method is used to transfer the incoming flits at the input buffer of
resource node to the message center of that node. |
void |
moveNodeTrafficFromNodeToSwitch(int nCycle)
This method is used to transfer the outgoing flits at the output buffer
of resource node to the input buffer of the parent switch of that node. |
void |
moveSwitchTrafficFromInputBufferToOutputBuffer(int nCycle)
This method is used to transfer the incoming flits at the input buffer of
the switch to output buffer of that switch depending on the switching
info vector. |
void |
moveSwitchTrafficFromOutputBufferToInputBufferOfNodeSwitch(int nCycle)
This method is used to transfer the outgoing flits at the output buffer
of the switch to input buffer of the adjacent switches and/or resource
nodes. |
private void |
setAdjacentExFatSwitch()
Completes the creation of extended butterfly fat tree network by setting
the adjacency relationship between the switches of consecutive different
levels and switches of current level. |
private void |
setAdjacentFatSwitch()
This method completes the creation of butterfly fat tree network by
setting the adjacency relationship between the switches of consecutive
different levels. |
private void |
setAdjacentMeshSwitch()
Completes the creation of mesh network by setting the adjacency
relationship between the switches of consecutive different rows and
columns. |
private void |
setAdjacentOctalSwitch()
Completes the creation of octal network by setting the adjacency
relationship between the switches of the same unit and the switches of
other units.The units are added in the network in row major order i.e. |
private void |
setAdjacentTorusSwitch()
This method completes the creation of torus network by setting the
adjacency relationship between the switches of consecutive different
levels. |
void |
setInitalEvents()
This method is called by the controller of the simulator to set initial
events required for starting the simulator. |
void |
updateAfterCycleStatus(int curCycle)
The method performs its duty by calling nodes’
updateStatusAfterCycle(nCycle) and switches'
updateStatusAfterCycle(nCycle) method for every simulation cycle. |
void |
updateSwitchTrafficPathRequest(int nCycle)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
nodeList
private java.util.Vector nodeList
- A vector type variable holding the reference of all the resource nodes of
the network. This list is used for retrieving nodes’ reference to invoke
methods directly from network.
switchList
private java.util.Vector switchList
- A vector type variable holding the reference of all the communication
switches of the network. This list is used for retrieving switches’
reference to invoke methods directly from network.
Network
public Network(int networkType)
- Constructor of the Network. In this version of the simulator, the type of
the networks that have been implemented are Mesh, Torus, Butterfly Fat
Tree, Extended Butterfly Fat Tree, and Octal. The constructor performs in
the following fashion.
- Creates nodeList and switchList vector object.
- Checks the type of the network to build.
- The network of specified type is created along with creation of
adjacency relationship with other switches for all the switches.
- Parameters:
networkType
- An integer which determines which type of network the
constructor will build.- See Also:
IConstants
createMeshNetwork
public void createMeshNetwork()
- Instantiates all the nodes and mesh switches of the mesh network as well
as assigns which node will be connected with which mesh switch. The
method performs in the following manner.
- Determines how many adjacent nodes per switch.
- Determines the number of switches required in the network.
- Calculates required number of mesh rows and columns with a target of
number of rows and columns being equal (if not possible then number of
columns being the higher).
- Calculates the number of bits required to encode row number and
column number of a switch to form the address of a switch.
- Instantiate all the switch by assigning them corresponding address
generated from row and column.
- For every instantiated switch instantiate the required number of
adjacent nodes.
Assumptions:
- This method considers a topology that has either m*n Mesh Switches.
Here n = m or m+1.
- This method also works for the Torus network.
- The Number of IP Nodes and Switches adjusted according to the n * m
switch architecture. Where, n = m or m+1, i.e. the architecture is
adjusted to have a square shape.
- See Also:
MeshSwitch
,
NetworkManager
,
IConstants
setAdjacentMeshSwitch
private void setAdjacentMeshSwitch()
- Completes the creation of mesh network by setting the adjacency
relationship between the switches of consecutive different rows and
columns. The switches are added in the network in row major order i.e.
first the earlier rows are filled. The method works in the following
steps.
- For every switch determine its row and column index.
- Calculates minimum number of switches required in the network to
have an adjacent switch in the bottom direction for this switch.
- Calculates minimum number of switches required in the network to
have an adjacent switch in the right direction for this switch.
- If row index of this switch is greater than zero then this switch
will have adjacent switch in top direction. If it has adjacent switch in
top direction then that is found out (just one row earlier and same
column) and corresponding adjacency field is updated for each switch. And
then input/output link controllers for top direction are added.
- If row index of this switch is less than the maximum number of rows
in the mesh network and the network has sufficient number of switches to
have an adjacent switch in bottom direction then the switch in bottom
direction is found out (just one row below and same column). The
adjacency fields are updated for both these switches along with adding
input/output link controller for bottom direction.
- In the similar way left and right adjacent switches are found out by
using column index value of the switch and corresponding adjacency
information are updates.
- See Also:
MeshSwitch
,
InputLinkController
,
OutputLinkController
,
IConstants
setAdjacentTorusSwitch
private void setAdjacentTorusSwitch()
This method completes the creation of torus network by setting the
adjacency relationship between the switches of consecutive different
levels. The method works in almost the same way as was described for mesh
network except the circular relation.
The switches in the top most and bottom most rows have adjacency relation
in top and bottom directions respectively whereas in mesh network they
had no adjacency relations. And in similar way leftmost and rightmost
columns have adjacency relation in left and right directions respectively
whereas in mesh network they had no adjacency relations.
- See Also:
MeshSwitch
,
InputLinkController
,
OutputLinkController
,
IConstants
createFatTreeNetwork
public void createFatTreeNetwork()
- Instantiates all the nodes and Butterfly Fat Tree switches of the fat
tree network as well as assigns which node will be connected with which
fat tree switch. The method performs in the flowing manner.
- Calculates the number of levels through which the network will be
distributed.
- Calculates the number of bits required to identify each switch and
nodes.
- Calculates number of fat tree switch will exist in level l.
- Instantiates corresponding number of fat tree switches for the level
l.
- If that level is the lowest level of the network of fat tree switch
then instantiate four nodes for every switch of that level.
Assumptions:
- This method also works for the ExtendedButterFly network.
- The Number of IP Nodes and Switches adjusted according to the a
complete fat tree format.
- See Also:
FatTreeSwitch
,
InputLinkController
,
OutputLinkController
,
IConstants
setAdjacentFatSwitch
private void setAdjacentFatSwitch()
- This method completes the creation of butterfly fat tree network by
setting the adjacency relationship between the switches of consecutive
different levels. The method works in the following steps.
- Calculates the number of levels through which the network is
distributed.
- Calculates the number of switches that will exist in top most level
of the network.
- For every switch other than top level switches
- Finds its level value and index value in that level.
- Finds out the first parent switch exists in the upper level by using
current switch’s level and index in level values.
- Updates the parent child relationship between the found out parent
switch and current switch.
- Find out the second parent switch exists in the upper level by using
current switch’s level and index in level values.
- Updates the parent child relationship between the found out parent
switch and current switch.
createOctalNetwork
public void createOctalNetwork()
- Instantiates all the nodes and mesh switches of the Octal network as well
as assigns which node will be connected with which Octal switch. The
switches are added grouped in a unit of 8 switches. These units in the
network are then added in row major order i.e. first the earlier rows are
filled. The method performs in the following manner.
- Determines how many adjacent nodes per switch.
- Determines the number of switches required in the network.
- Determines the number of units required in the network.
- Calculates required number of unit rows and columns with a target of
number of rows and columns being equal (if not possible then number of
columns being the higher).
- Calculates the number of bits required to encode unit row number and
column number of a unit to form the address of a unit.
- Computes the switch address from the unit address to which it
belongs.
- Instantiate all the switch by assigning them the corresponding
address.
- For every instantiated switch instantiate the required number of
adjacent nodes.
- See Also:
OctalSwitch
,
NetworkManager
,
IConstants
setAdjacentOctalSwitch
private void setAdjacentOctalSwitch()
- Completes the creation of octal network by setting the adjacency
relationship between the switches of the same unit and the switches of
other units.The units are added in the network in row major order i.e.
first the earlier rows are filled. The method works in the following
steps.
- For every unit determine its row and column index.
- Each switch in the network can have maximum 4 links with adjacent
switches. 3 of those can used to connect to switches of the same unit
(identified by, OCTAL_SWITCH_MID_1, RIGHT_NODE, LEFT_NODE).
OCTAL_SWITCH_MID_2 is used to connect with a switch in a different unit.
Although the name suggested by LEFT_NODE, RIGHT_NODE implies switches
arranged according to clockwise or anticlockwise orientation, the
relative address of the switchs to whitch the switch in question is
connected by these two links are specified by the
IConstatnts.ADJ_NODE[][]. The relative index of the switch to which this
switch in question is connected via OCTAL_SWITCH_MID_1 is obtained from
(7-this_switch_address_in_the_unit). The switch in adjacent unit to which
the switch in question is connected via OCTAL_SWITCH_MID_2 is also can be
obtained by similar process.
- For those switches, OCTAL_SWITCH_MID_2 is not possible, output link
controller and input link controller are set to NULL.
- See Also:
OctalSwitch
,
InputLinkController
,
OutputLinkController
,
IConstants
createExFatTreeNetwork
public void createExFatTreeNetwork()
- Instantiates all the nodes and Extended Butterfly Fat Tree switches of
the extended fat tree network as well as assigns which node will be
connected with which extended fat tree switch. The method performs in the
flowing manner.
- Calculates the number of levels through which the network will be
distributed.
- Calculates the number of bits required to identify each switch and
nodes.
- Calculates number of fat tree switch will exist in level l.
- Instantiates corresponding number of fat tree switches for the level
l.
- If that level is the lowest level of the network of fat tree switch
then instantiate four nodes for every switch of that level.
The approach is similar to that of Fat Tree Network.
Assumptions:
- This method also works for the ExtendedButterFly network.
- The Number of IP Nodes and Switches adjusted according to a complete
fat tree format.
- See Also:
ExFatTreeSwitch
,
InputLinkController
,
OutputLinkController
,
IConstants
setAdjacentExFatSwitch
private void setAdjacentExFatSwitch()
- Completes the creation of extended butterfly fat tree network by setting
the adjacency relationship between the switches of consecutive different
levels and switches of current level. Switches of extended butterfly fat
tree network have relationship among the switches of the same level
depending on specific formula along with the child and parent
relationship between the switches of lower and upper level switches. The
method performs same works as was done for butterfly fat tree network
along with some extra works. Those are described below.
- Like butterfly fat tree finds out two parent of a switch and update
the child parent relation among those.
- Calculates the left sibling index and right sibling index among the
block in which the switches form local connections.
- Updates the left and right sibling relationship among those
switches.
getStartOfLevel
private int getStartOfLevel(int level)
- Invoked by Network.setAdjacentFatSwitch() and
Network.setAdjacentExFatSwitch() to find out the first parent switch
exists in the upper level by using current switch’s level and index in
level values.
- Parameters:
level
- Level in the Butterfly Fat Tree, Extended Butterfly Fat Tree
topology
- Returns:
- Index value in the switch list
- See Also:
setAdjacentFatSwitch()
,
setAdjacentExFatSwitch()
setInitalEvents
public void setInitalEvents()
- This method is called by the controller of the simulator to set initial
events required for starting the simulator. The method performs in the
following steps.
- For all resource nodes set next message generation timestamps
- Resets all the switches and switching info vector of the switches.
- Resets the statistical data calculator.
moveNodeTrafficFromNodeToSwitch
public void moveNodeTrafficFromNodeToSwitch(int nCycle)
- This method is used to transfer the outgoing flits at the output buffer
of resource node to the input buffer of the parent switch of that node.
The method performs its duty by calling nodes’ updateOutput(nCycle)
method for every simulation cycle.
- Parameters:
nCycle
- Simulation cycle
updateSwitchTrafficPathRequest
public void updateSwitchTrafficPathRequest(int nCycle)
moveSwitchTrafficFromInputBufferToOutputBuffer
public void moveSwitchTrafficFromInputBufferToOutputBuffer(int nCycle)
- This method is used to transfer the incoming flits at the input buffer of
the switch to output buffer of that switch depending on the switching
info vector. The method performs its duty by calling switches’
moveInputBufferToOutputBuffer(nCycle) method for every simulation cycle.
- Parameters:
nCycle
- Simulation cycle
moveSwitchTrafficFromOutputBufferToInputBufferOfNodeSwitch
public void moveSwitchTrafficFromOutputBufferToInputBufferOfNodeSwitch(int nCycle)
- This method is used to transfer the outgoing flits at the output buffer
of the switch to input buffer of the adjacent switches and/or resource
nodes. The method performs its assigned activities by calling the
switches’ moveSwitchOutputBufferToInputBufferOfNodeSwitch(nCycle) method
for every simulation cycle.
- Parameters:
nCycle
- Simulation cycle
moveNodeTrafficFromInputBufferToNodeMsgCenter
public void moveNodeTrafficFromInputBufferToNodeMsgCenter(int nCycle)
- This method is used to transfer the incoming flits at the input buffer of
resource node to the message center of that node. The method performs its
duty by calling nodes’ forwardFlitToNodeMessageCenter(nCycle) method for
every simulation cycle
- Parameters:
nCycle
- Simulation cycle
updateAfterCycleStatus
public void updateAfterCycleStatus(int curCycle)
- The method performs its duty by calling nodes’
updateStatusAfterCycle(nCycle) and switches'
updateStatusAfterCycle(nCycle) method for every simulation cycle.
- Parameters:
curCycle
- Simulation cycle