Interface between ns-3 and MPI for the Null Message distributed simulation implementation. More...
#include <null-message-mpi-interface.h>
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_Request * | g_requests |
static uint32_t | g_sid = 0 |
static uint32_t | g_size = 1 |
Interface between ns-3 and MPI for the Null Message distributed simulation implementation.
Definition at line 88 of file null-message-mpi-interface.h.
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.
|
virtual |
Delete all buffers.
Implements ns3::ParallelCommunicationInterface.
Definition at line 113 of file null-message-mpi-interface.cc.
References NS_LOG_FUNCTION.
|
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.
|
virtual |
pargc | number of command line arguments |
pargv | command 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.
|
virtual |
Implements ns3::ParallelCommunicationInterface.
Definition at line 126 of file null-message-mpi-interface.cc.
|
virtual |
Implements ns3::ParallelCommunicationInterface.
Definition at line 119 of file null-message-mpi-interface.cc.
|
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().
|
virtual |
Implements ns3::ParallelCommunicationInterface.
Definition at line 133 of file null-message-mpi-interface.cc.
References g_enabled, g_initialized, and ns3::Simulator::GetImplementation().
|
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().
|
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().
|
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().
|
static |
Send a Null Message to across the specified bundle.
guaranteeUpdate | guarantee 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.
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().
|
virtual |
p | packet to send |
rxTime | received time at destination node |
node | destination node |
dev | destination device |
Serialize and send a packet to the specified node and net device.
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().
|
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().
|
staticprivate |
Definition at line 214 of file null-message-mpi-interface.h.
Referenced by Disable(), Enable(), GetSize(), GetSystemId(), InitializeSendReceiveBuffers(), IsEnabled(), ReceiveMessages(), SendNullMessage(), SendPacket(), and TestSendComplete().
|
staticprivate |
Definition at line 213 of file null-message-mpi-interface.h.
Referenced by Disable(), Enable(), and IsEnabled().
|
staticprivate |
Definition at line 211 of file null-message-mpi-interface.h.
Referenced by Disable(), InitializeSendReceiveBuffers(), and ReceiveMessages().
|
staticprivate |
Definition at line 223 of file null-message-mpi-interface.h.
Referenced by Disable(), SendNullMessage(), SendPacket(), and TestSendComplete().
|
staticprivate |
Definition at line 220 of file null-message-mpi-interface.h.
Referenced by Disable(), InitializeSendReceiveBuffers(), and ReceiveMessages().
|
staticprivate |
Definition at line 217 of file null-message-mpi-interface.h.
Referenced by Disable(), InitializeSendReceiveBuffers(), and ReceiveMessages().
|
staticprivate |
Definition at line 205 of file null-message-mpi-interface.h.
Referenced by Enable(), and GetSystemId().
|
staticprivate |
Definition at line 208 of file null-message-mpi-interface.h.
Referenced by Enable(), GetSize(), and InitializeSendReceiveBuffers().