private void initialSend(SSSPCell rootCell) { //Console.WriteLine(value); addCount(); double v = 1 / rootCell.outNeighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.outNeighbors); for (int i = 0; i < Global.SlaveCount; i++) { RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID, v, sorter.GetCellRecipientList(i)); Global.CloudStorage.RankUpdatingToSlave(i, msg); } }
private void propagate(SSSPCell cell, bool isActive) { //clear for (int i = 0; i < cell.inNeighborsReceivedStatus.Count; i++) { cell.inNeighborsReceivedStatus[i] = false; } //cell.receivedNeighborCount = 0; //send-out double v = cell.sum / cell.outNeighbors.Count; MessageSorter sorter = new MessageSorter(cell.outNeighbors); for (int i = 0; i < Global.SlaveCount; i++) { //Console.WriteLine(sorter.GetCellRecipientList(i).Count); RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(cell.CellID, isActive, v, sorter.GetCellRecipientList(i)); Global.CloudStorage.RankUpdatingToSlave(i, msg); } }
public override void StartBFSHandler(StartBFSMessageReader request) { if (Global.CloudStorage.IsLocalCell(request.root)) { using (var rootCell = Global.LocalStorage.UseBFSCell(request.root)) { rootCell.level = 0; rootCell.parent = request.root; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.ServerCount; i++) { BFSUpdateMessageWriter msg = new BFSUpdateMessageWriter(rootCell.CellId, 0, sorter.GetCellRecipientList(i)); Global.CloudStorage.BFSUpdateToBFSServer(i, msg); } } } }
public override void BFSUpdateHandler(BFSUpdateMessageReader request) { request.recipients.ForEach((cellId) => { using (var cell = Global.LocalStorage.UseBFSCell(cellId)) { if (cell.level > request.level + 1) { cell.level = request.level + 1; cell.parent = request.senderId; List <long> aliveNeighbors = new List <long>(); for (int i = 0; i < cell.neighbors.Count; i++) { if (Global.CloudStorage.Contains(cell.neighbors[i])) { aliveNeighbors.Add(cell.neighbors[i]); } } //MessageSorter sorter = new MessageSorter(cell.neighbors); MessageSorter sorter = new MessageSorter(aliveNeighbors); for (int i = 0; i < Global.ServerCount; i++) { BFSUpdateMessageWriter msg = new BFSUpdateMessageWriter(cell.CellId, cell.level, sorter.GetCellRecipientList(i)); Global.CloudStorage.BFSUpdateToBFSServer(i, msg); } } } }); }
private void performAction(long cellId) { using (var rootCell = Global.LocalStorage.UseSSSPCell(cellId)) { //Console.WriteLine("PerformAction: " + cellId); //update rankValue && storedRankValue //rootCell.rankValue = rootCell.storedRankValue - rootCell.oldStoredRankValue; //rootCell.oldStoredRankValue = rootCell.storedRankValue; //long rankValueP = (rootCell.rankValue - rootCell.oldRankValue) / rootCell.neighbors.Count; double rankValueP = (rootCell.storedRankValue - rootCell.rankValue) / rootCell.neighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.SlaveCount; i++) { //Console.WriteLine(3); RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID.Value, rankValueP, sorter.GetCellRecipientList(i)); //Console.WriteLine(4); Global.CloudStorage.RankUpdatingToSlave(i, msg); //Console.WriteLine(5); } //update //Console.WriteLine(6); //rootCell.oldRankValue = rootCell.rankValue; rootCell.rankValue = rootCell.storedRankValue; } }
private void performActionOne(long cellId) { using (var rootCell = Global.LocalStorage.UseSSSPCell(cellId)) { double rankValueP = rootCell.rankValue / rootCell.neighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.SlaveCount; i++) { //Console.WriteLine(3); RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID.Value, rankValueP, sorter.GetCellRecipientList(i)); //Console.WriteLine(4); Global.CloudStorage.RankUpdatingToSlave(i, msg); //Console.WriteLine(5); } //update //Console.WriteLine(6); //rootCell.oldRankValue = rootCell.rankValue; } }
private void send(SSSPCell rootCell) { //Console.WriteLine(value); addCount(); double v = rootCell.sum / rootCell.outNeighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.outNeighbors); for (int i = 0; i < Global.SlaveCount; i++) { RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID, v, sorter.GetCellRecipientList(i)); Global.CloudStorage.RankUpdatingToSlave(i, msg); } }
private void step_one(long node_count) { for (int k = 0; k < node_count; k++) { if (Global.CloudStorage.Contains(k) && Global.CloudStorage.IsLocalCell(k)) { using (var rootCell = Global.LocalStorage.UseSSSPCell(k)) { if (rootCell.neighbors.Count == 0) continue; double rankValueP = rootCell.rankValue / rootCell.neighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.SlaveCount; i++) { DistanceUpdatingMessageWriter msg = new DistanceUpdatingMessageWriter(rootCell.CellID.Value, rankValueP, sorter.GetCellRecipientList(i)); Global.CloudStorage.DistanceUpdatingToSlave(i, msg); } } } } }
public override void StartSSSPHandler(StartSSSPMessageReader request) { if (Global.CloudStorage.IsLocalCell(request.root)) { using (var rootCell = Global.LocalStorage.UseSSSPCell(request.root)) { rootCell.distance = 0; rootCell.parent = -1; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.ServerCount; i++) { DistanceUpdatingMessageWriter msg = new DistanceUpdatingMessageWriter(rootCell.CellID.Value, 0, sorter.GetCellRecipientList(i)); Global.CloudStorage.DistanceUpdatingToSSSPServer(i, msg); } } } }
public override void DistanceUpdatingHandler(DistanceUpdatingMessageReader request) { List <DistanceUpdatingMessage> DistanceUpdatingMessageList = new List <DistanceUpdatingMessage>(); request.recipients.ForEach((cellId) => { using (var cell = Global.LocalStorage.UseSSSPCell(cellId)) { if (cell.distance > request.distance + 1) { cell.distance = request.distance + 1; cell.parent = request.senderId; Console.Write(cell.distance + " "); MessageSorter sorter = new MessageSorter(cell.neighbors); for (int i = 0; i < Global.ServerCount; i++) { DistanceUpdatingMessageWriter msg = new DistanceUpdatingMessageWriter(cell.CellID.Value, cell.distance, sorter.GetCellRecipientList(i)); Global.CloudStorage.DistanceUpdatingToSSSPServer(i, msg); } } } }); }
private void step_one(long node_count) { for (int k = 0; k < node_count; k++) { if (Global.CloudStorage.Contains(k) && Global.CloudStorage.IsLocalCell(k)) { using (var rootCell = Global.LocalStorage.UseSSSPCell(k)) { if (rootCell.neighbors.Count == 0) { continue; } double rankValueP = rootCell.rankValue / rootCell.neighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.neighbors); for (int i = 0; i < Global.SlaveCount; i++) { DistanceUpdatingMessageWriter msg = new DistanceUpdatingMessageWriter(rootCell.CellID.Value, rankValueP, sorter.GetCellRecipientList(i)); Global.CloudStorage.DistanceUpdatingToSlave(i, msg); } } } } }
private void send(long fromCellId, double value) { //Console.WriteLine(value); addCount(); double v = 0; using (var rootCell = Global.LocalStorage.UseSSSPCell(fromCellId)) { try { v = value / rootCell.outNeighbors.Count; MessageSorter sorter = new MessageSorter(rootCell.outNeighbors); for (int i = 0; i < Global.SlaveCount; i++) { RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID.Value, v, sorter.GetCellRecipientList(i)); Global.CloudStorage.RankUpdatingToSlave(i, msg); } } catch (Exception e) { //Console.Error.WriteLine(e); Console.WriteLine(fromCellId); } } }
private void initialPropagate(SSSPCell cell, bool isActive) { //clear for (int i = 0; i < cell.inNeighborsReceivedStatus.Count; i++) { cell.inNeighborsReceivedStatus[i] = false; } //cell.receivedNeighborCount = 0; //send-out double v = 1.0 / cell.outNeighbors.Count; MessageSorter sorter = new MessageSorter(cell.outNeighbors); for (int i = 0; i < Global.SlaveCount; i++) { //Console.WriteLine(sorter.GetCellRecipientList(i).Count); RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(cell.CellID, isActive, v, sorter.GetCellRecipientList(i)); Global.CloudStorage.RankUpdatingToSlave(i, msg); } }
private void performAction(long cellId) { //Console.WriteLine(0); using (var rootCell = Global.LocalStorage.UseSSSPCell(cellId)) { //activated cell should satisfy storedRankValue > rankValue rootCell.rankValue = rootCell.storedRankValue; /* if (rootCell.status == false) return; if (rootCell.neighbors.Count == 0) { rootCell.status = false; return; } */ //Console.WriteLine(1); //compute current rankValueP long rankValueP = rootCell.rankValue / rootCell.neighbors.Count; //if (rootCell.oldRankValueP < rankValueP) //{ //send the rank difference MessageSorter sorter = new MessageSorter(rootCell.neighbors); //Console.WriteLine(2); for (int i = 0; i < Global.SlaveCount; i++) { //Console.WriteLine(3); RankUpdatingMessageWriter msg = new RankUpdatingMessageWriter(rootCell.CellID.Value, rankValueP - rootCell.oldRankValueP, sorter.GetCellRecipientList(i)); //Console.WriteLine(4); Global.CloudStorage.RankUpdatingToSlave(i, msg); //Console.WriteLine(5); } //update //Console.WriteLine(6); rootCell.oldRankValueP = rankValueP; //} } }