 |
The ROme OpTimistic Simulator
3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Go to the documentation of this file.
41 #define mqueue(from, to) (&queues[to * n_threads + from])
73 struct lp_msg *msg = heap_items(this_q->q)[j];
74 if(!(atomic_load_explicit(&msg->
flags,
75 memory_order_relaxed) & MSG_FLAG_PROCESSED))
76 msg_allocator_free(msg);
102 struct lp_msg *msg = heap_count(bid_q->q) ? heap_min(bid_q->q) : NULL;
109 if (heap_count(this_q->q) &&
110 (!msg || msg_is_before(heap_min(this_q->q), msg))) {
111 msg = heap_min(this_q->q);
119 if(
likely(heap_count(bid_q->q)))
142 memset(done, 0,
sizeof(done));
144 for(
rid_t i = 0, r = t_cnt; r; i = (i + 1) % t_cnt){
154 if (heap_count(this_q->q) && t_min >
155 heap_min(this_q->q)->dest_t) {
156 t_min = heap_min(this_q->q)->dest_t;
double simtime_t
The type used to represent logical time in the simulation.
#define heap_fini(self)
Finalizes an heap.
atomic_int flags
The flags to handle local anti messages.
unsigned rid_t
Used to identify in a node the computing resources (threads at the moment)
Easier Synchronization primitives.
#define spin_lock(lck_p)
Locks a spinlock.
#define CACHE_LINE_SIZE
The size of a cpu cache line.
static binary_heap(struct lp_msg *)
The messages queue of the serial runtime.
#define spin_trylock(lck_p)
Executes the trylock operation on a spinlock.
void * mm_alloc(size_t mem_size)
A version of the stdlib malloc() used internally.
spinlock_t lck
Synchronizes access to the queue.
void msg_queue_init(void)
Initializes the message queue for the current thread.
struct lp_msg * msg_queue_extract(void)
Extracts the next message from the queue.
#define spin_init(lck_p)
Initializes a spinlock.
A model simulation message.
rid_t n_threads
The total number of MPI nodes in the simulation.
Memory management functions for messages.
void msg_queue_global_init(void)
Initializes the message queue at the node level.
lp_id_t dest
The id of the recipient LP.
#define SIMTIME_MAX
The maximum value of the logical simulation time, semantically never.
#define heap_insert(self, cmp_f, elem)
Inserts an element into the heap.
LP construction functions.
A queue synchronized by a spinlock.
uint_fast32_t array_count_t
The type used to handle dynamic arrays count of elements and capacity.
__thread rid_t rid
The identifier of the thread.
void mm_free(void *ptr)
A version of the stdlib free() used internally.
#define likely(exp)
Optimize the branch as likely taken.
static struct msg_queue * queues
The queues matrix, linearized in a contiguous array.
void msg_queue_insert(struct lp_msg *msg)
Inserts a message in the queue.
Core ROOT-Sim functionalities.
void msg_queue_fini(void)
Finalizes the message queue for the current thread.
#define heap_extract(self, cmp_f)
Extracts an element from the heap.
#define mqueue(from, to)
Utility macro to fetch the correct inner queue.
void msg_queue_global_fini(void)
Finalizes the message queue at the node level.
#define heap_init(self)
Initializes an empty heap.
simtime_t msg_queue_time_peek(void)
Peeks the timestamp of the next message from the queue.
#define spin_unlock(lck_p)
Unlocks a spinlock.
atomic_flag spinlock_t
The type of a spinlock, an efficient lock primitive in contended scenarios.