81 bool user_exit_flag =
false;
100 printf(
"Warning: exit() has been called from the model.\n" 101 "The simulation will now halt, but its unlikely what you really wanted...\n" 102 "You should use OnGVT() instead. See the manpages for an explanation.\n");
108 inline bool user_requested_exit(
void)
110 return user_exit_flag;
113 static void handle_signal(
int signum)
115 if (signum == SIGINT) {
116 user_exit_flag =
true;
131 struct sigaction new_act = { 0 };
136 new_act.sa_handler = handle_signal;
138 new_act.sa_flags = SA_RESETHAND;
140 sigaction(SIGINT, &new_act, NULL);
163 __attribute__((pure))
167 return kernel[gid.to_int];
203 inline bool simulation_error(
void)
226 vsnprintf(buf, 1024, msg, args);
229 fprintf(stderr, (fatal ?
"[FATAL ERROR] " :
"[WARNING] "));
231 fprintf(stderr,
"%s", buf);
235 if (rootsim_config.
serial) {
260 register unsigned int i = 0;
268 rootsim_error(
true,
"Unable to allocate %d logical processes on %d kernels: must have at least %d LPs\n",
n_prc_tot,
n_ker,
n_ker);
280 if (block_leftover > 0)
297 if (block_leftover == 0)
void scheduler_fini(void)
void statistics_fini(void)
#define likely(exp)
Optimize the branch as likely taken.
unsigned int * kernel
Mapping between kernel instances and logical processes.
static bool sim_error
Flag to notify all workers that there was an error.
Core ROOT-Sim functionalities.
unsigned int n_cores
Total number of cores required for simulation.
bool exit_silently_from_kernel
This flag tells whether we are exiting from the kernel of from userspace.
void initialization_complete(void)
The ROOT-Sim scheduler main module header.
void _rootsim_error(bool fatal, const char *msg,...)
static bool init_complete
This flag is set when the initialization of the simulator is complete, with no errors.
Generic thread management facilities.
void exit_from_simulation_model(void)
void barrier_init(barrier_t *b, int t)
unsigned int find_kernel_by_gid(GID_t gid)
simulation_configuration rootsim_config
This global variable holds the configuration for the current simulation.
Memory Manager main header.
Configuration of the execution of the simulator.
bool thread_barrier(barrier_t *b)
barrier_t all_thread_barrier
Barrier for all worker threads.
#define master_thread()
This macro expands to true if the current KLT is the master thread for the local kernel.
unsigned int n_prc
Number of logical processes hosted by the current kernel instance.
void communication_fini(void)
Finalize the communication subsystem.
void simulation_shutdown(int code)
int lps_distribution
Policy for the LP to Kernel mapping.
void statistics_stop(int exit_code)
unsigned int n_prc_tot
Total number of logical processes running in the simulation.
bool serial
If the simulation must be run serially.
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.
Thread barrier definition.
void distribute_lps_on_kernels(void)