180     for (i = 0; i < 
n_cores; i++) {
   191     for (i = 0; i < 
n_ker; i++) {
   202     for (i = 0; i < 
n_ker; i++) {
   225     rsfree(white_msg_sent);
   229     for (i = 0; i < 
n_ker; i++) {
   262         rootsim_error(
true, 
"Thread %u cannot enter in red phase because is already in red phase.\n", 
local_tid);
   282         rootsim_error(
true, 
"Thread %u cannot exit from red phase because it wasn't in red phase.\n", 
local_tid);
   304     for (i = 0; i < 
n_ker; i++) {
   391         rootsim_error(
true, 
"unexpected number of white messages received in the last GVT round: [expected: %d, received: %d]\n",
   397     if (white_msg_recv == &white_0_msg_recv) {
   423     for (i = 0; i < 
n_cores; i++) {
   425             rootsim_error(
true, 
"flushing outgoing white message counter while some thread are not in red phase\n");
   429     for (i = 0; i < 
n_ker; i++) {
   453     for (i = 0; i < 
n_ker; i++) {
   457             rootsim_error(
true, 
"Failed to send new GVT init round to kernel %u, because the old init request is still pending\n", i);
   493     unsigned int new_gvt_round;
   495     MPI_Recv(&new_gvt_round, 1, MPI_UNSIGNED, MPI_ANY_SOURCE, 
MSG_NEW_GVT, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
   591 #ifdef HAVE_CROSS_STATE   625 #ifdef HAVE_CROSS_STATE   637     } 
else if (msg->colour == 
white_1) {
 static int expected_white_msg
 
static int * white_msg_sent_buff
Temporary structure used for the MPI collective primitives. 
 
void register_incoming_msg(const msg_t *msg)
Register an incoming message, if necessary. 
 
bool spin_trylock(spinlock_t *s)
 
simtime_t last_reduced_gvt(void)
Return the last GVT value. 
 
void exit_red_phase(void)
Make a thread exit from red phase. 
 
bool all_white_msg_received(void)
Check if white messages are all received. 
 
bool is_request_completed(MPI_Request *req)
check if an MPI request has been completed 
 
static MPI_Request white_count_req
 
#define spinlock_init(s)
Spinlock initialization. 
 
#define next_colour(c)
Tells what is the next colour, using simple arithmetics. 
 
void gvt_comm_init(void)
Initialize the MPI-based distributed GVT reduction submodule. 
 
#define min(a, b)
Macro to find the minimum among two values. 
 
phase_colour * threads_phase_colour
 
static atomic_t white_0_msg_recv
 
void join_white_msg_redux(void)
Join the white message reduction collective operation. 
 
void flush_white_msg_recv(void)
Reset received white messages. 
 
bool gvt_redux_completed(void)
Check if final GVT reduction is complete. 
 
#define atomic_read(v)
Read operation on an atomic counter. 
 
static simtime_t local_vt_buff
 
unsigned int n_cores
Total number of cores required for simulation. 
 
static MPI_Comm gvt_reduction_comm
 
Master notifies the new GVT. 
 
static atomic_t * white_msg_sent
 
bool gvt_init_pending(void)
Check if there are pending GVT-init messages around. 
 
unsigned int find_kernel_by_gid(GID_t gid)
 
void register_outgoing_msg(const msg_t *msg)
Register an outgoing message, if necessary. 
 
#define atomic_set(v, i)
Set operation on an atomic counter. 
 
bool pending_msgs(int tag)
Check if there are pending messages. 
 
#define INFTY
Infinite timestamp: this is the highest timestamp in a simulation run. 
 
bool white_msg_redux_completed(void)
Test completion of white message reduction collective operation. 
 
double simtime_t
This defines the type with whom timestamps are represented. 
 
static atomic_t white_1_msg_recv
 
simtime_t * min_outgoing_red_msg
Minimum time among all the outgoing red messages for each thread. 
 
void wait_white_msg_redux(void)
Wait for the completion of wait message reduction. 
 
#define unlock_mpi()
This macro releases a global lock if multithreaded support is not available from MPI. 
 
static spinlock_t gvt_reduction_lock
 
void enter_red_phase(void)
Make a thread enter into red phase. 
 
static spinlock_t white_count_lock
 
static MPI_Request * gvt_init_reqs
 
static MPI_Request gvt_reduction_req
 
#define in_red_phase()
Tells whether the current thread is in red phase. 
 
static unsigned int gvt_init_round
 
#define is_control_msg(type)
This macro tells whether a message is a control message, by its type. 
 
void broadcast_gvt_init(unsigned int round)
Initiate a distributed GVT. 
 
void gvt_init_clear(void)
Forcely extract GVT-init message from MPI. 
 
volatile atomic_t * white_msg_recv
 
static simtime_t reduced_gvt
 
void flush_white_msg_sent(void)
Reset sent white messages. 
 
void gvt_comm_finalize(void)
Shut down the MPI-based distributed GVT reduction submodule. 
 
__thread unsigned int local_tid
 
#define lock_mpi()
This macro takes a global lock if multithread support is not available from MPI. 
 
static MPI_Comm white_count_comm
 
Distributed GVT Support module. 
 
void join_gvt_redux(simtime_t local_vt)
Reduce the GVT value. 
 
void atomic_inc(atomic_t *)
 
unsigned int n_ker
Total number of simulation kernel instances running. 
 
#define unlikely(exp)
Optimize the branch as likely not taken. 
 
unsigned int kid
Identifier of the local kernel. 
 
void spin_unlock(spinlock_t *s)