Pure virtual base class for the interface between ns-3 and the parallel communication layer being used. More...
#include "parallel-communication-interface.h"
Public Member Functions | |
virtual | ~ParallelCommunicationInterface () |
Destructor. More... | |
virtual void | Destroy ()=0 |
Deletes storage used by the parallel environment. More... | |
virtual void | Disable ()=0 |
Clean up the ns-3 parallel communications interface. More... | |
virtual void | Enable (int *pargc, char ***pargv)=0 |
Setup the parallel communication interface. More... | |
virtual void | Enable (MPI_Comm communicator)=0 |
Setup the parallel communication interface using the specified communicator. More... | |
virtual MPI_Comm | GetCommunicator ()=0 |
Return the communicator used to run ns-3. More... | |
virtual uint32_t | GetSize ()=0 |
Get the number of ranks used by ns-3. More... | |
virtual uint32_t | GetSystemId ()=0 |
Get the id number of this rank. More... | |
virtual bool | IsEnabled ()=0 |
Returns enabled state of parallel environment. More... | |
virtual void | SendPacket (Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)=0 |
Send a packet to a remote node. More... | |
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 59 of file parallel-communication-interface.h.
|
inlinevirtual |
Destructor.
Definition at line 65 of file parallel-communication-interface.h.
|
pure virtual |
Deletes storage used by the parallel environment.
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::Destroy().
|
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::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::Disable().
|
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.
pargc | number of command line arguments |
pargv | command line arguments |
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::Enable().
|
pure virtual |
Setup the parallel communication interface using the specified communicator.
See Enable (int* pargc, char*** pargv) for additional information.
communicator | MPI Communicator that should be used by ns-3 |
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
|
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.
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::GetCommunicator().
|
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.
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::GetSize().
|
pure virtual |
Get the id number of this rank.
When running a sequential simulation this will return a systemID of 0.
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::GetSystemId().
|
pure virtual |
Returns enabled state of parallel environment.
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::IsEnabled().
|
pure virtual |
Send a packet to a remote node.
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
Implemented in ns3::NullMessageMpiInterface, and ns3::GrantedTimeWindowMpiInterface.
Referenced by ns3::MpiInterface::SendPacket().