Mercurial > hg > Members > tatsuki > Alice
changeset 36:0b25b48116b6
DistributedFish share width each other (not work)
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2012 18:40:02 +0900 |
parents | ac3b48c5f4da |
children | ebd44d3e8578 |
files | scripts/topology/test.dot src/alice/test/topology/fish/AsignStartX.java src/alice/test/topology/fish/CheckMyName.java src/alice/test/topology/fish/GetStartX.java src/alice/test/topology/fish/PeekStartX.java src/alice/test/topology/fish/Routing.java src/alice/test/topology/fish/SendWidth.java src/alice/test/topology/fish/StartStartX.java src/alice/test/topology/fish/WidthReceiver.java src/alice/topology/node/ConfigurationFinish.java |
diffstat | 10 files changed, 163 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/topology/test.dot Fri Jan 20 04:00:12 2012 +0900 +++ b/scripts/topology/test.dot Fri Jan 20 18:40:02 2012 +0900 @@ -1,8 +1,40 @@ -digraph ring { - node0 -> node1 [label="right"] - node1 -> node0 [label="left"] - node1 -> node2 [label="right"] - node2 -> node1 [label="left"] - node2 -> node0 [label="right"] - node0 -> node2 [label="left"] -} \ No newline at end of file +digraph test { + node0 -> node1 [label="child0"] + node0 -> node2 [label="child1"] + node0 -> node3 [label="child2"] + node1 -> node0 [label="parent"] + node1 -> node4 [label="child0"] + node1 -> node5 [label="child1"] + node1 -> node6 [label="child2"] + node2 -> node0 [label="parent"] + node2 -> cli7 [label="child0"] + node2 -> cli8 [label="child1"] + node2 -> cli9 [label="child2"] + node3 -> node0 [label="parent"] + node3 -> cli10 [label="child0"] + node3 -> cli11 [label="child1"] + node3 -> cli12 [label="child2"] + node4 -> node1 [label="parent"] + node4 -> cli13 [label="child0"] + node4 -> cli14 [label="child1"] + node4 -> cli15 [label="child2"] + node5 -> node1 [label="parent"] + node5 -> cli16 [label="child0"] + node5 -> cli17 [label="child1"] + node5 -> cli18 [label="child2"] + node6 -> node1 [label="parent"] + node6 -> cli19 [label="child0"] + cli7 -> node2 [label="parent"] + cli8 -> node2 [label="parent"] + cli9 -> node2 [label="parent"] + cli10 -> node3 [label="parent"] + cli11 -> node3 [label="parent"] + cli12 -> node3 [label="parent"] + cli13 -> node4 [label="parent"] + cli14 -> node4 [label="parent"] + cli15 -> node4 [label="parent"] + cli16 -> node5 [label="parent"] + cli17 -> node5 [label="parent"] + cli18 -> node5 [label="parent"] + cli19 -> node6 [label="parent"] +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/fish/AsignStartX.java Fri Jan 20 18:40:02 2012 +0900 @@ -0,0 +1,40 @@ +package alice.test.topology.fish; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class AsignStartX extends CodeSegment { + + public Receiver routing = ids.create(CommandType.PEEK); + public int startX; + public int index; + + public AsignStartX(int startX, int index) { + this.startX = startX; + this.index = index; + } + + @Override + public void run() { + System.out.println("AsignStartX: " + startX); + + RoutingTable routing = this.routing.asClass(RoutingTable.class); + int x = startX; + System.out.println("RoutingTable: " + this.routing.val); + if (this.index + 1 > this.routing.index) { + AsignStartX cs = new AsignStartX(startX, index); + cs.routing.setKey("local", "routing", this.routing.index); + return; + } + for (Routing r : routing.table) { + System.out.println(r.name); + ods.update(r.name, "startX", x); + System.out.println("Assign: " + r.name + ".startX = " + x); + x += r.width; + } + PeekStartX cs = new PeekStartX(this.routing.index); + cs.startX.setKey("local", "startX", this.index); + } + +}
--- a/src/alice/test/topology/fish/CheckMyName.java Fri Jan 20 04:00:12 2012 +0900 +++ b/src/alice/test/topology/fish/CheckMyName.java Fri Jan 20 18:40:02 2012 +0900 @@ -22,19 +22,28 @@ int num = new Integer(matcher.group(2)); if (type.equals("cli")) { - System.out.println("I am client"); + System.out.println("********************I am cli" + num); ods.update("local", "width", 400); + + GetStartX cs = new GetStartX(); + cs.startX.setKey("local", "startX"); + } else if (type.equals("node")) { + System.out.println("********************I am node" + num); WidthReceiver cs = new WidthReceiver(); cs.widths.setKey("local", "widths"); cs.routing.setKey("local", "routing"); + PeekStartX cs2 = new PeekStartX(0); + cs2.startX.setKey("local", "startX"); + ods.put("local", "routing", new RoutingTable()); - if (num == 0) { // First node check - System.out.println("I am node0"); + if (num == 0) { // First node ("node0") check + StartStartX cs3 = new StartStartX(); + cs3.width.setKey("local", "width"); + //ods.update("local", "startX", 0); return; } - System.out.println("I am node"); } SendWidth cs = new SendWidth();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/fish/GetStartX.java Fri Jan 20 18:40:02 2012 +0900 @@ -0,0 +1,21 @@ +package alice.test.topology.fish; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class GetStartX extends CodeSegment { + + public Receiver startX = ids.create(CommandType.PEEK); + + @Override + public void run() { + int startX = this.startX.asInteger(); + + System.out.println("GetStartX: " + startX); + + GetStartX cs = new GetStartX(); + cs.startX.setKey("local", "startX", this.startX.index); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/fish/PeekStartX.java Fri Jan 20 18:40:02 2012 +0900 @@ -0,0 +1,23 @@ +package alice.test.topology.fish; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class PeekStartX extends CodeSegment { + + public Receiver startX = ids.create(CommandType.PEEK); + public int index; + + public PeekStartX(int index) { + this.index = index; + } + + @Override + public void run() { + int startX = this.startX.asInteger(); + AsignStartX cs = new AsignStartX(startX, this.startX.index); + cs.routing.setKey("local", "routing", this.startX.index); + } + +}
--- a/src/alice/test/topology/fish/Routing.java Fri Jan 20 04:00:12 2012 +0900 +++ b/src/alice/test/topology/fish/Routing.java Fri Jan 20 18:40:02 2012 +0900 @@ -19,7 +19,6 @@ public Routing(String name, int width) { this.name = name; this.width = width; - System.out.println(name); Pattern pattern = Pattern.compile("^child([0-9]+)$"); Matcher matcher = pattern.matcher(name); matcher.find();
--- a/src/alice/test/topology/fish/SendWidth.java Fri Jan 20 04:00:12 2012 +0900 +++ b/src/alice/test/topology/fish/SendWidth.java Fri Jan 20 18:40:02 2012 +0900 @@ -13,6 +13,8 @@ int width = this.width.asInteger(); ods.put("parent", "widths", width); + System.out.println("send widths: " + width); + SendWidth cs = new SendWidth(); cs.width.setKey("local", "width", this.width.index); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/fish/StartStartX.java Fri Jan 20 18:40:02 2012 +0900 @@ -0,0 +1,18 @@ +package alice.test.topology.fish; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class StartStartX extends CodeSegment { + + public Receiver width = ids.create(CommandType.PEEK); + + @Override + public void run() { + ods.update("local", "startX", 0); + StartStartX cs = new StartStartX(); + cs.width.setKey("local", "width", this.width.index); + } + +}
--- a/src/alice/test/topology/fish/WidthReceiver.java Fri Jan 20 04:00:12 2012 +0900 +++ b/src/alice/test/topology/fish/WidthReceiver.java Fri Jan 20 18:40:02 2012 +0900 @@ -10,7 +10,7 @@ public class WidthReceiver extends CodeSegment { public Receiver widths = ids.create(CommandType.TAKE); - public Receiver routing = ids.create(CommandType.PEEK); + public Receiver routing = ids.create(CommandType.PEEK); @Override public void run() { @@ -39,15 +39,17 @@ routing.sumWidth += width; } - System.out.println(routing.sumWidth); + System.out.println("SUM WIDTH: " + routing.sumWidth); + + System.out.println("NODE NUM: " + routing.table.size()); ods.update("local", "width", routing.sumWidth); ods.update("local", "routing", routing); WidthReceiver cs = new WidthReceiver(); cs.widths.setKey("local", "widths", this.widths.index); - cs.routing.setKey("local", "routing", this.routing.index); - + cs.routing.setKey("local", "routing"); + //cs.routing.setKey("local", "routing", this.routing.index); } }
--- a/src/alice/topology/node/ConfigurationFinish.java Fri Jan 20 04:00:12 2012 +0900 +++ b/src/alice/topology/node/ConfigurationFinish.java Fri Jan 20 18:40:02 2012 +0900 @@ -21,8 +21,6 @@ if (reverseCount.val.equals(configNodeNum.val)) { ods.put("manager", "done", ValueFactory.createNilValue()); - System.out.println("Configuration finished"); - Start cs = new Start(clazz); cs.done.setKey("manager", "start");