22 #include "ns3/simulator.h"
23 #include "ns3/scheduler.h"
24 #include "ns3/event-impl.h"
25 #include "ns3/channel.h"
26 #include "ns3/node-container.h"
28 #include "ns3/pointer.h"
29 #include "ns3/assert.h"
82 static TypeId tid =
TypeId (
"ns3::DistributedSimulatorImpl")
84 .AddConstructor<DistributedSimulatorImpl> ()
100 NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
142 if (!ev->IsCancelled ())
174 for (uint32_t i = 0; i < (*iter)->GetNDevices (); ++i)
178 if (!localNetDevice->IsPointToPoint ())
190 if (channel->GetDevice (0) == localNetDevice)
192 remoteNode = (channel->GetDevice (1))->GetNode ();
196 remoteNode = (channel->GetDevice (0))->GetNode ();
209 channel->GetAttribute (
"Delay", delay);
248 MPI_Allreduce (&sendbuf, &recvbuf, 1, MPI_LONG, MPI_MAX, MPI_COMM_WORLD);
263 NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
277 scheduler->Insert (next);
370 if (
m_pLBTS[i].GetSmallestTime () < smallestTime)
407 NS_FATAL_ERROR (
"Can't use distributed simulator without MPI compiled in");
457 ev.key.m_context = context;
458 ev.key.m_uid =
m_uid;
509 if (
id.GetUid () == 2)
527 event.
impl =
id.PeekEventImpl ();
528 event.key.m_ts =
id.GetTs ();
529 event.key.m_context =
id.GetContext ();
530 event.key.m_uid =
id.GetUid ();
532 event.impl->Cancel ();
534 event.impl->Unref ();
544 id.PeekEventImpl ()->Cancel ();
587 return TimeStep (0x7fffffffffffffffLL);
keep track of time values and allow control of global simulation resolution
~DistributedSimulatorImpl()
smart pointer class similar to boost::intrusive_ptr
bool IsPositive(void) const
#define NS_LOG_FUNCTION(parameters)
virtual void SetScheduler(ObjectFactory schedulerFactory)
Ptr< Scheduler > m_events
std::vector< Ptr< Node > >::const_iterator Iterator
Time TimeStep(uint64_t ts)
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual EventId ScheduleDestroy(EventImpl *event)
virtual Time GetMaximumSimulationTime(void) const
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
virtual void DoDispose(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
EventImpl * PeekEventImpl(void) const
uint32_t GetSystemId(void) const
virtual Time Now(void) const
#define NS_FATAL_ERROR(msg)
fatal error handling
virtual void DoDispose(void)
double GetSeconds(void) const
static uint32_t GetTxCount()
virtual Time GetDelayLeft(const EventId &id) const
void ProcessOneEvent(void)
uint32_t m_currentContext
hold objects of type ns3::Time
Ptr< Object > Create(void) const
DistributedSimulatorImpl()
virtual EventId ScheduleNow(EventImpl *event)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
static uint32_t GetRxCount()
uint32_t GetUid(void) const
DestroyEvents m_destroyEvents
static void ReceiveMessages()
static void TestSendComplete()
#define NS_LOG_LOGIC(msg)
virtual void Remove(const EventId &ev)
static TypeId GetTypeId(void)
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
virtual void ScheduleWithContext(uint32_t context, Time const &time, EventImpl *event)
int64_t GetTimeStep(void) const
uint64_t NextTs(void) const
int64_t GetInteger(void) const
virtual uint32_t GetSystemId(void) const
virtual uint32_t GetContext(void) const
Structure used for all-reduce LBTS computation.
static NodeContainer GetGlobal(void)
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
void CalculateLookAhead(void)
virtual void Cancel(const EventId &ev)
instantiate subclasses of ns3::Object.
virtual EventId Schedule(Time const &time, EventImpl *event)
an identifier for simulation events.
static uint32_t GetSystemId()
a base class which provides memory management and object aggregation
bool IsLocalFinished(void) const
virtual bool IsFinished(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
static uint32_t GetSize()
uint64_t GetTs(void) const
virtual bool IsExpired(const EventId &ev) const