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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Steven Smith <smith84@llnl.gov>
7
*
8
*/
9
10
/**
11
* @file
12
* @ingroup mpi
13
* Implementation of class ns3::RemoteChannelBundleManager.
14
*/
15
16
#include "
remote-channel-bundle-manager.h
"
17
18
#include "
null-message-simulator-impl.h
"
19
#include "
remote-channel-bundle.h
"
20
21
#include "ns3/simulator.h"
22
23
namespace
ns3
24
{
25
26
bool
ns3::RemoteChannelBundleManager::g_initialized
=
false
;
27
ns3::RemoteChannelBundleManager::RemoteChannelMap
28
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
;
29
30
Ptr<RemoteChannelBundle>
31
RemoteChannelBundleManager::Find
(
uint32_t
systemId)
32
{
33
auto
kv =
g_remoteChannelBundles
.find(systemId);
34
35
if
(kv ==
g_remoteChannelBundles
.end())
36
{
37
return
nullptr
;
38
}
39
else
40
{
41
return
kv->second;
42
}
43
}
44
45
Ptr<RemoteChannelBundle>
46
RemoteChannelBundleManager::Add
(
uint32_t
systemId)
47
{
48
NS_ASSERT
(!
g_initialized
);
49
NS_ASSERT
(
g_remoteChannelBundles
.find(systemId) ==
g_remoteChannelBundles
.end());
50
51
Ptr<RemoteChannelBundle>
remoteChannelBundle =
Create<RemoteChannelBundle>
(systemId);
52
53
g_remoteChannelBundles
[systemId] = remoteChannelBundle;
54
55
return
remoteChannelBundle;
56
}
57
58
std::size_t
59
RemoteChannelBundleManager::Size
()
60
{
61
return
g_remoteChannelBundles
.size();
62
}
63
64
void
65
RemoteChannelBundleManager::InitializeNullMessageEvents
()
66
{
67
NS_ASSERT
(!
g_initialized
);
68
69
for
(
auto
iter =
g_remoteChannelBundles
.begin(); iter !=
g_remoteChannelBundles
.end(); ++iter)
70
{
71
Ptr<RemoteChannelBundle>
bundle = iter->second;
72
bundle->Send(bundle->GetDelay());
73
74
NullMessageSimulatorImpl::GetInstance
()->
ScheduleNullMessageEvent
(bundle);
75
}
76
77
g_initialized
=
true
;
78
}
79
80
Time
81
RemoteChannelBundleManager::GetSafeTime
()
82
{
83
NS_ASSERT
(
g_initialized
);
84
85
Time
safeTime =
Simulator::GetMaximumSimulationTime
();
86
87
for
(
auto
kv =
g_remoteChannelBundles
.begin(); kv !=
g_remoteChannelBundles
.end(); ++kv)
88
{
89
safeTime =
Min
(safeTime, kv->second->GetGuaranteeTime());
90
}
91
92
return
safeTime;
93
}
94
95
void
96
RemoteChannelBundleManager::Destroy
()
97
{
98
NS_ASSERT
(
g_initialized
);
99
100
g_remoteChannelBundles
.clear();
101
g_initialized
=
false
;
102
}
103
104
}
// namespace ns3
Min
#define Min(a, b)
Definition
aarf-wifi-manager.cc:14
ns3::NullMessageSimulatorImpl::GetInstance
static NullMessageSimulatorImpl * GetInstance()
Definition
null-message-simulator-impl.cc:569
ns3::NullMessageSimulatorImpl::ScheduleNullMessageEvent
void ScheduleNullMessageEvent(Ptr< RemoteChannelBundle > bundle)
Definition
null-message-simulator-impl.cc:253
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::RemoteChannelBundleManager::GetSafeTime
static Time GetSafeTime()
Get the safe time across all channels in this bundle.
Definition
remote-channel-bundle-manager.cc:81
ns3::RemoteChannelBundleManager::Find
static Ptr< RemoteChannelBundle > Find(uint32_t systemId)
Get the bundle corresponding to a remote rank.
Definition
remote-channel-bundle-manager.cc:31
ns3::RemoteChannelBundleManager::InitializeNullMessageEvents
static void InitializeNullMessageEvents()
Setup initial Null Message events for every RemoteChannelBundle.
Definition
remote-channel-bundle-manager.cc:65
ns3::RemoteChannelBundleManager::g_remoteChannelBundles
static RemoteChannelMap g_remoteChannelBundles
The remote channel bundles.
Definition
remote-channel-bundle-manager.h:99
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:46
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:97
ns3::RemoteChannelBundleManager::Size
static std::size_t Size()
Get the number of ns-3 channels in this bundle.
Definition
remote-channel-bundle-manager.cc:59
ns3::RemoteChannelBundleManager::Destroy
static void Destroy()
Destroy the singleton.
Definition
remote-channel-bundle-manager.cc:96
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:105
ns3::Simulator::GetMaximumSimulationTime
static Time GetMaximumSimulationTime()
Get the maximum representable simulation time.
Definition
simulator.cc:300
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
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:55
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
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 Dec 1 2024 18:20:44 for ns-3 by
1.11.0