Outline � Rollbacks idiosyncrasies and remedies CSCI 8220 » Error Handling » Dynamic Memory Allocation Parallel & Distributed Simulation � Event Retraction � Improving the cost of rollbacks » Lazy Cancellation PDES: Time Warp Mechanism » Lazy Re-Evaluation Other Mechanisms � Memory Management » Mechanisms » Storage optimal protocols » Artificial Rollback � Other optimistic protocols 2 Maria Hybinette, UGA Maria Hybinette, UGA Optimistic Execution Questions Error Handling � How to handle error handling in an optimistic � Typically Errors such as divide by zero, are handled by aborting program. Is this appropriate for TimeWarp simulator? simulations? Why or Why not? » Why is this a problematic? � Problem: What if an execution error is rolled back? � How to manage dynamic memory � Solution: Do not abort program until the error is allocations? committed (GVT advances past the simulation time » Why is this problematic? Remedies? when the error occurred). � How to make rollbacks more efficient? » Requires Time Warp executive to “catch” (flag) errors when they occur » Countermeasures depend on error type 3 4 Maria Hybinette, UGA Maria Hybinette, UGA Error Types Dynamic Memory Allocation � Program detected malloc() and free() How should they be handled? » Logic errors, e.g., some variables never negative » Treat “abort” procedure like an I/O operation, prevent error from Issues: propagating and flag error to see if it erased by rollback. � Roll back of memory allocation (e.g., malloc() ) � Infinite loops » Interrupt mechanism to receive incoming messages » Problem: Memory leak (when check pointing a pointer to a previously allocated memory location). Run out of memory… » Poll for messages in loop » Solution: release memory if malloc rolled back � Benign errors » Errors that impact only checkpointed state (e.g., divide by zero) � Roll back of memory release (e.g., free() ) » Trap mechanism to catch runtime execution errors » Problem: Reuse memory that has already been released. The � Destructive errors LP did not really mean to free the memory … » Difficult to detect these… » Solution: » Example: overwrite state of Time Warp executive) – Treat memory release like an I/O operation » Runtime checks (e.g., array bounds) – Only release memory when GVT has advanced past the simulation time when the memory was released » Strong type checking, avoid pointer arithmetic, etc. 5 6 Maria Hybinette, UGA Maria Hybinette, UGA
Event Retraction Event Retraction Approaches � Goal: � Application Level » Need a primitive to un-schedule a previously scheduled � Kernel Level event (application level primitive) � Example: » ORD Schedules an arrival at JFK » Need to re-route aircraft to Boston (due to congestion at JFK) � Observation: » Cancellation retracts events at the ‘simulation kernel level’ � Problem: » Need a mechanism to undo event retraction (cancellation) if the event computation that invoked the retraction is rolled back. 7 8 Maria Hybinette, UGA Maria Hybinette, UGA Example: Application Approach Event Retraction: Approach 1 schedule invoke original retract event E primitive Application Level Approach LP 1 E 1 1. Schedule a retraction event with time stamp schedule retract event R earlier than (<) the event being retracted 2. Process retraction event: Set flag in LP state to begin to process E, indicate the event has been retracted. notice flag is set, LP 2 R E ignore event 3. Process event: Check if it has been retracted process R, before processing any event set flag Retraction handled within the application 9 Maria Hybinette, UGA Example: Kernel Approach Event Retraction: Approach 2 schedule invoke original retract Time Warp Executive Level Approach event E primitive roll back LP 1 LP 1 Retraction: send anti-message to cancel the retracted event E 1 � » Retraction: invoked by application program send E+ anti-message » Cancellation: invoked by Time Warp executive (transparent to leave E+ in reschedule E for E the application) output queue E- Rollback retraction request � LP 2 E+ E+ » Reschedule the original event annihilate E » Retraction: place positive copy of message being retracted in output queue » Rollback: Send messages in output queue (same as before) Retraction handled within Time Warp executive 11 Maria Hybinette, UGA
Example: Lazy Cancellation Lazy Cancellation roll back execute forward don � t send execute forward E 2 not resent � Motivation: anti-messages E 1 resent LP 1 » re-execution after rollback may generate the same messages as the original execution E 2 - E 1 - send » in this case, need not cancel original message that were anti-messageAnnihilate anti-message scheduled by rolled back event. don � t send E 2 + and E 2 - in output queue anti-message LP 2 � Mechanism: E 1 + E 1 + E 2 + E 2 - » rollback: do not immediately send anti-messages » after rollback, recompute forward » only send anti-message if recomputation does NOT produce the same message again Lazy cancellation avoids unnecessary rollback 13 Maria Hybinette, UGA Lazy Cancellation: Evaluation Lazy Re-evaluation � Benefit: � Motivation: » avoid unnecessary message cancellations which in turn » re-execution of event after rollback may be produce same eliminate secondary rollbacks. result (LP state) as the original execution � Liabilities: » in this case, original rollback was unnecessary » extra overhead (message comparisons) » delay in canceling wrong computations � Mechanism: – may allow erroneous computations to spread further. -> » rollback: do not discard state vectors of rolled back more computations may need to rollback when anti- computations message is finally sent » process straggler event, recompute forward » more memory required (delayed memory reclamation) » during recomputation, if the state vector and input queue � Conventional wisdom match that of the original execution, immediately “jump » Lazy cancellation typically improves performance forward” to state prior to rollback. » Empirical data indicate 10% improvement typical 15 16 Maria Hybinette, UGA Maria Hybinette, UGA Lazy Re-evaluation Memory Management in Time Warp � Benefit: � Parallel execution using Time Warp tends to use much more memory than a sequential » avoid unnecessary recomputation on rollback execution (even with fossil collection) » works well if straggler does not affect LP state (query events) » State vector and event history � Liabilities: » Memory consumption can be unbounded because an LP can execute arbitrarily far ahead of other LPs » extra overhead (state comparisons) » “Overoptimism” lead to very long and frequent » more memory required rollbacks, may waste computation time. � Conventional wisdom » Typically does not improve overall performance » Useful in certain special cases (e.g., query events) 17 18 Maria Hybinette, UGA Maria Hybinette, UGA
Memory Management in Time Warp Memory Consumption “Overoptimism” lead to very long and frequent rollbacks, may waste � Sequential Simulations: computation time. » aborts � Parallel Simulations: LP B memory » abort? buffer holding event LP A » more memory? Time Event at GVT » blocking? » Memory: LP B fossil 1) positive and collected 2) anti-messages and LP A Time 3) state vectors 19 20 Maria Hybinette, UGA Maria Hybinette, UGA Message Sendback Memory Consumption Remedies Basic Idea: � Send time stamp � Infrequent / incremental: state saving � Reclaim memory used by a message by returning it to the original sender � Pruning: dynamically release copy state saved memory � Usually causes the sender to roll back � Blocking: block certain LPs to prevent overly unprocessed optimistic execution processed LP 2 � Roll back to reclaim memory � Message sendback Message sendback Roll back events LP 1 21 Simulation time Maria Hybinette, UGA Event Time Stamps Message Sendback � Receive time stamp: time stamp indicating when the event occurs (conventional definition of time stamp) � Causes sender to roll back to the send time of � Send time stamp of event E: time stamp of the LP event being sent back when it scheduled E (time stamp of event being � Can any message be sent back? processed when it scheduled E) » No! Can only send back messages with send time greater than GVT � A new definition of GVT is needed Send time stamp = 10 Receive time stamp = 20 LP 2 GVT(T) (GVT at wallclock time T) is the minimum among » Receive time stamp of unprocessed and partially processed events LP 1 » Send time stamp of backward transient messages at wallclock time T 24 10 20 Simulation time Maria Hybinette, UGA
Recommend
More recommend