ROSS
Functions
tw-lp.c File Reference

tw_lp_settype is defined here! More...

#include <ross.h>

Go to the source code of this file.

Functions

void tw_lp_setup_types ()
 
void tw_lp_settype (tw_lpid id, tw_lptype *type)
 
void tw_lp_onpe (tw_lpid id, tw_pe *pe, tw_lpid gid)
 
void tw_lp_onkp (tw_lp *lp, tw_kp *kp)
 
void tw_init_lps (tw_pe *me)
 
void tw_pre_run_lps (tw_pe *me)
 
void tw_lp_suspend (tw_lp *lp, int do_orig_event_rc, int error_num)
 

Function Documentation

void tw_init_lps ( tw_pe me)
void tw_lp_onkp ( tw_lp lp,
tw_kp kp 
)

Definition at line 73 of file tw-lp.c.

References tw_lp::kp, tw_kp::lp_count, tw_error(), and TW_LOC.

Referenced by map_linear(), map_round_robin(), and specialized_lp_init_mapping().

Here is the call graph for this function:

Here is the caller graph for this function:

void tw_lp_onpe ( tw_lpid  id,
tw_pe pe,
tw_lpid  gid 
)

Definition at line 57 of file tw-lp.c.

References g_st_analysis_nlp, g_tw_lp, g_tw_nlp, tw_lp::gid, tw_lp::id, pe, tw_lp::pe, tw_calloc(), tw_error(), and TW_LOC.

Referenced by map_linear(), map_round_robin(), and specialized_lp_init_mapping().

Here is the call graph for this function:

Here is the caller graph for this function:

void tw_lp_settype ( tw_lpid  id,
tw_lptype type 
)

IMPORTANT: This function should be called after tw_define_lps. It copies the function pointers which define the LP to the appropriate location for each LP, i.e. you probably want to call this more than once.

Definition at line 38 of file tw-lp.c.

References g_st_analysis_nlp, g_tw_delta_sz, g_tw_lp, g_tw_nlp, tw_lp::gid, tw_lp::pe, tw_lptype::state_sz, tw_error(), TW_LOC, and tw_lp::type.

Referenced by main(), and st_analysis_lp_settype().

Here is the call graph for this function:

Here is the caller graph for this function:

void tw_lp_setup_types ( )

Definition at line 11 of file tw-lp.c.

References g_st_ev_trace, g_tw_lp, g_tw_lp_typemap, g_tw_lp_types, g_tw_nlp, tw_lp::gid, st_model_setup_types(), tw_error(), TW_LOC, and tw_lp::type.

Here is the call graph for this function:

void tw_lp_suspend ( tw_lp lp,
int  do_orig_event_rc,
int  error_num 
)

LP Suspension Design Notes! (John Jenkins, ANL)

Many times, when developing optimistic models, we are able to determine < LP state, event > pairs which represent infeasible model behavior. These types of simulation states typically arise when time warp causes us to receive and potentially process messages in an order we don't expect.

For example, consider a client/server protocol in which a server sends an ACK to a client upon completion of some event. In optimistic mode, the client can see what amounts to duplicate ACKs from the server due to the server LP rolling back and re-sending an ACK.

While some models can gracefully cope with such issues, more complex models can have troubles (the client in the example could for instance destroy the request metadata after receiving an ACK).

A solution, as noted in the "Dark Side of Risk" paper, is to introduce LP "self-suspend" functionality. If an LP is able to detect a < state, message > pair which is incorrect / unexpected in a well-behaved simulation, the LP should be able to put itself into suspend mode, refusing to process messages until rolled back to a pre < state, message > state. There are two benefits: 1) it greatly reduces the difficulty in tracking down and distinguishing proper model bugs from bugs arising from time-warp related issues such as out-of-order event receipt and 2) it improves simulation performance by pruning the number of processed events that we know are invalid and will be rolled back anyways.

I suggest the function signature tw_suspend(tw_lp *lp, int do_suspend_event_rc, const char * format, ...), with the following semantics:

After a call to tw_suspend, all subsequent events (both forward and reverse) that arrive at the suspended LP shall be processed as if they were no-ops. The reverse event handler of the event that caused the suspend will be run if do_orig_event_rc is nonzero; otherwise, the reverse event handler shall additionally be a no-op. Typically, do_orig_event_rc == 0 is desired, as good coding practices for moderate-or-greater complexity simulations dictate state/event validation prior to modifying LP state (partial rollbacks are very undesirable), but there may be messy logic in the user code for which a partial rollback is warranted (operations that free memory as a side effect of operations, for example). An LP exits suspend state upon rolling back the event that caused the suspend (whether or not that event is processed as a no-op). Upon GVT, if an LP is in self-suspend mode and the event that caused the suspend has a timestamp less than that of GVT, then the simulator shall report the format string of suspended LP(s) and exit. A NULL format string is acceptable for performance purposes, e.g. when doing "production" simulation runs.

Parameters
lpPointer to the LP we're suspending
do_orig_event_rcA bool indicating whether or not to skip the RC function
error_numUser-specified value for tracking purposes; ROSS ignores this

Definition at line 227 of file tw-lp.c.

References tw_pe::cur_event, tw_lp::pe, tw_lp::suspend_do_orig_event_rc, tw_lp::suspend_error_number, tw_lp::suspend_event, tw_lp::suspend_flag, tw_lp::suspend_time, tw_error(), TW_LOC, and tw_now().

Here is the call graph for this function:

void tw_pre_run_lps ( tw_pe me)

Definition at line 147 of file tw-lp.c.

References tw_pe::abort_event, tw_event::caused_by_me, tw_pe::cev_abort, tw_pe::cur_event, tw_lp::cur_state, g_st_analysis_nlp, g_tw_lp, g_tw_nlp, tw_lp::pe, tw_lptype::pre_run, tw_error(), TW_LOC, and tw_lp::type.

Referenced by tw_sched_init().

Here is the call graph for this function:

Here is the caller graph for this function: