A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
remote-channel-bundle.cc
Go to the documentation of this file.
1/*
2 * Copyright 2013. Lawrence Livermore National Security, LLC.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Steven Smith <smith84@llnl.gov>
18 *
19 */
20
28
31
32#include <ns3/simulator.h>
33
34namespace ns3
35{
36
37TypeId
39{
40 static TypeId tid = TypeId("ns3::RemoteChannelBundle")
42 .SetGroupName("Mpi")
43 .AddConstructor<RemoteChannelBundle>();
44 return tid;
45}
46
48 : m_remoteSystemId(UINT32_MAX),
49 m_guaranteeTime(0),
50 m_delay(Time::Max())
51{
52}
53
55 : m_remoteSystemId(remoteSystemId),
56 m_guaranteeTime(0),
57 m_delay(Time::Max())
58{
59}
60
61void
63{
64 m_channels[channel->GetId()] = channel;
65 m_delay = ns3::Min(m_delay, delay);
66}
67
70{
71 return m_remoteSystemId;
72}
73
74Time
76{
77 return m_guaranteeTime;
78}
79
80void
82{
83 NS_ASSERT(time >= Simulator::Now());
84
85 m_guaranteeTime = time;
86}
87
88Time
90{
91 return m_delay;
92}
93
94void
96{
97 m_nullEventId = id;
98}
99
102{
103 return m_nullEventId;
104}
105
106std::size_t
108{
109 return m_channels.size();
110}
111
112void
114{
116}
117
118std::ostream&
119operator<<(std::ostream& out, ns3::RemoteChannelBundle& bundle)
120{
121 out << "RemoteChannelBundle Rank = " << bundle.m_remoteSystemId
122 << ", GuaranteeTime = " << bundle.m_guaranteeTime << ", Delay = " << bundle.m_delay
123 << std::endl;
124
125 for (const auto& element : bundle.m_channels)
126 {
127 out << "\t" << element.second << std::endl;
128 }
129
130 return out;
131}
132
133} // namespace ns3
#define Max(a, b)
An identifier for simulation events.
Definition: event-id.h:55
static void SendNullMessage(const Time &guaranteeUpdate, Ptr< RemoteChannelBundle > bundle)
Send a Null Message to across the specified bundle.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Collection of ns-3 channels between local and remote nodes.
Time m_delay
Delay for this Channel bundle, which is the min link delay over all incoming channels;.
std::size_t GetSize() const
Get the number of ns-3 channels in this bundle.
Time GetDelay() const
Get the minimum delay along any channel in this bundle.
void SetGuaranteeTime(Time time)
Set the guarantee time for the bundle.
Time GetGuaranteeTime() const
Get the current guarantee time for this bundle.
RemoteChannelBundle()
Default constructor.
void SetEventId(EventId id)
Set the event ID of the Null Message send event currently scheduled for this channel.
void Send(Time time)
Send Null Message to the remote task associated with this bundle.
ChannelMap m_channels
ChannelId to Channel map.
Time m_guaranteeTime
Guarantee time for the incoming Channels from MPI task remote_rank.
uint32_t m_remoteSystemId
Remote rank.
void AddChannel(Ptr< Channel > channel, Time delay)
Add a channel to this bundle.
static TypeId GetTypeId()
Register this type.
EventId GetEventId() const
Get the event ID of the Null Message send event for this bundle.
EventId m_nullEventId
Event scheduled to send Null Message for this bundle.
uint32_t GetSystemId() const
Get the system Id for this side.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:229
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
Declaration of classes ns3::NullMessageSentBuffer and ns3::NullMessageMpiInterface.
Declaration of class ns3::NullMessageSimulatorImpl.
Declaration of class ns3::RemoteChannelBundle.