The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
core.c File Reference

Core ROOT-Sim functionalities. More...

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
#include <signal.h>
#include <arch/thread.h>
#include <core/core.h>
#include <core/init.h>
#include <scheduler/process.h>
#include <scheduler/scheduler.h>
#include <statistics/statistics.h>
#include <gvt/gvt.h>
#include <mm/mm.h>
+ Include dependency graph for core.c:

Go to the source code of this file.

Functions

void exit_from_simulation_model (void)
 
bool user_requested_exit (void)
 
static void handle_signal (int signum)
 
void base_init (void)
 
void base_fini (void)
 
unsigned int find_kernel_by_gid (GID_t gid)
 
void simulation_shutdown (int code)
 
bool simulation_error (void)
 
void _rootsim_error (bool fatal, const char *msg,...)
 
void distribute_lps_on_kernels (void)
 
void initialization_complete (void)
 

Variables

barrier_t all_thread_barrier
 Barrier for all worker threads.
 
unsigned int * kernel
 Mapping between kernel instances and logical processes.
 
unsigned int kid
 Identifier of the local kernel.
 
unsigned int n_ker
 Total number of simulation kernel instances running.
 
unsigned int n_cores
 Total number of cores required for simulation.
 
unsigned int n_prc_tot
 Total number of logical processes running in the simulation. More...
 
unsigned int n_prc
 Number of logical processes hosted by the current kernel instance.
 
simulation_configuration rootsim_config
 This global variable holds the configuration for the current simulation.
 
static bool sim_error = false
 Flag to notify all workers that there was an error.
 
bool exit_silently_from_kernel = false
 This flag tells whether we are exiting from the kernel of from userspace.
 
static bool init_complete = false
 This flag is set when the initialization of the simulator is complete, with no errors.
 
bool user_exit_flag = false
 

Detailed Description

Core ROOT-Sim functionalities.

Core ROOT-Sim functionalities

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

Author
Francesco Quaglia
Alessandro Pellegrini
Roberto Vitali
Date
3/18/2011

Definition in file core.c.

Function Documentation

void _rootsim_error ( bool  fatal,
const char *  msg,
  ... 
)

A variadic function which prints out error messages. If the errors are marked as fatal, the simulation is correctly shut down.

Author
Alessandro Pellegrini
Parameters
fatalThis flag marks an error as fatal (true) or not (false)
msgThe error message to be printed out. This can be specified as in the printf() format message, thus a matching number of extra parameters can be passed.

Definition at line 220 of file core.c.

void base_fini ( void  )

This function finalizes the core structures of ROOT-Sim, just before terminating a simulation

Author
Roberto Vitali

Definition at line 151 of file core.c.

+ Here is the caller graph for this function:

void base_init ( void  )

This function initilizes basic functionalities within ROOT-Sim. In particular, it creates a mapping between logical processes and kernel instances.

Author
Francesco Quaglia
Roberto Vitali
Alessandro Pellegrini

Definition at line 129 of file core.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void distribute_lps_on_kernels ( void  )

This function maps logical processes onto kernel instances

Author
Francesco Quaglia
Alessandro Pellegrini

Definition at line 258 of file core.c.

void exit_from_simulation_model ( void  )

This function is used to terminate with not much pain the simulation if the user model inadvertently calls exit(). It displays a warning message, and then tries to silently shutdown. The software enters this function using the standard atexit() API.

Author
Alessandro Pellegrini

Definition at line 91 of file core.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int find_kernel_by_gid ( GID_t  gid)

Creates a mapping between logical processes and kernel instances

Author
Francesco Quaglia
Parameters
gidThe logical process' global identifier
Returns
The id of the kernel currently hosting the logical process

Definition at line 164 of file core.c.

+ Here is the caller graph for this function:

void initialization_complete ( void  )

This function records that the initialization is complete.

Definition at line 316 of file core.c.

+ Here is the caller graph for this function:

void simulation_shutdown ( int  code)

This function calls all the finalization functions exposed by subsystems and then exits.

Author
Alessandro Pellegrini
Parameters
codeThe exit code to be returned by the process

Definition at line 178 of file core.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

unsigned int n_prc_tot

Total number of logical processes running in the simulation.

This is the definition of the number of LPs running in the current simulation.

Definition at line 64 of file core.c.