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

Core ROOT-Sim functionalities. More...

#include <log/log.h>
#include <mm/mm.h>
#include <float.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
+ Include dependency graph for core.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define max(a, b)
 
#define min(a, b)
 
#define CACHE_LINE_SIZE   128
 The size of a cpu cache line. More...
 
#define likely(exp)   __builtin_expect(!!(exp), 1)
 Optimize the branch as likely taken.
 
#define unlikely(exp)   __builtin_expect((exp), 0)
 Optimize the branch as likely not taken.
 
#define SIMTIME_MAX   DBL_MAX
 The maximum value of the logical simulation time, semantically never.
 
#define MAX_NODES   (1 << 16)
 The maximum number of supported MPI nodes. More...
 
#define MAX_THREADS   (1 << 10)
 The maximum number of supported threads. More...
 
#define lid_to_nid(lid)   (nid_t)(lid / n_lps_node)
 

Typedefs

typedef double simtime_t
 The type used to represent logical time in the simulation.
 
typedef uint64_t lp_id_t
 Used to uniquely identify LPs in the simulation.
 
typedef unsigned rid_t
 Used to identify in a node the computing resources (threads at the moment)
 
typedef int nid_t
 Used to identify MPI nodes in a distributed environment.
 

Enumerations

enum  rootsim_event {
  MODEL_INIT = 65532, LP_INIT, LP_FINI, MODEL_FINI,
  MODEL_INIT = 65532, LP_INIT, LP_FINI, MODEL_FINI
}
 

Functions

void ProcessEvent (lp_id_t me, simtime_t now, unsigned event_type, const void *content, unsigned size, void *state)
 The total number of threads running in the node.
 
void ProcessEvent_pr (lp_id_t me, simtime_t now, unsigned event_type, const void *content, unsigned size, void *state)
 
bool CanEnd (lp_id_t me, const void *state)
 

Variables

lp_id_t n_lps
 The total number of LPs in the simulation.
 
lp_id_t n_lps_node
 The total number of LPs hosted in the node.
 
rid_t n_threads
 The total number of MPI nodes in the simulation.
 
__thread rid_t rid
 The identifier of the thread.
 
nid_t n_nodes
 
nid_t nid
 The node identifier of the node.
 

Detailed Description

Core ROOT-Sim functionalities.

Core ROOT-Sim functionalities

Definition in file core.h.

Macro Definition Documentation

◆ CACHE_LINE_SIZE

#define CACHE_LINE_SIZE   128

The size of a cpu cache line.

Used to align some data structures in order to avoid false sharing

Definition at line 44 of file core.h.

◆ max

#define max (   a,
 
)
Value:
__extension__({ \
__typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; \
})

Definition at line 24 of file core.h.

◆ MAX_NODES

#define MAX_NODES   (1 << 16)

The maximum number of supported MPI nodes.

FIXME: this is used very limitedly. Consider its removal

Definition at line 68 of file core.h.

◆ MAX_THREADS

#define MAX_THREADS   (1 << 10)

The maximum number of supported threads.

FIXME: this is used very limitedly. Consider its removal

Definition at line 71 of file core.h.

◆ min

#define min (   a,
 
)
Value:
__extension__({ \
__typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; \
})

Definition at line 34 of file core.h.