32 #include "ns3/node-list.h"    33 #include "ns3/net-device.h"    34 #include "ns3/simulator.h"    35 #include "ns3/simulator-impl.h"    36 #include "ns3/nstime.h"    94   static TypeId tid = 
TypeId (
"ns3::GrantedTimeWindowMpiInterface")
   107   for (uint32_t i = 0; i < 
GetSize (); ++i)
   170   MPI_Init (pargc, pargv);
   171   MPI_Barrier (MPI_COMM_WORLD);
   172   MPI_Comm_rank (MPI_COMM_WORLD, reinterpret_cast <int *> (&
m_sid));
   173   MPI_Comm_size (MPI_COMM_WORLD, reinterpret_cast <int *> (&
m_size));
   179   for (uint32_t i = 0; i < 
GetSize (); ++i)
   186   NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
   198   std::list<SentBuffer>::reverse_iterator i = 
m_pendingTx.rbegin (); 
   201   uint8_t* buffer =  
new uint8_t[serializedSize + 16];
   202   i->SetBuffer (buffer);
   205   uint64_t* pTime = reinterpret_cast <uint64_t *> (buffer);
   207   uint32_t* pData = 
reinterpret_cast<uint32_t *
> (pTime);
   211   p->
Serialize (reinterpret_cast<uint8_t *> (pData), serializedSize);
   217   MPI_Isend (reinterpret_cast<void *> (i->GetBuffer ()), serializedSize + 16, MPI_CHAR, nodeSysId,
   218              0, MPI_COMM_WORLD, (i->GetRequest ()));
   221   NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
   244       MPI_Get_count (&status, MPI_CHAR, &count);
   248       uint64_t* pTime = 
reinterpret_cast<uint64_t *
> (
m_pRxBuffers[index]);
   249       uint64_t time = *pTime++;
   250       uint32_t* pData = 
reinterpret_cast<uint32_t *
> (pTime);
   251       uint32_t node = *pData++;
   252       uint32_t dev  = *pData++;
   256       count -= 
sizeof (time) + 
sizeof (node) + 
sizeof (dev);
   258       Ptr<Packet> p = Create<Packet> (
reinterpret_cast<uint8_t *
> (pData), count, 
true);
   264       for (uint32_t i = 0; i < nDevices; ++i)
   267           if (pThisDev->GetIfIndex () == dev)
   285   NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
   295   std::list<SentBuffer>::iterator i = 
m_pendingTx.begin ();
   300       MPI_Test (i->GetRequest (), &flag, &status);
   301       std::list<SentBuffer>::iterator current = i; 
   309   NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
   320   MPI_Initialized (&flag);
   329       NS_FATAL_ERROR (
"Cannot disable MPI environment without Initializing it first");
   332   NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
 Simulation virtual time values and global simulation resolution. 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t GetId(void) const
int64_t GetInteger(void) const
Get the raw time value, in the current resolution unit. 
static Ptr< SimulatorImpl > GetImplementation(void)
Get the SimulatorImpl singleton. 
static Ptr< Node > GetNode(uint32_t n)
static uint32_t GetRxCount()
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node. 
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization. 
static char ** m_pRxBuffers
static TypeId GetTypeId(void)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
static uint32_t GetTxCount()
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
virtual void Enable(int *pargc, char ***pargv)
virtual uint32_t GetSize()
static void TestSendComplete()
Check for completed sends. 
virtual uint32_t GetSystemId()
static std::list< SentBuffer > m_pendingTx
void SetBuffer(uint8_t *buffer)
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method. 
Tracks non-blocking sends. 
Class to aggregate to a NetDevice if it supports MPI capability. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
uint32_t GetSystemId(void) const
static uint32_t m_txCount
static Time Now(void)
Return the current simulation virtual time. 
virtual void Disable()
Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy () ...
virtual void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
static bool m_initialized
MPI_Request * GetRequest()
static void ScheduleWithContext(uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event with the given context. 
static void ReceiveMessages()
Check for received messages complete. 
const uint32_t MAX_MPI_MSG_SIZE
maximum MPI message size for easy buffer creation 
static uint32_t m_rxCount
static MPI_Request * m_requests
A base class which provides memory management and object aggregation. 
a unique identifier for an interface. 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
static uint32_t GetSize()
uint32_t GetNDevices(void) const
uint32_t Serialize(uint8_t *buffer, uint32_t maxSize) const
Serialize a packet, tags, and metadata into a byte buffer. 
virtual void Destroy()
Delete all buffers. 
int64_t GetTimeStep(void) const
Get the raw time value, in the current resolution unit.