Commit f3ec13cb authored by uahhx's avatar uahhx

sync

TODO: buffer behaviour check.
found leak and fixed it. weird how that wasn't leaky as fuck
parent 784ceacd
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
......@@ -45,6 +45,7 @@ public class FunnelNet {
public HashSet<DataPacket> droppedPackets = new HashSet<DataPacket>();
public HashSet<DataPacket> rejectedPackets = new HashSet<DataPacket>();
public HashSet<DataPacket> successfulPackets = new HashSet<DataPacket>();
public int successfulPacketCounter = 0;
public static int packetCounter = 0;
......@@ -131,7 +132,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);///(numSlaves));
// SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, 1f);
SlaveNode curNewNode = new SlaveNode(layerNumber, curNode.getNodeNumber()*numNewNodes+j, this, 1f/(numSlaves));
curNewNode.setSuperNeighbor(curNode);
curNewNode.setSubNeighbors(new Node[0]);
newSlaveNodes[j] = curNewNode;
......
......@@ -192,9 +192,9 @@ public abstract class Node {
selectedMessage = message;
subFrontRow[i] = null; //just to make sure.
}
curSubBuf.add(subIncoming[i]); //if a packet got rejected, the limit reached check in the following if statement is not necessary. but also, this always needs to be added if it wasn't null or nulled!
//add unnulled (aka unsent) incoming to buffer, update buffer limit state if necessary
if (selectedMessage == null) {
curSubBuf.add(subIncoming[i]);
if (curSubBuf.limitReached() == subSendEnableM[i]) { //if the limit is reached and the sub is currently allowed to send (or vice versa), send control packet
subSendEnableM[i] = !curSubBuf.limitReached();
selectedMessage = new DataPacket(-1, parentNet.packetLatency, parentNet.getCycleCounter(), DataPacket.messageType.STOPSTART); //send StartStop K-Flagged segment.
......
......@@ -58,7 +58,8 @@ public class SlaveNode extends Node {
if (superIncoming.getMState() == DataPacket.messageState.REJECTED)
parentNet.rejectedPackets.add(superIncoming);
else if (superIncoming.getMState() == DataPacket.messageState.PROCESSED) {
parentNet.successfulPackets.add(superIncoming);
//parentNet.successfulPackets.add(superIncoming); //todo: readd. this takes up a lot of ram tho
parentNet.successfulPacketCounter++;
if (age < parentNet.minRT)
parentNet.minRT = age;
if (age > parentNet.maxRT)
......
package FunnelNetSim;
import FunnelNetSim.Nodes.MasterNode;
import FunnelNetSim.Nodes.Node;
import FunnelNetSim.Nodes.SlaveNode;
import FunnelNetSim.Strategies.GlobalTimeStamp;
import FunnelNetSim.Strategies.GlobalTimeStampPlus;
import FunnelNetSim.Strategies.RoundRobin;
import FunnelNetSim.Strategies.GlobalTimeStampLARRR;
import FunnelNetSim.Strategies.GlobalTimeStampRR;
import FunnelNetSim.Visualizers.PseudoGraphics;
import java.util.HashMap;
......@@ -81,13 +80,15 @@ public class SimHost {
}
private static void test2() {
FunnelNet net = new FunnelNet(new GlobalTimeStamp(), 27*3*3*3, 3, 0);
// FunnelNet net = new FunnelNet(new GlobalTimeStamp(), 65, 2, 0);
// FunnelNet net = new FunnelNet(new GlobalTimeStampRR(), 27*3*3*3, 3, 0);
// FunnelNet net = new FunnelNet(new RoundRobin(), 27*3*3*3, 3, 0);
FunnelNet net = new FunnelNet(new GlobalTimeStampLARRR(), 27*3*3*3, 3, 0);
int prevUnbuf = 0;
for (int i = 0; i < 5000000; i++) {
for (int i = 0; i < 1000000; i++) {
int cycleNo = net.tickNet();
if (cycleNo % 1000 == 0) {
System.out.println(cycleNo +": Average RT: " + net.cumulativeRT / (float) net.successfulPackets.size() + ", # LivePackets: " + net.livePackets.size());
System.out.println(cycleNo +": Average RT: " + net.cumulativeRT / (float)net.successfulPacketCounter + ", # LivePackets: " + net.livePackets.size());
}
HashSet<DataPacket> packetCopy = (HashSet<DataPacket>)net.livePackets.clone();
packetCopy.removeAll(net.bufferedContents());
......@@ -98,12 +99,12 @@ public class SimHost {
}
}
System.out.println("no of live packets: " + net.livePackets.size());
System.out.println("no of successful packets: " + net.successfulPackets.size());
System.out.println("no of successful packets: " + net.successfulPacketCounter);
System.out.println("no of rejected packets: " + net.rejectedPackets.size());
System.out.println("no of dropped packets: " + net.droppedPackets.size());
System.out.println("Min RT: " + net.minRT);
System.out.println("Max RT: " + net.maxRT);
System.out.println("Average RT: " + net.cumulativeRT/(float)net.successfulPackets.size());
System.out.println("Average RT: " + net.cumulativeRT/(float)net.successfulPacketCounter);
System.out.println("Number of OOOEx: " + net.master.noOOOEx);
System.out.println("Number of Master Idle Ticks: " + net.master.idleTicks);
......
......@@ -6,27 +6,18 @@ public class GlobalTimeStamp extends Strategy {
@Override
public int selectForwardingSub(DataPacket[] frontRow) {
boolean visited = false;
boolean rejected = false;
int oldest = -1;
int oldestStamp = Integer.MAX_VALUE;
for (int i = 0; i < frontRow.length; i++) {
DataPacket curPacket = frontRow[i];
if (curPacket != null) {
visited = true;
rejected |= shouldReject(curPacket);
if (curPacket != null && !shouldReject(curPacket)) {
if (curPacket.getTimeStamp() < oldestStamp) {
oldest = i;
oldestStamp = curPacket.getTimeStamp();
}
if (curPacket != null && !shouldReject(curPacket)) {
if (curPacket.getTimeStamp() < oldestStamp) {
oldest = i;
oldestStamp = curPacket.getTimeStamp();
}
}
//return i;
}
if (visited && oldest <= -1) //TODO: removeme
System.out.println("NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO " + (rejected ? " it's okay" : " IT'S NOT OKAY"));
return oldest;
}
......
package FunnelNetSim.Strategies;
import FunnelNetSim.DataPacket;
import FunnelNetSim.FunnelNet;
public class GlobalTimeStampLARRR extends Strategy {
int curRRPointer = 0;
@Override
public int selectForwardingSub(DataPacket[] frontRow) {
int oldest = -1;
int oldestStamp = Integer.MAX_VALUE;
for (int i = 0; i < frontRow.length; i++) {
int pointer = (i + curRRPointer) % frontRow.length;
DataPacket curPacket = frontRow[pointer];
if (curPacket != null && !shouldReject(curPacket)) {
if (curPacket.getTimeStamp() < oldestStamp) {
oldest = pointer;
oldestStamp = curPacket.getTimeStamp();
}
}
//return i;
}
curRRPointer = (oldest + 1) % frontRow.length;
return oldest;
}
@Override
protected boolean shouldReject(DataPacket packet) {
//TODO: implement a predictive rejection (reject if it can't make the trip, based on optimal layer latency
FunnelNet net = parentNode.parentNet;
int age = net.getCycleCounter() - packet.getTimeStamp();
int bestCaseUpward = parentNode.getLayerNumber();
int worstCaseDownward = ((net.getNumLayers()-1)*2); //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;
}
return false;
}
@Override
public Strategy makeNew() {
return new GlobalTimeStampLARRR();
}
}
......@@ -2,7 +2,7 @@ package FunnelNetSim.Strategies;
import FunnelNetSim.DataPacket;
public class GlobalTimeStampPlus extends Strategy {
public class GlobalTimeStampRR extends Strategy {
int curRRPointer = 0;
......@@ -38,6 +38,6 @@ public class GlobalTimeStampPlus extends Strategy {
@Override
public Strategy makeNew() {
return new GlobalTimeStampPlus();
return new GlobalTimeStampRR();
}
}
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