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

Initialization routines. More...

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <limits.h>
#include <sysexits.h>
#include <argp.h>
#include <errno.h>
#include <ROOT-Sim.h>
#include <arch/thread.h>
#include <communication/communication.h>
#include <core/core.h>
#include <core/init.h>
#include <datatypes/bitmap.h>
#include <scheduler/process.h>
#include <gvt/gvt.h>
#include <gvt/ccgs.h>
#include <scheduler/scheduler.h>
#include <mm/state.h>
#include <mm/ecs.h>
#include <mm/mm.h>
#include <statistics/statistics.h>
#include <lib/numerical.h>
#include <lib/topology.h>
#include <lib/abm_layer.h>
#include <serial/serial.h>
#include <communication/mpi.h>
+ Include dependency graph for init.c:

Go to the source code of this file.

Macros

#define malformed_option_failure()   argp_error(state, "invalid value \"%s\" in %s option.\nAborting!", arg, state->argv[state->next -1 -(arg != NULL)])
 
#define conflicting_option_failure(msg)   argp_error(state, "the requested option %s with value \"%s\" is conflicting: " msg "\nAborting!", state->argv[state->next -1 -(arg != NULL)], arg)
 
#define handle_string_option(label, var)
 
#define parse_ullong_limits(low, high)
 

Enumerations

enum  _opt_codes {
  OPT_FIRST = 128, OPT_SCHEDULER = OPT_FIRST + PARAM_SCHEDULER, OPT_CKTRM_MODE = OPT_FIRST + PARAM_CKTRM_MODE, OPT_LPS_DISTRIBUTION = OPT_FIRST + PARAM_LPS_DISTRIBUTION,
  OPT_VERBOSE = OPT_FIRST + PARAM_VERBOSE, OPT_STATS = OPT_FIRST + PARAM_STATS, OPT_STATE_SAVING = OPT_FIRST + PARAM_STATE_SAVING, OPT_SNAPSHOT = OPT_FIRST + PARAM_SNAPSHOT,
  OPT_NP, OPT_NPRC, OPT_OUTPUT_DIR, OPT_NPWD,
  OPT_P, OPT_FULL, OPT_INC, OPT_A,
  OPT_GVT, OPT_GVT_SNAPSHOT_CYCLES, OPT_SIMULATION_TIME, OPT_DETERMINISTIC_SEED,
  OPT_SEED, OPT_SERIAL, OPT_NO_CORE_BINDING, OPT_PREEMPTION,
  OPT_LAST
}
 This is the list of mnemonics for arguments. More...
 

Functions

static error_t parse_opt (int key, char *arg, struct argp_state *state)
 
void SystemInit (int argc, char **argv)
 

Variables

const char *const param_to_text [][5]
 
const char * argp_program_version = PACKAGE_STRING "\nCopyright (C) 2008-2019 HPDCS Group"
 
const char * argp_program_bug_address = PACKAGE_BUGREPORT
 
static char doc [] = "ROOT-Sim - a fast distributed multithreaded Parallel Discrete Event Simulator \v For more information check the official wiki at https://github.com/HPDCS/ROOT-Sim/wiki"
 
static char args_doc [] = ""
 
static const struct argp_option argp_options []
 
static struct argp_child argp_child [2]
 
static struct argp argp = { argp_options, parse_opt, args_doc, doc, argp_child, 0, 0 }
 

Detailed Description

Initialization routines.

This module implements the simulator initialization routines

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
Andrea Piccione
Alessandro Pellegrini
Roberto Vitali

Definition in file init.c.

Macro Definition Documentation

#define handle_string_option (   label,
  var 
)
Value:
case label: \
({ \
unsigned __i = 1; \
while(1) { \
if(strcmp(arg, param_to_text[key - OPT_FIRST][__i]) == 0) { \
var = __i; \
break; \
} \
if(!param_to_text[key - OPT_FIRST][++__i]) \
malformed_option_failure(); \
} \
}); \
break
Definition: init.c:67
const char *const param_to_text[][5]
Definition: init.c:101

Definition at line 189 of file init.c.

#define parse_ullong_limits (   low,
  high 
)
Value:
({ \
unsigned long long int __value; \
char *__endptr; \
__value = strtoull(arg, &__endptr, 10); \
if(!(*arg != '\0' && *__endptr == '\0' && (__value > low || __value == low) && __value <= high)) { \
malformed_option_failure(); \
} \
__value; \
})

Definition at line 206 of file init.c.

Enumeration Type Documentation

enum _opt_codes

This is the list of mnemonics for arguments.

Enumerator
OPT_FIRST 

this is used as an offset to the enum values, so that argp doesn't assign short options

Definition at line 66 of file init.c.

Function Documentation

void SystemInit ( int  argc,
char **  argv 
)

This function initializes the simulator

Author
Francesco Quaglia
Alessandro Pellegrini
Parameters
argcnumber of parameters passed at command line
argvarray of parameters passed at command line

Definition at line 401 of file init.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct argp_child argp_child[2]
static
Initial value:
= {
{0, 0, "Model specific options", 0},
{0}
}

Definition at line 385 of file init.c.

const struct argp_option argp_options[]
static
Initial value:
= {
{"wt", OPT_NP, "VALUE", 0, "Number of total cores being used by the simulation", 0},
{"lp", OPT_NPRC, "VALUE", 0, "Total number of Logical Processes being launched at simulation startup", 0},
{"output-dir", OPT_OUTPUT_DIR, "PATH", 0, "Path to a folder where execution statistics are stored. If not present, it is created", 0},
{"scheduler", OPT_SCHEDULER, "TYPE", 0, "LP Scheduling algorithm. Supported values are: stf", 0},
{"npwd", OPT_NPWD, 0, 0, "Non Piece-Wise-Deterministic simulation model. See manpage for accurate description", 0},
{"p", OPT_P, "VALUE", 0, "Checkpointing interval", 0},
{"full", OPT_FULL, 0, 0, "Take only full logs", 0},
{"inc", OPT_INC, 0, 0, "Take only incremental logs (still to be released)", 0},
{"A", OPT_A, 0, 0, "Autonomic subsystem: set checkpointing interval and log mode automatically at runtime (still to be released)", 0},
{"gvt", OPT_GVT, "VALUE", 0, "Time between two GVT reductions (in milliseconds)", 0},
{"cktrm-mode", OPT_CKTRM_MODE, "TYPE", 0, "Termination Detection mode. Supported values: normal, incremental, accurate", 0},
{"gvt-snapshot-cycles", OPT_GVT_SNAPSHOT_CYCLES, "VALUE", 0, "Termination detection is invoked after this number of GVT reductions", 0},
{"simulation-time", OPT_SIMULATION_TIME, "VALUE", 0, "Halt the simulation when all LPs reach this logical time. 0 means infinite", 0},
{"lps-distribution", OPT_LPS_DISTRIBUTION, "TYPE", 0, "LPs distributions over simulation kernels policies. Supported values: block, circular", 0},
{"deterministic-seed", OPT_DETERMINISTIC_SEED, 0, 0, "Do not change the initial random seed for LPs. Enforces different deterministic simulation runs", 0},
{"verbose", OPT_VERBOSE, "TYPE", 0, "Verbose execution", 0},
{"stats", OPT_STATS, "TYPE", 0, "Level of detail in the output statistics", 0},
{"seed", OPT_SEED, "VALUE", 0, "Manually specify the initial random seed", 0},
{"serial", OPT_SERIAL, 0, 0, "Run a serial simulation (using Calendar Queues)", 0},
{"sequential", OPT_SERIAL, 0, OPTION_ALIAS, NULL, 0},
{"no-core-binding", OPT_NO_CORE_BINDING, 0, 0, "Disable the binding of threads to specific physical processing cores", 0},
{"no-preemption", OPT_PREEMPTION, 0, 0, "Disable Preemptive Time Warp", 0},
{0}
}

Definition at line 154 of file init.c.

const char* const param_to_text[][5]

This array contains the stringified version of the parameter values ROOT-Sim accepts. You can index the first level of the array using the enum param_codes while for the second level you have to refer to the enumerations listed in relevant modules headers.

Definition at line 101 of file init.c.