public void Connect <S, T>(Dataflow.StageOutput <S, T> stream, Dataflow.StageInput <S, T> recvPort, Action <S[], int[], int> key, Channel.Flags flags) where T : Time <T> { stream.ForStage.Targets.Add(new Dataflow.Edge <S, T>(stream, recvPort, key, flags)); }
public ChatEvent(EventIds eventId, Channel.Flags flags, Int32 ping, string username, string text) { Initialize(eventId, (UInt32)flags, ping, username, text); }
public PostOfficeChannel(StageOutput <S, T> sendBundle, StageInput <S, T> recvBundle, Func <S, int> routingHashcodeFunction, NetworkChannel networkChannel, int channelId, Channel.Flags flags) { this.sendBundle = sendBundle; this.recvBundle = recvBundle; this.postboxes = new Dictionary <int, Postbox <S, T> >(); this.mailboxes = new Mailbox <S, T> [recvBundle.ForStage.Placement.Count]; this.channelID = channelId; var computation = sendBundle.ForStage.InternalComputation; foreach (VertexLocation loc in recvBundle.ForStage.Placement) { if (loc.ProcessId == computation.Controller.Configuration.ProcessID) { var postOffice = this.recvBundle.GetPin(loc.VertexId).Vertex.Scheduler.State(computation).PostOffice; LocalMailbox <S, T> localMailbox; var progressBuffer = new Runtime.Progress.ProgressUpdateBuffer <T>(this.ChannelId, this.recvBundle.GetPin(loc.VertexId).Vertex.Scheduler.State(computation).Producer); if ((flags & Channel.Flags.SpillOnRecv) == Channel.Flags.SpillOnRecv) { //localMailbox = new SpillingLocalMailbox<S, T>(postOffice, this.recvBundle.GetPin(loc.VertexId), channelID, loc.VertexId, progressBuffer); throw new Exception("SpillingLocalMailbox not currently supported"); } else { localMailbox = new LegacyLocalMailbox <S, T>(postOffice, this.recvBundle.GetPin(loc.VertexId), channelID, loc.VertexId, progressBuffer); } this.mailboxes[loc.VertexId] = localMailbox; postOffice.RegisterMailbox(localMailbox); if (networkChannel != null) { networkChannel.RegisterMailbox(localMailbox); } } else { this.mailboxes[loc.VertexId] = new RemoteMailbox <S, T>(this.channelID, loc.ProcessId, loc.VertexId, sendBundle.ForStage.InternalComputation); } } foreach (VertexLocation loc in sendBundle.ForStage.Placement) { if (loc.ProcessId == sendBundle.ForStage.InternalComputation.Controller.Configuration.ProcessID) { var progressBuffer = new Runtime.Progress.ProgressUpdateBuffer <T>(this.ChannelId, this.sendBundle.GetFiber(loc.VertexId).Vertex.Scheduler.State(computation).Producer); this.postboxes[loc.VertexId] = new Postbox <S, T>(this.channelID, this.sendBundle.GetFiber(loc.VertexId), this.recvBundle, this.mailboxes, routingHashcodeFunction, networkChannel, progressBuffer); } } }
public PostOfficeChannel(StageOutput <S, T> sendBundle, StageInput <S, T> recvBundle, Action <S[], int[], int> routingHashcodeFunction, NetworkChannel networkChannel, int channelId, Channel.Flags flags) { if ((flags & Channel.Flags.SpillOnRecv) == Channel.Flags.SpillOnRecv) { throw new Exception("SpillingLocalMailbox not currently supported"); } this.sendBundle = sendBundle; this.recvBundle = recvBundle; this.channelID = channelId; var computation = sendBundle.ForStage.InternalComputation; // populate mailboxes; [proxy] destinations for sent messages. this.mailboxes = new Mailbox <S, T> [recvBundle.ForStage.Placement.Count]; foreach (VertexLocation loc in recvBundle.ForStage.Placement) { if (loc.ProcessId == computation.Controller.Configuration.ProcessID) { var postOffice = this.recvBundle.GetPin(loc.VertexId).Vertex.Scheduler.State(computation).PostOffice; var progressBuffer = new Runtime.Progress.ProgressUpdateBuffer <T>(this.ChannelId, this.recvBundle.GetPin(loc.VertexId).Vertex.Scheduler.State(computation).Producer); LocalMailbox <S, T> localMailbox = new LocalMailbox <S, T>(postOffice, this.recvBundle.GetPin(loc.VertexId), channelID, loc.VertexId, progressBuffer); this.mailboxes[loc.VertexId] = localMailbox; postOffice.RegisterMailbox(localMailbox); if (networkChannel != null) { networkChannel.RegisterMailbox(localMailbox); } } else { this.mailboxes[loc.VertexId] = new RemoteMailbox <S, T>(this.channelID, loc.ProcessId, loc.VertexId, sendBundle.ForStage.InternalComputation); } } // populate postboxes; collection points for each local worker. this.postboxes = new Dictionary <int, Postbox <S, T> >(); foreach (VertexLocation location in sendBundle.ForStage.Placement) { if (location.ProcessId == sendBundle.ForStage.InternalComputation.Controller.Configuration.ProcessID) { var progressBuffer = new Runtime.Progress.ProgressUpdateBuffer <T>(this.ChannelId, this.sendBundle.GetFiber(location.VertexId).Vertex.Scheduler.State(computation).Producer); // determine type of postbox to use. if (routingHashcodeFunction == null) { this.postboxes[location.VertexId] = new NoHashCodePostbox <S, T>(this.channelID, this.sendBundle.GetFiber(location.VertexId), this.recvBundle, this.mailboxes, networkChannel, progressBuffer); } else { this.postboxes[location.VertexId] = new BufferingPostbox <S, T>(this.channelID, this.sendBundle.GetFiber(location.VertexId), this.recvBundle, this.mailboxes, routingHashcodeFunction, networkChannel, progressBuffer); } } } }