Commit fa973dc4 authored by MalkContent's avatar MalkContent

sync

parent 8c215c66
......@@ -14,7 +14,7 @@ public class FunnelNet {
public final int packetLatency = 56; //in ns
public final int realTimeConstraint = 10000; //RTC in ns
public final int nodeClock = 125; //node Clockspeed in MHz
public static final int nodeClock = 125; //node Clockspeed in MHz
public final int packetCycleLatency = (int)Math.ceil((packetLatency*nodeClock)/1000f); //rounded up because packets won't arrive until a full cycle is complete
public final int rtcCycles = (realTimeConstraint*nodeClock)/1000; //rounded down because it has to arrive before the point-value deadline
......@@ -22,8 +22,8 @@ public class FunnelNet {
//public static final int dataWidth = 64/8; //dataWidth in number of segments per transmission. this should be a round number even if it wasn't forced by type.
private final int minBufferSize = packetCycleLatency *3 + 1; //todo: check that it's not actually "packetLatency*2 + 1" edit: yea, this should be packetlatency*2. not even certain it needs +1
public static final int bufferSize = 22; //max # of packets per buffer
private final int minBufferSize = packetCycleLatency *2 + 1; //todo: check that it's not actually "packetLatency*2 + 1" edit: yea, this should be packetlatency*2. not even certain it needs +1
public final int bufferSize = minBufferSize*2; //max # of packets per buffer
//public static final int bufferSize = 4 + minBufferSize; //max # of packets per buffer
//public static final int bufferSize = 2*minBufferSize; //max # of packets per buffer
......@@ -38,6 +38,10 @@ public class FunnelNet {
public int maxRT = 0;
public long cumulativeRT = 0;
public int minRejectRT = Integer.MAX_VALUE;
public int maxRejectRT = 0;
public long cumulativeRejectRT = 0;
public MasterNode master = null;
public HashSet<NetNode> netNodes = new HashSet<NetNode>();
public HashSet<SlaveNode> slavesNodes = new HashSet<SlaveNode>();
......@@ -52,22 +56,31 @@ public class FunnelNet {
public static int packetCounter = 0;
private float slaveFireChance = 0;
private boolean slaveWaitForAnswer = true;
public FunnelNet(Strategy strategy, int numSlaves, int numDownConnections, int minNetLayers) {
initFunnelNet(strategy, numSlaves, numDownConnections, minNetLayers);
initFunnelNet(strategy, numSlaves, numDownConnections, minNetLayers, 1f/numSlaves, false);
}
public FunnelNet(Strategy strategy, int numSlaves, int numDownConnections, int minNetLayers, float slaveFireChance, boolean slaveWaitForAnswer) {
initFunnelNet(strategy, numSlaves, numDownConnections, minNetLayers, slaveFireChance, slaveWaitForAnswer);
}
public FunnelNet(Strategy strategy) { //for now no numUpConnections
initFunnelNet(strategy, 1, 1, 0);
initFunnelNet(strategy, 1, 1, 0, 1, true);
}
private void initFunnelNet(Strategy strategy, int numSlaves, int numDownConnections, int minNetLayers) {
private void initFunnelNet(Strategy strategy, int numSlaves, int numDownConnections, int minNetLayers, float slaveFireChance, boolean slaveWaitForAnswer) {
this.strategy = strategy;
this.numSlaves = numSlaves;
this.numDownConnections = numDownConnections;
this.minNetLayers = minNetLayers;
this.slaveFireChance = slaveFireChance;
this.slaveWaitForAnswer = slaveWaitForAnswer;
createNet();
System.out.println("Number of Layers: " + numLayers);
System.out.println("Number of Slaves: " + numSlaves);
// System.out.println("Number of Layers: " + numLayers);
// System.out.println("Number of Slaves: " + numSlaves);
}
private void createNet() {
......@@ -135,8 +148,8 @@ public class FunnelNet {
//for (int i = 0; i < newSlaveNodes.length - homogeneousReduction - (inhomogeneousReduction > 0 ? 1 : 0); i++) {
SlaveNode[] newSlaveNodes = new SlaveNode[numNewNodes - homogeneousReduction - (inhomogeneousReduction > 0 ? 1 : 0)];
for (int j = 0; j < newSlaveNodes.length; j++) {
// SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, 1f);
SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, 1f/(numSlaves));
SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, slaveFireChance, slaveWaitForAnswer);
// SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, 1f/(numSlaves));
curNewNode.setSuperNeighbor(curNode);
curNewNode.setSubNeighbors(new Node[0]);
newSlaveNodes[j] = curNewNode;
......
......@@ -62,9 +62,9 @@ public abstract class Node {
this.subIncomingLines = new ArrayList<LinkedList<DataPacket>>(subNeighbors.length);
this.superBuffers = new ArrayList<SlinkyBuffer>(subNeighbors.length);
for (int i = 0; i < subNeighbors.length; i++) {
subBuffers.add(new SlinkyBuffer(parentNet.packetCycleLatency, FunnelNet.bufferSize));
subBuffers.add(new SlinkyBuffer(parentNet.packetCycleLatency, parentNet.bufferSize));
subIncomingLines.add(new LinkedList<DataPacket>());
superBuffers.add(new SlinkyBuffer(parentNet.packetCycleLatency, FunnelNet.bufferSize*2));
superBuffers.add(new SlinkyBuffer(parentNet.packetCycleLatency, parentNet.bufferSize*2));
subSendEnableM[i] = true; //initially all slaves are able to send
}
......
......@@ -23,7 +23,7 @@ public class SlaveNode extends Node {
initSlaveNode(fireChance, waitForAnswer, deadTime, resendOnReject);
}
public SlaveNode(int layerNumber, int nodeNumber, FunnelNet parentNet, float fireChance) {
public SlaveNode(int layerNumber, int nodeNumber, FunnelNet parentNet, float fireChance, boolean waitForAnswer) {
super(layerNumber, nodeNumber, parentNet);
initSlaveNode(fireChance, waitForAnswer, deadTime, resendOnReject);
}
......@@ -55,8 +55,14 @@ public class SlaveNode extends Node {
System.out.println("--------- Message no. " + superIncoming.getPacketID() + " from " + superIncoming.getOrigin() +
" returned to " + getNodeNumber() + " after " + (age) + " cycles");
parentNet.livePackets.remove(superIncoming);
if (superIncoming.getMState() == DataPacket.messageState.REJECTED)
if (superIncoming.getMState() == DataPacket.messageState.REJECTED) {
parentNet.rejectedPackets.add(superIncoming);
if (age < parentNet.minRejectRT)
parentNet.minRejectRT = age;
if (age > parentNet.maxRejectRT)
parentNet.maxRejectRT = age;
parentNet.cumulativeRejectRT += age;
}
else if (superIncoming.getMState() == DataPacket.messageState.PROCESSED) {
//parentNet.successfulPackets.add(superIncoming); //todo: readd. this takes up a lot of ram tho
parentNet.successfulPacketCounter++;
......
......@@ -31,7 +31,7 @@ public class SlinkyBuffer {
//warning remove me:
if (SimHost.verbose(2)) {
if (buffer.size() == FunnelNet.bufferSize)
if (buffer.size() == maxSize)
System.out.println("Warning - buffer full : " + this.toString());
else if (buffer.size() > maxSize) {
System.out.println("This should not be happening, buffer got overfilled by: " + (buffer.size() - maxSize) + " : " + this.toString());
......
This diff is collapsed.
......@@ -46,7 +46,7 @@ public class GlobalTimeStampLARRR extends Strategy {
FunnelNet net = parentNode.parentNet;
int age = net.getCycleCounter() - packet.getTimeStamp();
int bestCaseUpward = parentNode.getLayerNumber();
int worstCaseDownward = ((net.getNumLayers()-1)*(2+FunnelNet.bufferSize)); //todo: make sure that this actually is the worst case;
int worstCaseDownward = ((net.getNumLayers()-1)*(2+net.bufferSize)); //todo: make sure that this actually is the worst case;
if (age + bestCaseUpward + worstCaseDownward > parentNode.parentNet.rtcCycles) {
packet.setMState(dropPackets ? DataPacket.messageState.DROP : DataPacket.messageState.REJECTED);
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment