ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Macros | Functions | Variables
termination.h File Reference

Termination detection module. More...

#include <core/core.h>
#include <lp/lp.h>
#include <stdatomic.h>
Include dependency graph for termination.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define termination_cant_end()   (atomic_load_explicit(&nodes_to_end, memory_order_relaxed) > 0)
 Get the termination status of this simulation. More...
 

Functions

void termination_global_init (void)
 Initialize the termination detection module node-wide.
 
void termination_lp_init (struct lp_ctx *lp)
 Initialize the termination detection module LP-wide.
 
void termination_on_msg_process (struct lp_ctx *lp, simtime_t msg_time)
 Compute termination operations after a new message has been processed. More...
 
void termination_on_gvt (simtime_t current_gvt)
 Update the termination module state after a GVT computation. More...
 
void termination_on_lp_rollback (struct lp_ctx *lp, simtime_t msg_time)
 Compute termination operations after a LP has been rollbacked. More...
 
void termination_on_ctrl_msg (void)
 Compute termination operations after the receipt of a termination control message.
 
void termination_force (void)
 

Variables

_Atomic nid_t nodes_to_end
 The number of nodes that still need to continue running the simulation.
 

Detailed Description

Termination detection module.

Macro Definition Documentation

◆ termination_cant_end

#define termination_cant_end ( )    (atomic_load_explicit(&nodes_to_end, memory_order_relaxed) > 0)

Get the termination status of this simulation.

Returns
true if the simulation must go on, false otherwise

Function Documentation

◆ termination_on_gvt()

void termination_on_gvt ( simtime_t  current_gvt)

Update the termination module state after a GVT computation.

Here we check if the simulation, from the point of view of the current thread, can be terminated. If also all the other processing threads on the node are willing to end the simulation, a termination control message is broadcast to the other nodes.

◆ termination_on_lp_rollback()

void termination_on_lp_rollback ( struct lp_ctx lp,
simtime_t  msg_time 
)

Compute termination operations after a LP has been rollbacked.

Parameters
msg_timethe timestamp of the straggler or anti message which caused the rollback

◆ termination_on_msg_process()

void termination_on_msg_process ( struct lp_ctx lp,
simtime_t  msg_time 
)

Compute termination operations after a new message has been processed.

Parameters
msg_timethe timestamp of the freshly processed message