|  | ROOT-Sim core
    3.0.0-rc.2
    A General-Purpose Multi-threaded Parallel/Distributed Simulation Library | 
LP state management functions. More...
#include <lp/process.h>#include <arch/timer.h>#include <datatypes/msg_queue.h>#include <distributed/mpi.h>#include <gvt/fossil.h>#include <gvt/gvt.h>#include <log/stats.h>#include <lp/common.h>#include <lp/lp.h>#include <mm/auto_ckpt.h>#include <mm/msg_allocator.h>#include <serial/serial.h>
| Macros | |
| #define | mark_msg_remote(msg_p) ((struct lp_msg *)(((uintptr_t)(msg_p)) | 2U)) | 
| #define | mark_msg_sent(msg_p) ((struct lp_msg *)(((uintptr_t)(msg_p)) | 1U)) | 
| #define | unmark_msg_remote(msg_p) ((struct lp_msg *)(((uintptr_t)(msg_p)) - 2U)) | 
| #define | unmark_msg_sent(msg_p) ((struct lp_msg *)(((uintptr_t)(msg_p)) - 1U)) | 
| Functions | |
| void | ScheduleNewEvent (lp_id_t receiver, simtime_t timestamp, unsigned event_type, const void *payload, unsigned payload_size) | 
| API to inject a new event in the simulation.  More... | |
| static void | checkpoint_take (struct lp_ctx *lp) | 
| Take a checkpoint of the state of a LP.  More... | |
| void | process_lp_init (struct lp_ctx *lp) | 
| Initializes the processing module in the current LP. | |
| void | process_lp_fini (struct lp_ctx *lp) | 
| Finalize the processing module in the current LP. | |
| static void | silent_execution (const struct lp_ctx *lp, array_count_t last_i, array_count_t past_i) | 
| Perform silent execution of events.  More... | |
| static void | send_anti_messages (struct process_ctx *proc_p, array_count_t past_i) | 
| Send anti-messages.  More... | |
| static void | do_rollback (struct lp_ctx *lp, array_count_t past_i) | 
| Perform a rollback.  More... | |
| static array_count_t | match_straggler_msg (const struct process_ctx *proc_p, const struct lp_msg *s_msg) | 
| Find the last valid processed message with respect to a straggler message.  More... | |
| static array_count_t | match_anti_msg (const struct process_ctx *proc_p, const struct lp_msg *a_msg) | 
| Find the last valid processed message with respect to a received anti-message.  More... | |
| static void | handle_remote_anti_msg (struct lp_ctx *lp, struct lp_msg *a_msg) | 
| Handle the reception of a remote anti-message.  More... | |
| static bool | check_early_anti_messages (struct process_ctx *proc_p, struct lp_msg *msg) | 
| Check if a remote message has already been invalidated by an early remote anti-message.  More... | |
| static void | handle_anti_msg (struct lp_ctx *lp, struct lp_msg *msg, uint32_t last_flags) | 
| Handle the reception of an anti-message.  More... | |
| static void | handle_straggler_msg (struct lp_ctx *lp, struct lp_msg *msg) | 
| Handle the reception of a straggler message.  More... | |
| void | process_msg (void) | 
| Extract and process a message, if available.  More... | |
| Variables | |
| static __thread bool | silent_processing = false | 
| The flag used in ScheduleNewEvent() to keep track of silent execution. | |
| static __thread struct lp_msg * | current_msg | 
| The currently processed message.  More... | |
LP state management functions.
This module contains the main logic for the parallel simulation runtime
| 
 | inlinestatic | 
Check if a remote message has already been invalidated by an early remote anti-message.
| proc_p | the message processing data of the current LP | 
| a_msg | the remote message to check | 
| 
 | inlinestatic | 
Take a checkpoint of the state of a LP.
| lp | the LP to checkpoint | 
The actual checkpoint operation is delegated to the model memory allocator.
| 
 | static | 
Perform a rollback.
| proc_p | the message processing data for the LP that has to rollback | 
| past_i | the index in proc_p of the last validly processed message | 
Handle the reception of an anti-message.
| lp | the processing context of the current LP | 
| msg | the received anti-message | 
| last_flags | the original value of the message flags before being modified by the current process_msg() call | 
Handle the reception of a remote anti-message.
| proc_p | the message processing data for the LP that has to handle the anti-message | 
| a_msg | the remote anti-message | 
Handle the reception of a straggler message.
| lp | the processing context of the current LP | 
| msg | the received straggler message | 
| 
 | inlinestatic | 
Find the last valid processed message with respect to a received anti-message.
| proc_p | the message processing data for the LP | 
| a_msg | the anti-message | 
| 
 | inlinestatic | 
Find the last valid processed message with respect to a straggler message.
| proc_p | the message processing data for the LP | 
| s_msg | the straggler message | 
| void process_msg | ( | void | ) | 
Extract and process a message, if available.
This function encloses most of the actual parallel/distributed simulation logic.
| void ScheduleNewEvent | ( | lp_id_t | receiver, | 
| simtime_t | timestamp, | ||
| unsigned | event_type, | ||
| const void * | event_content, | ||
| unsigned | event_size | ||
| ) | 
API to inject a new event in the simulation.
This is a function pointer that is setup at simulation startup to point to either ScheduleNewEvent_parallel() in case of a parallel/distributed simulation, or to ScheduleNewEvent_serial() in case of a serial simulation.
| receiver | The ID of the LP that should receive the newly-injected message | 
| timestamp | The simulation time at which the event should be delivered at the recipient LP | 
| event_type | Numerical event type to be passed to the model's dispatcher | 
| event_content | The event content | 
| event_size | The size (in bytes) of the event content | 
| 
 | inlinestatic | 
Send anti-messages.
| proc_p | the message processing data for the LP that has to send anti-messages | 
| past_i | the index in proc_p of the last validly processed message | 
| 
 | inlinestatic | 
Perform silent execution of events.
| proc_p | the message processing data for the LP that has to coast forward | 
| last_i | the index in proc_p of the last processed message in the current LP state | 
| past_i | the target index in proc_p of the message to reach with the silent execution operation | 
This function implements the coasting forward operation done after a checkpoint has been restored.
| 
 | static | 
The currently processed message.
This is not necessary for normal operation, but it's useful in debug