ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Classes | Macros | Enumerations | Functions
msg.h File Reference

Message management functions. More...

#include <core/core.h>
#include <limits.h>
#include <stdatomic.h>
#include <stddef.h>
#include <string.h>
Include dependency graph for msg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lp_msg
 A model simulation message. More...
 

Macros

#define MSG_PAYLOAD_BASE_SIZE   32
 The minimum size of the payload to which message allocations are snapped to.
 
#define msg_is_before(a, b)   ((a)->dest_t < (b)->dest_t || ((a)->dest_t == (b)->dest_t && msg_is_before_extended(a, b)))
 Compute the value of the happens-before relation between two messages. More...
 
#define msg_preamble_size()   (offsetof(struct lp_msg, dest))
 Get the size of the message preamble. More...
 
#define msg_remote_data(msg)   (&(msg)->dest)
 Get the address of the remote message data, i.e. the part of the message to be transmitted over MPI. More...
 
#define msg_remote_size(msg)   (offsetof(struct lp_msg, pl) - msg_preamble_size() + (msg)->pl_size)
 Get the size of the message data, i.e. the part of the message to be transmitted over MPI. More...
 
#define msg_remote_anti_size()   (offsetof(struct lp_msg, m_seq) - msg_preamble_size() + sizeof(uint32_t))
 Get the size of the a anti-message data, i.e. the part of the anti-message to be transmitted over MPI. More...
 

Enumerations

enum  msg_flag { MSG_FLAG_ANTI = 1 , MSG_FLAG_PROCESSED = 2 }
 

Functions

static bool msg_is_before_extended (const struct lp_msg *restrict a, const struct lp_msg *restrict b)
 Compute a deterministic order for messages with same timestamp. More...
 

Detailed Description

Message management functions.

Message management functions

Macro Definition Documentation

◆ msg_is_before

#define msg_is_before (   a,
 
)    ((a)->dest_t < (b)->dest_t || ((a)->dest_t == (b)->dest_t && msg_is_before_extended(a, b)))

Compute the value of the happens-before relation between two messages.

Parameters
[in]aa pointer to the first message to compare
[in]ba pointer to the second message to compare
Returns
true if the message pointed by a happens-before the message pointed by b, false otherwise

◆ msg_preamble_size

#define msg_preamble_size ( )    (offsetof(struct lp_msg, dest))

Get the size of the message preamble.

Returns
the size in bytes of the message preamble The preamble is the initial part of the message which doesn't need to be transmitted over MPI

◆ msg_remote_anti_size

#define msg_remote_anti_size ( )    (offsetof(struct lp_msg, m_seq) - msg_preamble_size() + sizeof(uint32_t))

Get the size of the a anti-message data, i.e. the part of the anti-message to be transmitted over MPI.

Returns
the size in bytes of the anti-message data

◆ msg_remote_data

#define msg_remote_data (   msg)    (&(msg)->dest)

Get the address of the remote message data, i.e. the part of the message to be transmitted over MPI.

Parameters
[in]msga pointer to the message
Returns
the address of the message data

◆ msg_remote_size

#define msg_remote_size (   msg)    (offsetof(struct lp_msg, pl) - msg_preamble_size() + (msg)->pl_size)

Get the size of the message data, i.e. the part of the message to be transmitted over MPI.

Parameters
[in]msga pointer to the message
Returns
the size in bytes of the message data

Function Documentation

◆ msg_is_before_extended()

static bool msg_is_before_extended ( const struct lp_msg *restrict  a,
const struct lp_msg *restrict  b 
)
inlinestatic

Compute a deterministic order for messages with same timestamp.

Parameters
athe first message to compare
bthe second message to compare
Returns
true if the a come before b

There can be two distinct messages a and b so that msg_is_before_extended(a, b) == false and msg_is_before_extended(b, a) == false. In that case, the two messages will necessarily induce the same state change in the receiving LP: it doesn't make any difference which one will be processed first.