The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
communication.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <core/core.h>
35 
43 #define SLAB_MSG_SIZE 512
44 
59  RESERVED_MSG_CODE = 65532,
73 };
74 
76 #define is_control_msg(type) (type >= MIN_VALUE_CONTROL && type != RENDEZVOUS_START)
77 
78 
86 enum _mpi_tags {
87  MSG_NEW_GVT = 100,
89 };
90 
101 #define INIT_OUTGOING_MSG 8
102 
103 struct lp_struct;
104 
122 typedef struct _outgoing_t {
124  unsigned int size;
125  unsigned int max_size;
127 } outgoing_t;
128 
129 
130 
131 extern void ParallelScheduleNewEvent(unsigned int, simtime_t, unsigned int, void *, unsigned int);
132 extern void communication_init(void);
133 extern void communication_fini(void);
134 extern void Send(msg_t * msg);
135 extern void insert_outgoing_msg(msg_t * msg);
136 extern void send_outgoing_msgs(struct lp_struct *);
137 extern void send_antimessages(struct lp_struct *, simtime_t);
138 
139 extern void msg_hdr_release(msg_hdr_t * msg);
140 extern msg_t *get_msg_from_slab(struct lp_struct *);
141 extern msg_hdr_t *get_msg_hdr_from_slab(struct lp_struct *);
142 extern void pack_msg(msg_t ** msg, GID_t sender, GID_t receiver, int type, simtime_t timestamp, simtime_t send_time, size_t size, void *payload);
143 extern void msg_to_hdr(msg_hdr_t * hdr, msg_t * msg);
144 extern void hdr_to_msg(msg_hdr_t * hdr, msg_t * msg);
145 extern void msg_release(msg_t * msg);
146 extern void dump_msg_content(msg_t * msg);
147 
148 
149 #ifndef NDEBUG
150 extern void validate_msg(msg_t * msg);
151 #else
152 #define validate_msg(msg)
153 #endif
void communication_fini(void)
Finalize the communication subsystem.
Definition: communication.c:75
ECS protocol: a remote LP is asked for a certain set of pages.
Definition: communication.h:69
ECS protocol: the sender LP has been synchronized and is now blocked.
Definition: communication.h:66
void communication_init(void)
Initialize the communication subsystem.
Definition: communication.c:59
void dump_msg_content(msg_t *msg)
Dump the content of a message.
void pack_msg(msg_t **msg, GID_t sender, GID_t receiver, int type, simtime_t timestamp, simtime_t send_time, size_t size, void *payload)
Pack a message in a platform-level data structure.
void validate_msg(msg_t *msg)
Perform some sanity checks on a message buffer.
Core ROOT-Sim functionalities.
unsigned int max_size
Total space in outgoing_msgs.
void msg_release(msg_t *msg)
Release a message buffer.
_control_msgs
Simulation Platform Control Messages.
Definition: communication.h:58
Master notifies the new GVT.
Definition: communication.h:87
Anything after this value is considered as an impossible message.
Definition: communication.h:72
void insert_outgoing_msg(msg_t *msg)
Place a message in the temporary LP outgoing buffer.
Separation value between model and platform messages.
Definition: communication.h:64
msg_hdr_t * get_msg_hdr_from_slab(struct lp_struct *)
Get a buffer to keep a message header.
One rank informs the others that the simulation has to be stopped.
Definition: communication.h:88
ECS protocol: start synchronizing two LPs for a page fault.
Definition: communication.h:65
double simtime_t
This defines the type with whom timestamps are represented.
Definition: ROOT-Sim.h:55
void ParallelScheduleNewEvent(unsigned int, simtime_t, unsigned int, void *, unsigned int)
Schedule a new message to some LP.
Message Type definition.
Definition: core.h:164
void msg_to_hdr(msg_hdr_t *hdr, msg_t *msg)
Convert a message to a message header.
void msg_hdr_release(msg_hdr_t *msg)
Release a message header.
ECS protocol: the destination LP can resume its normal execution.
Definition: communication.h:67
struct _outgoing_t outgoing_t
Per-LP buffer of newly-generated events.
Definition of a GID.
Definition: core.h:132
ECS protocol: modified pages are sent back to the owner LP.
Definition: communication.h:71
ECS protocol: an ECS synchronization should be rolled back.
Definition: communication.h:68
void hdr_to_msg(msg_hdr_t *hdr, msg_t *msg)
convert a message header into a message
_mpi_tags
Internal MPI tags.
Definition: communication.h:86
unsigned int size
How many events is this currently keeping.
msg_t * get_msg_from_slab(struct lp_struct *)
Get a buffer to keep a message.
Message envelope definition. This is used to handle the output queue and stores information needed to...
Definition: core.h:194
ECS protocol: the sender LP is giving a lease on a set of pages.
Definition: communication.h:70
msg_t ** outgoing_msgs
Resizable array of message pointers.
simtime_t * min_in_transit
Smallest timestamp of events kept here.
Per-LP buffer of newly-generated events.
void send_antimessages(struct lp_struct *, simtime_t)
Send all antimessages for a certain LP.
void send_outgoing_msgs(struct lp_struct *)
Send all pending outgoing messages.
void Send(msg_t *msg)
Send a message.