![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Global Virtual Time. More...
#include <ROOT-Sim.h>
#include <arch/thread.h>
#include <gvt/gvt.h>
#include <gvt/ccgs.h>
#include <core/core.h>
#include <core/init.h>
#include <core/timer.h>
#include <scheduler/process.h>
#include <scheduler/scheduler.h>
#include <statistics/statistics.h>
#include <mm/mm.h>
#include <communication/mpi.h>
#include <communication/gvt.h>
Go to the source code of this file.
Functions | |
void | gvt_init (void) |
void | gvt_fini (void) |
simtime_t | get_last_gvt (void) |
static void | reduce_local_gvt (void) |
simtime_t | GVT_phases (void) |
bool | start_new_gvt (void) |
simtime_t | gvt_operations (void) |
Variables | |
timer | gvt_timer |
timer | gvt_round_timer |
static unsigned int | init_kvt_tkn |
static unsigned int | commit_gvt_tkn |
static enum kernel_phases | kernel_phase = kphase_idle |
static unsigned int | init_completed_tkn |
static unsigned int | commit_kvt_tkn |
static unsigned int | idle_tkn |
static atomic_t | counter_initialized |
static atomic_t | counter_kvt |
static atomic_t | counter_finalized |
static volatile unsigned int | current_GVT_round = 0 |
To be used with CAS to determine who is starting the next GVT reduction phase. | |
static atomic_t | counter_A |
How many threads have left phase A? | |
static atomic_t | counter_send |
How many threads have left phase send? | |
static atomic_t | counter_B |
How many threads have left phase B? | |
static __thread simtime_t | last_gvt = 0.0 |
static volatile simtime_t | new_gvt = 0.0 |
static __thread enum thread_phases | thread_phase = tphase_idle |
What is my phase? All threads start in the initial phase. | |
static __thread unsigned int | my_GVT_round = 0 |
Per-thread GVT round counter. | |
static simtime_t * | local_min |
The local (per-thread) minimum. It's not TLS, rather an array, to allow reduction by master thread. | |
static simtime_t * | local_min_barrier |
Global Virtual Time.
This module implements the GVT reduction. The current implementation is non blocking for observable simulation plaftorms.
This file is part of ROOT-Sim (ROme OpTimistic Simulator).
ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.
ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file gvt.c.
|
inline |
This function returns the last computed GVT value at each thread. It can be safely used concurrently to keep track of the evolution of the committed trajectory. It's so far mainly used for termination detection based on passed simulation time.
Definition at line 179 of file gvt.c.
void gvt_fini | ( | void | ) |
void gvt_init | ( | void | ) |
simtime_t gvt_operations | ( | void | ) |
This is the entry point from the main simulation loop to the GVT subsystem. This function is not executed in case of a serial simulation, and is executed concurrently by different worker threads in case of a parallel one. All the operations here implemented must be re-entrant. Any state variable of the GVT implementation must be declared statically and globally (in case, on a per-thread basis). This function is called at every simulation loop, so at the beginning the code should check whether a GVT computation is occurring, or if a computation must be started.
Definition at line 300 of file gvt.c.
|
static |
Keep track of the last computed gvt value. Its a per-thread variable to avoid synchronization on it, but eventually all threads write here the same exact value. The 'adopted_last_gvt' version is used to maintain the adopted gvt value in a temporary variable. It is then copied to last_gvt during the end phase, to avoid possible critical races when checking the termination upon reaching a certain simulation time value.