A Discrete-Event Network Simulator
API
ns3::MpiInterface Class Reference

Singleton used to interface to the communications infrastructure when running NS3 in parallel. More...

#include "mpi-interface.h"

+ Collaboration diagram for ns3::MpiInterface:

Static Public Member Functions

static void Destroy ()
 Deletes storage used by the parallel environment. More...
 
static void Disable ()
 Terminates the parallel environment. More...
 
static void Enable (int *pargc, char ***pargv)
 Sets up parallel communication interface. More...
 
static uint32_t GetSize ()
 
static uint32_t GetSystemId ()
 
static bool IsEnabled ()
 
static void SendPacket (Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
 

Static Private Attributes

static ParallelCommunicationInterfaceg_parallelCommunicationInterface = 0
 Static instance of the instantiated parallel controller. More...
 

Detailed Description

Singleton used to interface to the communications infrastructure when running NS3 in parallel.

Delegates the implementation to the specific parallel infrastructure being used. Implementation is defined in the ParallelCommunicationInterface virtual base class; this API mirrors that interface. This singleton is responsible for instantiating an instance of the communication interface based on SimulatorImplementationType attribute in ns3::GlobalValues. The attribute must be set before Enable is invoked.

Definition at line 50 of file mpi-interface.h.

Member Function Documentation

◆ Destroy()

void ns3::MpiInterface::Destroy ( void  )
static

Deletes storage used by the parallel environment.

Definition at line 38 of file mpi-interface.cc.

References ns3::ParallelCommunicationInterface::Destroy(), g_parallelCommunicationInterface, and NS_ASSERT.

Referenced by ns3::NullMessageSimulatorImpl::Destroy(), and ns3::DistributedSimulatorImpl::Destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Disable()

void ns3::MpiInterface::Disable ( )
static

Terminates the parallel environment.

This function must be called after Destroy ()

Definition at line 120 of file mpi-interface.cc.

References ns3::ParallelCommunicationInterface::Disable(), g_parallelCommunicationInterface, and NS_ASSERT.

+ Here is the call graph for this function:

◆ Enable()

void ns3::MpiInterface::Enable ( int *  pargc,
char ***  pargv 
)
static

Sets up parallel communication interface.

Parameters
pargcnumber of command line arguments
pargvcommand line arguments

SimulatorImplementationType attribute in ns3::GlobalValues must be set before Enable is invoked.

Definition at line 76 of file mpi-interface.cc.

References ns3::GlobalValue::Bind(), ns3::ParallelCommunicationInterface::Enable(), g_parallelCommunicationInterface, ns3::StringValue::Get(), ns3::GlobalValue::GetValueByNameFailSafe(), and NS_LOG_WARN.

+ Here is the call graph for this function:

◆ GetSize()

uint32_t ns3::MpiInterface::GetSize ( void  )
static
Returns
number of parallel tasks

When running a sequential simulation this will return a size of 1.

Definition at line 54 of file mpi-interface.cc.

References g_parallelCommunicationInterface, and ns3::ParallelCommunicationInterface::GetSize().

Referenced by ns3::NullMessageSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::DistributedSimulatorImpl(), ns3::NullMessageSimulatorImpl::NullMessageSimulatorImpl(), and ns3::GrantedTimeWindowMpiInterface::ReceiveMessages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSystemId()

uint32_t ns3::MpiInterface::GetSystemId ( void  )
static
Returns
system identification

When running a sequential simulation this will return a systemID of 0.

Definition at line 45 of file mpi-interface.cc.

References g_parallelCommunicationInterface, and ns3::ParallelCommunicationInterface::GetSystemId().

Referenced by ns3::NullMessageSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::CalculateLookAhead(), ns3::DistributedSimulatorImpl::DistributedSimulatorImpl(), ns3::GlobalRouteManagerImpl::InitializeRoutes(), ns3::PointToPointHelper::Install(), and ns3::NullMessageSimulatorImpl::NullMessageSimulatorImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEnabled()

bool ns3::MpiInterface::IsEnabled ( )
static
Returns
true if parallel communication is enabled

Definition at line 63 of file mpi-interface.cc.

References g_parallelCommunicationInterface, and ns3::ParallelCommunicationInterface::IsEnabled().

Referenced by ns3::PointToPointHelper::Install().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPacket()

void ns3::MpiInterface::SendPacket ( Ptr< Packet p,
const Time rxTime,
uint32_t  node,
uint32_t  dev 
)
static
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

Definition at line 112 of file mpi-interface.cc.

References g_parallelCommunicationInterface, NS_ASSERT, and ns3::ParallelCommunicationInterface::SendPacket().

Referenced by ns3::PointToPointRemoteChannel::TransmitStart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ g_parallelCommunicationInterface

ParallelCommunicationInterface * ns3::MpiInterface::g_parallelCommunicationInterface = 0
staticprivate

Static instance of the instantiated parallel controller.

Definition at line 102 of file mpi-interface.h.

Referenced by Destroy(), Disable(), Enable(), GetSize(), GetSystemId(), IsEnabled(), and SendPacket().


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