The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
wnd.c File Reference

Message delivery support. More...

+ Include dependency graph for wnd.c:

Go to the source code of this file.

Functions

static size_t outgoing_queues_size (void)
 Compute the size of all outgoing queues. More...
 
void outgoing_window_init (void)
 Outgoing queue initialization. More...
 
void outgoing_window_finalize (void)
 Finalize the message delivery subsystem. More...
 
outgoing_msgallocate_outgoing_msg (void)
 Allocate a buffer for an outgoing message node. More...
 
static bool is_msg_delivered (outgoing_msg *msg)
 Check if a message has been delivered. More...
 
void store_outgoing_msg (outgoing_msg *out_msg, unsigned int dest_kid)
 Store an outgoing message. More...
 
static int prune_outgoing_queue (outgoing_queue *oq)
 Prune an outgoing queue. More...
 
int prune_outgoing_queues (void)
 Prune all outgoing queues. More...
 

Variables

static outgoing_queueoutgoing_queues
 
static int n_queues = 0
 The number of outgoing queues which are managed by the submodule.
 

Detailed Description

Message delivery support.

This module implements the message delivery support functions. Message delivery is carried out asynchronously via MPI, therefore we need a way to let MPI notify us when a certain message has been delivered to the destination simulation kernel and is now in charge of it.

This module implements a set of per-remote-kernel queues in which each remote message is registered before an Isend operation is initiated.

MPI will eventually notify us of the delivery of that message. By scanning the outgoing queues, we can know what messages have reached destination and remove the corresponding entry.

This file is part of ROOT-Sim (ROme OpTimistic Simulator).

ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.

ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Author
Tommaso Tocci

Definition in file wnd.c.

Function Documentation

outgoing_msg* allocate_outgoing_msg ( void  )

Allocate a buffer for an outgoing message node.

This function allocates a buffer to keep track of one message which is being remotely sent through MPI

Returns
a pointer to a buffer keeping an outgoing_msg to be populated before linking to an outgoing queue

Definition at line 130 of file wnd.c.

+ Here is the caller graph for this function:

static bool is_msg_delivered ( outgoing_msg msg)
inlinestatic

Check if a message has been delivered.

Given a message node in an outgoing queue, this function determines whether the corresponding MPI Request tells that the operation is comple, therefore meaning that the message has been delivered to the destination simulation kernel instance.

Parameters
msgA pointer to an outgoing_msg to check for delivery
Returns
true if the message has been delivered, false otherwise

Definition at line 148 of file wnd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static size_t outgoing_queues_size ( void  )
static

Compute the size of all outgoing queues.

This function determines the total size (in number of managed nodes) of the local outgoing queues.

Returns
The total number of elements in all the local outgoing queues

Definition at line 68 of file wnd.c.

+ Here is the caller graph for this function:

void outgoing_window_finalize ( void  )

Finalize the message delivery subsystem.

At simulation shutdown, this function is invoked to release all the datastructures which have been used to keep track of remote message delivery.

Definition at line 107 of file wnd.c.

+ Here is the call graph for this function:

void outgoing_window_init ( void  )

Outgoing queue initialization.

This function is called at simulation startup, and initializes the outgoing queue subsystem, to keep track of the delivery of messages to remote simulation kernel instances.

Definition at line 86 of file wnd.c.

+ Here is the caller graph for this function:

static int prune_outgoing_queue ( outgoing_queue oq)
static

Prune an outgoing queue.

Given an outgoing queue, this function scans through it looking for all messages which have been correctly delivered to their destination.

The nodes associated with operations which have completed are removed and freed.

Note
This function is thread safe
Parameters
oqThe output queue to inspect

Definition at line 190 of file wnd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int prune_outgoing_queues ( void  )

Prune all outgoing queues.

This function scans through all the local outgoing queues, looking for messages which have been correctly delivered to the destination.

Such message nodes are removed from the queue.

Actual queue pruning is performed in prune_outgoing_queue()

Definition at line 225 of file wnd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void store_outgoing_msg ( outgoing_msg out_msg,
unsigned int  dest_kid 
)

Store an outgoing message.

Given an outgoing_msg node and a destination kernel id, this function properly links the node in out_msg to the proper outgoing queue associated with the destination kernel.

Note
This function is thread safe
Parameters
out_msgA pointer to an outgoing_msg node
dest_kidThe global ID of the simulation kernel instance for which this node represents an outgoing message

Definition at line 167 of file wnd.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

outgoing_queue* outgoing_queues
static

Outgoing queues are used to keep track, at the MPI level, of what messages have been scheduled for asynchronous delivery through MPI. These queues are used to let MPI notify ROOT-Sim that a certain message has been delivered to the destination simulation kernel, and it is now in charge of its management.

We keep one outgoing queue for each remote kernel instance.

Definition at line 54 of file wnd.c.