1 / 16

Synchronous Algorithms II

Synchronous Algorithms II. Transient Messages and Distance Between LPs. Outline. Transient Messages Transient Message Problem Flush Barrier Tree Implementation Butterfly Implementation Distance Between Processes Potential Performance Improvement Distance Matrix.

Download Presentation

Synchronous Algorithms II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Synchronous Algorithms II Transient Messages and Distance Between LPs

  2. Outline • Transient Messages • Transient Message Problem • Flush Barrier • Tree Implementation • Butterfly Implementation • Distance Between Processes • Potential Performance Improvement • Distance Matrix

  3. The Transient Message Problem /* synchronous algorithm */ Ni = time of next event in LPi LAi = lookahead of LPi WHILE (unprocessed events remain) receive messages generated in previous iteration LBTS = min (Ni + LAi) process events in with time stamp ≤ LBTS barrier synchronization endDO • A transient message is a message that has been sent, but has not yet been received at its destination • The message could be “in the network” or stored in an operating system buffer (waiting to be sent or delivered) • The synchronous algorithm fails if transient message(s) remain after the processes are released from the barrier

  4. Transient message LBTS=3 LBTS=7 Message arrives in LP C’s past! Transient Message Example event LP D (LA=5) LP C (LA=3) LP B (LA=2) LP A (LA=3) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 Simulation Time

  5. Flush Barrier No process will be released from the barrier until • All processes have reached the barrier • Any message sent by a process before reaching the barrier has arrived at its destination Revised algorithm: WHILE (unprocessed events remain) receive messages generated in previous iteration LBTS = min (Ni + LAi) process events in with time stamp ≤ LBTS flush barrier endDO

  6. Implementation • Use FIFO communication channels • Send a “dummy message” on each channel; wait until such a message is received on each incoming channel to guarantee transient messages have been received • May require a large number of messages • Another approach: message counters • Sendi = number of messages sent by LPi (this iteration) • Reci = number of messages received by LPi (this iteration) • There are no transient messages when • All processes are blocked (i.e., at the barrier), and • ∑Sendi = ∑Reci

  7. -1 +4 -2 Receive transient message +1 0 +1 -2 -1 +3 -1 +1 -2 +1 0 -1 -2 +3 -2 +4 -2 +1 -1 -2 +3 -2 +4 -2 +1 Tree: Flush Barrier • When a leaf process reaches flush barrier, include counter (#sent - #received) in messages sent to parent • Parent adds counters in incoming messages with its own counter, sends sum in message sent to its parent • If sum at root is zero, broadcast “go” message, else wait until sum is equal to zero • Receive message after reporting sum: send update message to root #sent - # received

  8. 0 0 0 0 0 0 0 0 1 2 4 5 6 7 3 step 3 -6 -6 -6 -6 +6 +6 +6 +6 Wallclock time 0 1 2 4 5 6 3 7 step 2 -3 -3 +1 +1 +5 +5 -3 -3 0 2 4 6 1 3 5 7 step 1 -1 -2 -5 +2 +1 0 +3 +2 0 1 2 3 4 5 6 7 Butterfly: Flush Barrier For (i = 1 to log N) send local counter to partner at step i wait for message from partner at step i local counter = local counter + counter in message End-for If local counter not zero after last step: • Send update messages up butterfly • Alternatively, abort and retry 0

  9. Outline • Transient Messages • Transient Message Problem • Flush Barrier • Tree Implementation • Butterfly Implementation • Distance Between Processes • Potential Performance Improvement • Distance Matrix

  10. Identifying Safe Events If all processes are blocked and there are no transient messages in the system, LBTS = min (Ni + LAi) for each process where Ni and LAi are the time of the next unprocessed event and lookahead, respectively, for LPi • Overly conservative estimate for LBTS • Does not exploit “locality” in physical systems (things far away can’t affect you for some time into the future) WHILE (unprocessed events remain) receive messages generated in previous iteration LBTS = min (Ni + LAi) /* time of next event + lookahead */ process events in with time stamp ≤ LBTS* flush barrier /* barrier + eliminate all transient messages */

  11. ORD 4:00 2:00 LAX JFK 6:00 0:30 10:45 SAN 10:00 Example • Lookahead = minimum flight time to another airport • Can the two events be processed concurrently? • Yes because the event @ 10:00 cannot affect the event @ 10:45 • Simple synchronous algorithm: • LBTS = 10:30 (10:00 + 0:30) • Cannot process event @ 10:45 this iteration • Algorithm does not consider LP topology

  12. Distance Between LPs • Associate a lookahead with each link: LAB is the lookahead on the link from LPA to LPB • Any message sent on the link from LPA to LPB must have a time stamp of TA + LAB where TA is the current simulation time of LPA • A path from LPA to LPZ is defined as a sequence of LPs: LPA, LPB, …, LPY, LPZ • The lookahead of a path is the sum of the lookaheads of the links along the path • DAB, the minimum distance from LPA to LPB is the minimum lookahead over all paths from LPA to LPB • The distance from LPA to LPB is the minimum amount of simulated time that must elapse for an event in LPA to affect LPB

  13. Distance Matrix: D [i,j] = minimum distance from LPi to LPj 11 3 LPA 4 4 3 5 LPB 3 5 6 4 LPC 1 3 4 2 LPD 3 1 2 4 LPA LPB LPA LPB LPC LPD 4 1 1 3 4 min (1+2, 3+1) 2 LPC LPD 2 13 15 Distance Between Processes The distance from LPA to LPB is the minimum amount of simulated time that must elapse for an event in LPA to affect LPB • An event in LPY with time stamp TY depends on an event in LPX with time stamp TX if TX + D[X,Y] < TY • Above, the time stamp 15 event depends on the time stamp 11 event, the time stamp 13 event does not.

  14. Distance Matrix: D [i,j] = minimum distance from LPi to LPj 11 3 LPA 4 4 3 5 LPB 3 5 6 4 LPC 1 3 4 2 LPD 3 1 2 4 LPA LPB LPA LPB LPC LPD 4 1 1 3 4 min (1+2, 3+1) 2 LPC LPD 2 13 15 Computing LBTS LBTSi=min(Nj+Dji) (all j) where Ni = time of next event in LPi (assuming all LPs blocked, no transient messages) LBTSA = 15 [min (11+4, 13+5)] LBTSB = 14 [min (11+3, 13+4)] LBTSC = 12 [min (11+1, 13+2)] LBTSD = 14 [min (11+3, 13+4)] Need to know time of next event of every other LP Distance matrix must be recomputed if lookahead changes

  15. ORD 4:00 2:00 LAX JFK 6:00 0:30 10:45 SAN 10:00 Example • Using distance information: • DSAN,JFK = 6:30 • LBTSJFK = 16:30 (10:00 + 6:30) • Event @ 10:45 can be processed this iteration • Concurrent processing of events at times 10:00 and 10:45

  16. Summary • Transient messages must be accounted for by the synchronization algorithm • Flush barrier • Send and receive counters • Distance between LPs • Exploit locality in physical systems to improve concurrency in the simulation execution • Increased complexity, overhead • Lookahead and topology changes introduce additional complexities

More Related