A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
27
#include "
remote-channel-bundle-manager.h
"
28
29
#include "
null-message-simulator-impl.h
"
30
#include "
remote-channel-bundle.h
"
31
32
#include "ns3/simulator.h"
33
34
namespace
ns3
35
{
36
37
bool
ns3::RemoteChannelBundleManager::g_initialized
=
false
;
38
ns3::RemoteChannelBundleManager::RemoteChannelMap
39
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
;
40
41
Ptr<RemoteChannelBundle>
42
RemoteChannelBundleManager::Find
(
uint32_t
systemId)
43
{
44
ns3::RemoteChannelBundleManager::RemoteChannelMap::iterator kv =
45
g_remoteChannelBundles
.find(systemId);
46
47
if
(kv ==
g_remoteChannelBundles
.end())
48
{
49
return
nullptr
;
50
}
51
else
52
{
53
return
kv->second;
54
}
55
}
56
57
Ptr<RemoteChannelBundle>
58
RemoteChannelBundleManager::Add
(
uint32_t
systemId)
59
{
60
NS_ASSERT
(!
g_initialized
);
61
NS_ASSERT
(
g_remoteChannelBundles
.find(systemId) ==
g_remoteChannelBundles
.end());
62
63
Ptr<RemoteChannelBundle>
remoteChannelBundle = Create<RemoteChannelBundle>(systemId);
64
65
g_remoteChannelBundles
[systemId] = remoteChannelBundle;
66
67
return
remoteChannelBundle;
68
}
69
70
std::size_t
71
RemoteChannelBundleManager::Size
()
72
{
73
return
g_remoteChannelBundles
.size();
74
}
75
76
void
77
RemoteChannelBundleManager::InitializeNullMessageEvents
()
78
{
79
NS_ASSERT
(!
g_initialized
);
80
81
for
(RemoteChannelMap::const_iterator iter =
g_remoteChannelBundles
.begin();
82
iter !=
g_remoteChannelBundles
.end();
83
++iter)
84
{
85
Ptr<RemoteChannelBundle>
bundle = iter->second;
86
bundle->Send(bundle->GetDelay());
87
88
NullMessageSimulatorImpl::GetInstance
()->
ScheduleNullMessageEvent
(bundle);
89
}
90
91
g_initialized
=
true
;
92
}
93
94
Time
95
RemoteChannelBundleManager::GetSafeTime
()
96
{
97
NS_ASSERT
(
g_initialized
);
98
99
Time
safeTime =
Simulator::GetMaximumSimulationTime
();
100
101
for
(RemoteChannelMap::const_iterator kv =
g_remoteChannelBundles
.begin();
102
kv !=
g_remoteChannelBundles
.end();
103
++kv)
104
{
105
safeTime =
Min
(safeTime, kv->second->GetGuaranteeTime());
106
}
107
108
return
safeTime;
109
}
110
111
void
112
RemoteChannelBundleManager::Destroy
()
113
{
114
NS_ASSERT
(
g_initialized
);
115
116
g_remoteChannelBundles
.clear();
117
g_initialized
=
false
;
118
}
119
120
}
// namespace ns3
Min
#define Min(a, b)
Definition:
aarf-wifi-manager.cc:25
ns3::NullMessageSimulatorImpl::GetInstance
static NullMessageSimulatorImpl * GetInstance()
Definition:
null-message-simulator-impl.cc:581
ns3::NullMessageSimulatorImpl::ScheduleNullMessageEvent
void ScheduleNullMessageEvent(Ptr< RemoteChannelBundle > bundle)
Definition:
null-message-simulator-impl.cc:264
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
ns3::RemoteChannelBundleManager::GetSafeTime
static Time GetSafeTime()
Get the safe time across all channels in this bundle.
Definition:
remote-channel-bundle-manager.cc:95
ns3::RemoteChannelBundleManager::Find
static Ptr< RemoteChannelBundle > Find(uint32_t systemId)
Get the bundle corresponding to a remote rank.
Definition:
remote-channel-bundle-manager.cc:42
ns3::RemoteChannelBundleManager::InitializeNullMessageEvents
static void InitializeNullMessageEvents()
Setup initial Null Message events for every RemoteChannelBundle.
Definition:
remote-channel-bundle-manager.cc:77
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
static RemoteChannelMap g_remoteChannelBundles
The remote channel bundles.
Definition:
remote-channel-bundle-manager.h:110
ns3::RemoteChannelBundleManager::Add
static Ptr< RemoteChannelBundle > Add(uint32_t systemId)
Add RemoteChannelBundle from this task to MPI task on other side of the link.
Definition:
remote-channel-bundle-manager.cc:58
ns3::RemoteChannelBundleManager::RemoteChannelMap
std::unordered_map< uint32_t, Ptr< RemoteChannelBundle > > RemoteChannelMap
Container for all remote channel bundles for this task.
Definition:
remote-channel-bundle-manager.h:108
ns3::RemoteChannelBundleManager::Size
static std::size_t Size()
Get the number of ns-3 channels in this bundle.
Definition:
remote-channel-bundle-manager.cc:71
ns3::RemoteChannelBundleManager::Destroy
static void Destroy()
Destroy the singleton.
Definition:
remote-channel-bundle-manager.cc:112
ns3::RemoteChannelBundleManager::g_initialized
static bool g_initialized
Protect manager class from being initialized twice or incorrect ordering of method calls.
Definition:
remote-channel-bundle-manager.h:116
ns3::Simulator::GetMaximumSimulationTime
static Time GetMaximumSimulationTime()
Get the maximum representable simulation time.
Definition:
simulator.cc:302
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
uint32_t
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:66
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
null-message-simulator-impl.h
Declaration of class ns3::NullMessageSimulatorImpl.
remote-channel-bundle-manager.h
Declaration of class ns3::RemoteChannelBundleManager.
remote-channel-bundle.h
Declaration of class ns3::RemoteChannelBundle.
src
mpi
model
remote-channel-bundle-manager.cc
Generated on Sun Jul 2 2023 18:21:56 for ns-3 by
1.9.6