outline
play

Outline Rollbacks idiosyncrasies and remedies Error Handling - PDF document

Outline Rollbacks idiosyncrasies and remedies Error Handling Dynamic Memory Allocation Advanced Simulation Event Retraction Improving the cost of rollbacks Lazy Cancellation PDES: Time Warp Mechanism Lazy Re-Evaluation


  1. Outline ● Rollbacks idiosyncrasies and remedies » Error Handling » Dynamic Memory Allocation Advanced 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 simulator? aborting program. Is this appropriate for TimeWarp 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() , free() How should these 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 ● Roll back of memory release (e.g., free() ) » Errors that impact only checkpointed state (e.g., divide by zero) » 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

  2. 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 Retraction: Mechanics: send anti-message to cancel the LP 1 ● E 1 retracted event send E+ » Retraction: invoked by application program anti-message leave E+ in reschedule E for E » Cancellation: invoked by Time Warp executive (transparent to output queue E- the application) LP 2 E+ E+ Rollback “retraction request” (visualization – coming up!) ● annihilate E » Idea: Reschedule the original event » During retraction: a positive copy of message being retracted is placed in output queue » Rollback: release messages this message from output queue (emulating that the message was not retracted ) Retraction handled within Time Warp executive 11 Maria Hybinette, UGA

  3. Example: Lazy Cancellation Lazy Cancellation roll back execute forward don � t send execute forward ● Motivation: E 2 not resent 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 scheduled by rolled back event. anti-message don � t send E 2 + and E 2 - in output queue anti-message ● Mechanism: LP 2 E 1 + E 1 + E 2 + E 2 - » rollback: do not immediately send anti-messages » after rollback, re-compute 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 ● Motivation: ● Benefit: » re-execution of event after rollback may be produce same result (LP state) as the original execution » avoid unnecessary message cancellations which in turn eliminate secondary rollbacks. » in this case, original rollback was unnecessary ● Liabilities: » extra overhead (message comparisons) ● Mechanism: » delay in canceling wrong computations » rollback: do not discard state vectors of rolled back – may allow erroneous computations to spread further. -> 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 ● Conventional wisdom queue match that of the original execution, » Lazy cancellation typically improves performance immediately � jump forward � to state prior to rollback » Empirical data indicate 10% improvement typical (the straggler didn’t change the state). 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

  4. 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