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 * 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
17
20
21#include "ns3/simulator.h"
22
23namespace ns3
24{
25
29
30Ptr<RemoteChannelBundle>
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
47{
50
51 Ptr<RemoteChannelBundle> remoteChannelBundle = Create<RemoteChannelBundle>(systemId);
52
53 g_remoteChannelBundles[systemId] = remoteChannelBundle;
54
55 return remoteChannelBundle;
56}
57
58std::size_t
63
64void
66{
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
75 }
76
77 g_initialized = true;
78}
79
80Time
82{
84
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
95void
103
104} // namespace ns3
#define Min(a, b)
static NullMessageSimulatorImpl * GetInstance()
void ScheduleNullMessageEvent(Ptr< RemoteChannelBundle > bundle)
Smart pointer class similar to boost::intrusive_ptr.
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:300
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
#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
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
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.