ROOT-Sim core
3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
|
Global Virtual Time. More...
#include <gvt/gvt.h>
#include <arch/timer.h>
#include <core/sync.h>
#include <datatypes/msg_queue.h>
#include <distributed/mpi.h>
#include <memory.h>
#include <stdatomic.h>
Enumerations | |
enum | thread_phase { thread_phase_idle = 0 , thread_phase_A , thread_phase_B , thread_phase_C , thread_phase_D } |
A thread phase during the gvt algorithm computation. | |
enum | node_phase { node_phase_redux_first = 0 , node_sent_reduce , node_sent_reduce_wait , node_sent_wait , node_phase_redux_second , node_min_reduce , node_min_reduce_wait , node_min_wait , node_done } |
Node phases of the non-blocking GVT algorithm. | |
Functions | |
void | gvt_global_init (void) |
Initializes the gvt module in the node. | |
void | gvt_start_processing (void) |
Handles a MSG_CTRL_GVT_START control message. More... | |
void | gvt_on_done_ctrl_msg (void) |
Handles a MSG_CTRL_GVT_DONE control message. More... | |
void | gvt_on_msg_extraction (simtime_t msg_t) |
Informs the GVT subsystem that a new message is being processed. More... | |
static simtime_t | gvt_node_reduce (void) |
static bool | gvt_thread_phase_run (void) |
static bool | gvt_node_phase_run (void) |
simtime_t | gvt_phase_run (void) |
Executes a step of the GVT algorithm. More... | |
void | gvt_msg_drain (void) |
Cleanup the distributed state of the GVT algorithm. More... | |
void | gvt_remote_msg_send (struct lp_msg *msg, nid_t dest_nid) |
void | gvt_remote_anti_msg_send (struct lp_msg *msg, nid_t dest_nid) |
void | gvt_remote_msg_receive (struct lp_msg *msg) |
void | gvt_remote_anti_msg_receive (struct lp_msg *msg) |
Variables | |
static __thread enum thread_phase | thread_phase = thread_phase_idle |
static timer_uint | gvt_timer |
static simtime_t | reducing_p [MAX_THREADS] |
static __thread simtime_t | gvt_accumulator |
static _Atomic rid_t | c_a = 0 |
static _Atomic rid_t | c_b = 0 |
static _Atomic nid_t | gvt_nodes |
__thread _Bool | gvt_phase |
__thread uint32_t | remote_msg_seq [2][MAX_NODES] |
__thread uint32_t | remote_msg_received [2] |
Global Virtual Time.
For a detailed explanantion of the algorithm, see:
T. Tocci, A. Pellegrini, F. Quaglia, J. Casanovas-García, and T. Suzumura “ORCHESTRA: An Asynchronous Wait-Free Distributed GVT Algorithm” in Proceedings of the 21st IEEE/ACM International Symposium on Distributed Simulation and Real Time Applications, 2017, pp. 51–58
gvt_msg_drain | ( | void | ) |
Cleanup the distributed state of the GVT algorithm.
This function flushes the remaining remote messages, moreover it makes sure that all the nodes complete the potentially ongoing GVT algorithm so that MPI collectives are inactive.
void gvt_on_done_ctrl_msg | ( | void | ) |
Handles a MSG_CTRL_GVT_DONE control message.
Called by the MPI layer in response to a MSG_CTRL_GVT_DONE control message
void gvt_on_msg_extraction | ( | simtime_t | msg_t | ) |
Informs the GVT subsystem that a new message is being processed.
msg_t | the timestamp of the message being processed |
Called by the process layer when processing a new message; used in the actual GVT calculation
gvt_phase_run | ( | void | ) |
Executes a step of the GVT algorithm.
This function must be called several times by all the processing threads hosted in the nodes involved in the simulation before completing and returning a proper GVT value.
void gvt_remote_anti_msg_receive | ( | struct lp_msg * | msg | ) |
Registers an incoming remote anti-message in the GVT subsystem
msg | the remote anti-message to register |
Registers an outgoing remote anti-message in the GVT subsystem
msg | the remote anti-message to register |
dest_nid | the destination node id of the anti-message |
void gvt_remote_msg_receive | ( | struct lp_msg * | msg | ) |
Registers an incoming remote message in the GVT subsystem
msg | the remote message to register |
Registers an outgoing remote message in the GVT subsystem
msg | the remote message to register |
dest_nid | the destination node id of the message |
void gvt_start_processing | ( | void | ) |
Handles a MSG_CTRL_GVT_START control message.
Called by the MPI layer in response to a MSG_CTRL_GVT_START control message, but also internally to start a new reduction