A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::ParallelCommunicationInterface Class Referenceabstract

Pure virtual base class for the interface between ns-3 and the parallel communication layer being used. More...

#include "parallel-communication-interface.h"

+ Inheritance diagram for ns3::ParallelCommunicationInterface:

Public Member Functions

virtual ~ParallelCommunicationInterface ()
 Destructor.
 
virtual void Destroy ()=0
 Deletes storage used by the parallel environment.
 
virtual void Disable ()=0
 Clean up the ns-3 parallel communications interface.
 
virtual void Enable (int *pargc, char ***pargv)=0
 Setup the parallel communication interface.
 
virtual void Enable (MPI_Comm communicator)=0
 Setup the parallel communication interface using the specified communicator.
 
virtual MPI_Comm GetCommunicator ()=0
 Return the communicator used to run ns-3.
 
virtual uint32_t GetSize ()=0
 Get the number of ranks used by ns-3.
 
virtual uint32_t GetSystemId ()=0
 Get the id number of this rank.
 
virtual bool IsEnabled ()=0
 Returns enabled state of parallel environment.
 
virtual void SendPacket (Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)=0
 Send a packet to a remote node.
 

Detailed Description

Pure virtual base class for the interface between ns-3 and the parallel communication layer being used.

This class is implemented for each of the parallel versions of SimulatorImpl to manage communication between process (ranks).

This interface is called through the singleton MpiInterface class. MpiInterface has the same API as ParallelCommunicationInterface but being a singleton uses static methods to delegate to methods defined in classes that implement the ParallelCommunicationInterface. For example, SendPacket is likely to be specialized for a specific parallel SimulatorImpl.

Definition at line 58 of file parallel-communication-interface.h.

Constructor & Destructor Documentation

◆ ~ParallelCommunicationInterface()

virtual ns3::ParallelCommunicationInterface::~ParallelCommunicationInterface ( )
inlinevirtual

Destructor.

Definition at line 64 of file parallel-communication-interface.h.

Member Function Documentation

◆ Destroy()

virtual void ns3::ParallelCommunicationInterface::Destroy ( )
pure virtual

Deletes storage used by the parallel environment.

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::Destroy().

+ Here is the caller graph for this function:

◆ Disable()

virtual void ns3::ParallelCommunicationInterface::Disable ( )
pure virtual

Clean up the ns-3 parallel communications interface.

MPI_Finalize will be called only if Enable (int* pargc, char*** pargv) was called.

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::Disable().

+ Here is the caller graph for this function:

◆ Enable() [1/2]

virtual void ns3::ParallelCommunicationInterface::Enable ( int *  pargc,
char ***  pargv 
)
pure virtual

Setup the parallel communication interface.

There are two ways to setup the communications interface. This Enable method is the easiest method and should be used in most situations.

Disable() must be invoked at end of an ns-3 application to properly cleanup the parallel communication interface.

This method will call MPI_Init and configure ns-3 to use the MPI_COMM_WORLD communicator.

For more complex situations, such as embedding ns-3 with other MPI simulators or libraries, the Enable(MPI_Comm communcicator) may be used if MPI is initialized externally or if ns-3 needs to be run unique communicator. For example if there are two parallel simulators and the goal is to run each simulator on a different set of ranks.

Note
The `SimulatorImplementationType attribute in ns3::GlobalValues must be set before calling Enable()
Parameters
pargcnumber of command line arguments
pargvcommand line arguments

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::Enable().

+ Here is the caller graph for this function:

◆ Enable() [2/2]

virtual void ns3::ParallelCommunicationInterface::Enable ( MPI_Comm  communicator)
pure virtual

Setup the parallel communication interface using the specified communicator.

See Enable (int* pargc, char*** pargv) for additional information.

Parameters
communicatorMPI Communicator that should be used by ns-3

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

◆ GetCommunicator()

virtual MPI_Comm ns3::ParallelCommunicationInterface::GetCommunicator ( )
pure virtual

Return the communicator used to run ns-3.

The communicator returned will be MPI_COMM_WORLD if Enable (int* pargc, char*** pargv) is used to enable or the user specified communicator if Enable (MPI_Comm communicator) is used.

Returns
The MPI Communicator.

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::GetCommunicator().

+ Here is the caller graph for this function:

◆ GetSize()

virtual uint32_t ns3::ParallelCommunicationInterface::GetSize ( )
pure virtual

Get the number of ranks used by ns-3.

Returns the size (number of MPI ranks) of the communicator used by ns-3. When running a sequential simulation this will return a size of 1.

Returns
number of parallel tasks

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::GetSize().

+ Here is the caller graph for this function:

◆ GetSystemId()

virtual uint32_t ns3::ParallelCommunicationInterface::GetSystemId ( )
pure virtual

Get the id number of this rank.

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

Returns
system identification

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::GetSystemId().

+ Here is the caller graph for this function:

◆ IsEnabled()

virtual bool ns3::ParallelCommunicationInterface::IsEnabled ( )
pure virtual

Returns enabled state of parallel environment.

Returns
true if parallel communication is enabled

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::IsEnabled().

+ Here is the caller graph for this function:

◆ SendPacket()

virtual void ns3::ParallelCommunicationInterface::SendPacket ( Ptr< Packet p,
const Time rxTime,
uint32_t  node,
uint32_t  dev 
)
pure virtual

Send a packet to a remote node.

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

Implemented in ns3::GrantedTimeWindowMpiInterface, and ns3::NullMessageMpiInterface.

Referenced by ns3::MpiInterface::SendPacket().

+ Here is the caller graph for this function:

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