A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
remote-channel-bundle-manager.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
21/**
22 * \file
23 * \ingroup mpi
24 * Implementation of class ns3::RemoteChannelBundleManager.
25 */
26
28
31
32#include "ns3/simulator.h"
33
34namespace ns3
35{
36
40
41Ptr<RemoteChannelBundle>
43{
44 auto kv = g_remoteChannelBundles.find(systemId);
45
46 if (kv == g_remoteChannelBundles.end())
47 {
48 return nullptr;
49 }
50 else
51 {
52 return kv->second;
53 }
54}
55
58{
61
62 Ptr<RemoteChannelBundle> remoteChannelBundle = Create<RemoteChannelBundle>(systemId);
63
64 g_remoteChannelBundles[systemId] = remoteChannelBundle;
65
66 return remoteChannelBundle;
67}
68
69std::size_t
71{
72 return g_remoteChannelBundles.size();
73}
74
75void
77{
79
80 for (auto iter = g_remoteChannelBundles.begin(); iter != g_remoteChannelBundles.end(); ++iter)
81 {
82 Ptr<RemoteChannelBundle> bundle = iter->second;
83 bundle->Send(bundle->GetDelay());
84
86 }
87
88 g_initialized = true;
89}
90
91Time
93{
95
97
98 for (auto kv = g_remoteChannelBundles.begin(); kv != g_remoteChannelBundles.end(); ++kv)
99 {
100 safeTime = Min(safeTime, kv->second->GetGuaranteeTime());
101 }
102
103 return safeTime;
104}
105
106void
108{
110
112 g_initialized = false;
113}
114
115} // namespace ns3
#define Min(a, b)
static NullMessageSimulatorImpl * GetInstance()
void ScheduleNullMessageEvent(Ptr< RemoteChannelBundle > bundle)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static Time GetSafeTime()
Get the safe time across all channels in this bundle.
static Ptr< RemoteChannelBundle > Find(uint32_t systemId)
Get the bundle corresponding to a remote rank.
static void InitializeNullMessageEvents()
Setup initial Null Message events for every RemoteChannelBundle.
static RemoteChannelMap g_remoteChannelBundles
The remote channel bundles.
static Ptr< RemoteChannelBundle > Add(uint32_t systemId)
Add RemoteChannelBundle from this task to MPI task on other side of the link.
std::unordered_map< uint32_t, Ptr< RemoteChannelBundle > > RemoteChannelMap
Container for all remote channel bundles for this task.
static std::size_t Size()
Get the number of ns-3 channels in this bundle.
static void Destroy()
Destroy the singleton.
static bool g_initialized
Protect manager class from being initialized twice or incorrect ordering of method calls.
static Time GetMaximumSimulationTime()
Get the maximum representable simulation time.
Definition: simulator.cc:311
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of class ns3::NullMessageSimulatorImpl.
Declaration of class ns3::RemoteChannelBundleManager.
Declaration of class ns3::RemoteChannelBundle.