A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::NullMessageMpiInterface Class Reference

Interface between ns-3 and MPI for the Null Message distributed simulation implementation. More...

#include <null-message-mpi-interface.h>

+ Inheritance diagram for ns3::NullMessageMpiInterface:
+ Collaboration diagram for ns3::NullMessageMpiInterface:

Public Member Functions

 NullMessageMpiInterface ()
 
 ~NullMessageMpiInterface ()
 
virtual void Destroy ()
 Delete all buffers. More...
 
virtual void Disable ()
 Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy (). More...
 
virtual void Enable (int *pargc, char ***pargv)
 
virtual uint32_t GetSize ()
 
virtual uint32_t GetSystemId ()
 
virtual bool IsEnabled ()
 
virtual void SendPacket (Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
 
- Public Member Functions inherited from ns3::ParallelCommunicationInterface
virtual ~ParallelCommunicationInterface ()
 Destructor. More...
 

Static Public Member Functions

static void InitializeSendReceiveBuffers (void)
 Initialize send and receive buffers. More...
 
static void ReceiveMessagesBlocking ()
 Blocking message receive. More...
 
static void ReceiveMessagesNonBlocking ()
 Non-blocking check for received messages complete. More...
 
static void SendNullMessage (const Time &guaranteeUpdate, Ptr< RemoteChannelBundle > bundle)
 Send a Null Message to across the specified bundle. More...
 
static void TestSendComplete ()
 Check for completed sends. More...
 

Static Private Member Functions

static void ReceiveMessages (bool blocking=false)
 Check for received messages complete. More...
 

Static Private Attributes

static bool g_enabled = false
 
static bool g_initialized = false
 
static uint32_t g_numNeighbors = 0
 
static std::list
< NullMessageSentBuffer
g_pendingTx
 
static char ** g_pRxBuffers
 
static MPI_Requestg_requests
 
static uint32_t g_sid = 0
 
static uint32_t g_size = 1
 

Detailed Description

Interface between ns-3 and MPI for the Null Message distributed simulation implementation.

Definition at line 88 of file null-message-mpi-interface.h.

Constructor & Destructor Documentation

ns3::NullMessageMpiInterface::NullMessageMpiInterface ( )

Definition at line 94 of file null-message-mpi-interface.cc.

References NS_FATAL_ERROR, and NS_LOG_FUNCTION.

ns3::NullMessageMpiInterface::~NullMessageMpiInterface ( )

Definition at line 107 of file null-message-mpi-interface.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

void ns3::NullMessageMpiInterface::Destroy ( void  )
virtual

Delete all buffers.

Implements ns3::ParallelCommunicationInterface.

Definition at line 113 of file null-message-mpi-interface.cc.

References NS_LOG_FUNCTION.

void ns3::NullMessageMpiInterface::Disable ( )
virtual

Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy ().

Resets m_initialized and m_enabled.

Implements ns3::ParallelCommunicationInterface.

Definition at line 414 of file null-message-mpi-interface.cc.

References g_enabled, g_initialized, g_numNeighbors, g_pendingTx, g_pRxBuffers, g_requests, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

void ns3::NullMessageMpiInterface::Enable ( int *  pargc,
char ***  pargv 
)
virtual
Parameters
pargcnumber of command line arguments
pargvcommand line arguments

Sets up interface. Calls MPI Init and posts receives.

Implements ns3::ParallelCommunicationInterface.

Definition at line 144 of file null-message-mpi-interface.cc.

References g_enabled, g_initialized, g_sid, g_size, and NS_LOG_FUNCTION.

uint32_t ns3::NullMessageMpiInterface::GetSize ( )
virtual
Returns
number of systems (MPI size)

Implements ns3::ParallelCommunicationInterface.

Definition at line 126 of file null-message-mpi-interface.cc.

References g_enabled, g_size, and NS_ASSERT.

uint32_t ns3::NullMessageMpiInterface::GetSystemId ( void  )
virtual
Returns
system id (MPI rank)

Implements ns3::ParallelCommunicationInterface.

Definition at line 119 of file null-message-mpi-interface.cc.

References g_enabled, g_sid, and NS_ASSERT.

void ns3::NullMessageMpiInterface::InitializeSendReceiveBuffers ( void  )
static

Initialize send and receive buffers.

This method should be called after all links have been added to the RemoteChannelBundle manager to setup any required send and receive buffers.

Definition at line 169 of file null-message-mpi-interface.cc.

References ns3::RemoteChannelBundleManager::Find(), g_enabled, g_numNeighbors, g_pRxBuffers, g_requests, g_size, NS_ASSERT, NS_LOG_FUNCTION_NOARGS, ns3::NULL_MESSAGE_MAX_MPI_MSG_SIZE, and ns3::RemoteChannelBundleManager::Size().

Referenced by ns3::NullMessageSimulatorImpl::CalculateLookAhead().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::NullMessageMpiInterface::IsEnabled ( )
virtual
Returns
true if interface is enabled

Implements ns3::ParallelCommunicationInterface.

Definition at line 133 of file null-message-mpi-interface.cc.

References g_enabled, g_initialized, and ns3::Simulator::GetImplementation().

+ Here is the call graph for this function:

void ns3::NullMessageMpiInterface::ReceiveMessages ( bool  blocking = false)
staticprivate

Check for received messages complete.

Will block until message has been received if blocking flag is true. When blocking will return after the first message is received. Non-blocking mode will Non-blocking check for received messages complete. Will receive all messages that are queued up locally.

Definition at line 289 of file null-message-mpi-interface.cc.

References ns3::RemoteChannelBundleManager::Find(), g_enabled, g_numNeighbors, g_pRxBuffers, g_requests, ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Node::GetNDevices(), ns3::NodeList::GetNode(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::NULL_MESSAGE_MAX_MPI_MSG_SIZE, ns3::MpiReceiver::Receive(), and ns3::Simulator::ScheduleWithContext().

Referenced by ReceiveMessagesBlocking(), and ReceiveMessagesNonBlocking().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::NullMessageMpiInterface::ReceiveMessagesBlocking ( )
static

Blocking message receive.

Will block until at least one message has been received.

Definition at line 271 of file null-message-mpi-interface.cc.

References NS_LOG_FUNCTION_NOARGS, and ReceiveMessages().

Referenced by ns3::NullMessageSimulatorImpl::HandleArrivingMessagesBlocking().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::NullMessageMpiInterface::ReceiveMessagesNonBlocking ( )
static

Non-blocking check for received messages complete.

Will receive all messages that are queued up locally.

Definition at line 280 of file null-message-mpi-interface.cc.

References NS_LOG_FUNCTION_NOARGS, and ReceiveMessages().

Referenced by ns3::NullMessageSimulatorImpl::HandleArrivingMessagesNonBlocking().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::NullMessageMpiInterface::SendNullMessage ( const Time guaranteeUpdate,
Ptr< RemoteChannelBundle bundle 
)
static

Send a Null Message to across the specified bundle.

Parameters
guaranteeUpdateguarantee update time for the Null Message the destination bundle for the Null Message.

Guarantee update time is the lower bound time on the next possible event from this MPI task to the remote MPI task across the bundle. Remote task may execute events up to time.

Null Messages are sent when a packet has not been sent across this bundle in order to allow time advancement on the remote MPI task.

Internal:
The Null Message MPI buffer format is based on the format for sending a packet with several fields set to 0 to signal that it is a Null Message. Overloading the normal packet format simplifies receive logic.

uint64_t 0 must be zero for Null Message uint64_t guarantee time uint32_t 0 must be zero for Null Message uint32_t 0 must be zero for Null Message

Definition at line 239 of file null-message-mpi-interface.cc.

References g_enabled, g_pendingTx, ns3::Time::GetInteger(), ns3::Time::GetTimeStep(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::NullMessageSimulatorImpl::NullMessageEventHandler(), and ns3::RemoteChannelBundle::Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::NullMessageMpiInterface::SendPacket ( Ptr< Packet p,
const Time rxTime,
uint32_t  node,
uint32_t  dev 
)
virtual
Parameters
ppacket to send
rxTimereceived time at destination node
nodedestination node
devdestination device

Serialize and send a packet to the specified node and net device.

Internal:
The MPI buffer format packs a delivery information and the serialized packet.

uint64_t time the packed should be delivered uint64_t guarantee time for the Null Message algorithm. uint32_t node id of destination unit32_t dev id on destination uint8_t[] serialized packet

Implements ns3::ParallelCommunicationInterface.

Definition at line 196 of file null-message-mpi-interface.cc.

References ns3::NullMessageSimulatorImpl::CalculateGuaranteeTime(), g_enabled, g_pendingTx, ns3::NullMessageSimulatorImpl::GetInstance(), ns3::Time::GetInteger(), ns3::NodeList::GetNode(), ns3::Packet::GetSerializedSize(), ns3::Node::GetSystemId(), ns3::Time::GetTimeStep(), NS_ASSERT, NS_LOG_FUNCTION, ns3::NullMessageSimulatorImpl::RescheduleNullMessageEvent(), and ns3::Packet::Serialize().

+ Here is the call graph for this function:

void ns3::NullMessageMpiInterface::TestSendComplete ( )
static

Check for completed sends.

Definition at line 390 of file null-message-mpi-interface.cc.

References current, g_enabled, g_pendingTx, NS_ASSERT, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::NullMessageSimulatorImpl::HandleArrivingMessagesBlocking(), and ns3::NullMessageSimulatorImpl::HandleArrivingMessagesNonBlocking().

+ Here is the caller graph for this function:

Member Data Documentation

bool ns3::NullMessageMpiInterface::g_enabled = false
staticprivate
bool ns3::NullMessageMpiInterface::g_initialized = false
staticprivate

Definition at line 213 of file null-message-mpi-interface.h.

Referenced by Disable(), Enable(), and IsEnabled().

uint32_t ns3::NullMessageMpiInterface::g_numNeighbors = 0
staticprivate
std::list< NullMessageSentBuffer > ns3::NullMessageMpiInterface::g_pendingTx
staticprivate
char ** ns3::NullMessageMpiInterface::g_pRxBuffers
staticprivate
MPI_Request * ns3::NullMessageMpiInterface::g_requests
staticprivate
uint32_t ns3::NullMessageMpiInterface::g_sid = 0
staticprivate

Definition at line 205 of file null-message-mpi-interface.h.

Referenced by Enable(), and GetSystemId().

uint32_t ns3::NullMessageMpiInterface::g_size = 1
staticprivate

Definition at line 208 of file null-message-mpi-interface.h.

Referenced by Enable(), GetSize(), and InitializeSendReceiveBuffers().


The documentation for this class was generated from the following files: