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