 |
The ROme OpTimistic Simulator
3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Go to the documentation of this file.
16 __thread uint64_t lp_id_first;
17 __thread uint64_t lp_id_end;
19 __thread
struct lp_ctx *current_lp;
23 #define lp_start_id_compute(trd) \
25 lp_id_t _g = (trd) * n_lps_node / n_threads; \
26 while (_g && lid_to_rid(_g) >= (trd)) \
28 while (lid_to_rid(_g) < (trd)) \
33 static void lp_iterator_init(
void)
35 lp_id_first = lp_start_id_compute(
rid);
36 lp_id_end = lp_start_id_compute(
rid + 1);
39 void lp_global_init(
void)
41 uint64_t lps_offset =
nid *
n_lps / n_nodes;
50 "The simulation will run with %u threads instead of the available %u",
58 void lp_global_fini(
void)
60 uint64_t lps_offset =
nid *
n_lps / n_nodes;
70 for (uint64_t i = lp_id_first; i < lp_id_end; ++i) {
73 model_allocator_lp_init();
77 termination_lp_init();
84 uint64_t lps_offset =
nid *
n_lps / n_nodes;
86 current_lp = &lps[i + lps_offset];
93 for (uint64_t i = lp_id_first; i < lp_id_end; ++i) {
98 model_allocator_lp_fini();
106 return current_lp - lps;
109 struct lib_ctx *lib_ctx_get_mt(
void)
nid_t nid
The node identifier of the node.
Easier Synchronization primitives.
lp_id_t n_lps
The total number of LPs in the simulation.
void * mm_alloc(size_t mem_size)
A version of the stdlib malloc() used internally.
void process_lp_init(void)
Initializes the processing module in the current LP.
rid_t n_threads
The total number of MPI nodes in the simulation.
#define log_log(lvl,...)
Produces a log.
lp_id_t n_lps_node
The total number of LPs hosted in the node.
LP construction functions.
struct lib_ctx * lib_ctx_p
The additional libraries context of this LP.
__thread rid_t rid
The identifier of the thread.
bool sync_thread_barrier(void)
Synchronizes threads on a barrier.
void mm_free(void *ptr)
A version of the stdlib free() used internally.
void process_lp_fini(void)
Finalizes the processing module in the current LP.
uint64_t lp_id_t
Used to uniquely identify LPs in the simulation.
#define LOG_WARN
The logging level reserved to unexpected, non deal breaking conditions.
void process_lp_deinit(void)
Deinitializes the LP by calling the model's DEINIT handler.