A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
remote-channel-bundle-manager.h
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 * Declaration of class ns3::RemoteChannelBundleManager.
14 */
15
16#ifndef NS3_REMOTE_CHANNEL_BUNDLE_MANAGER
17#define NS3_REMOTE_CHANNEL_BUNDLE_MANAGER
18
19#include <ns3/nstime.h>
20#include <ns3/ptr.h>
21
22#include <unordered_map>
23
24namespace ns3
25{
26
27class RemoteChannelBundle;
28
29/**
30 * \ingroup mpi
31 *
32 * \brief Singleton for managing the RemoteChannelBundles for each process.
33 *
34 * Manages collective tasks associated with the bundle collection.
35 */
37{
38 public:
39 /**
40 * Get the bundle corresponding to a remote rank.
41 *
42 * \param [in] systemId The remote system id.
43 * \return The bundle for the specified system id.
44 */
45 static Ptr<RemoteChannelBundle> Find(uint32_t systemId);
46
47 /**
48 * Add RemoteChannelBundle from this task to MPI task
49 * on other side of the link.
50 * Can not be invoked after InitializeNullMessageEvents has been invoked.
51 *
52 * \param [in] systemId The remote system id.
53 * \return The newly added bundle.
54 */
55 static Ptr<RemoteChannelBundle> Add(uint32_t systemId);
56
57 /**
58 * Get the number of ns-3 channels in this bundle
59 * \return The number of channels.
60 */
61 static std::size_t Size();
62
63 /**
64 * Setup initial Null Message events for every RemoteChannelBundle.
65 * All RemoteChannelBundles should be added before this method is invoked.
66 */
67 static void InitializeNullMessageEvents();
68
69 /**
70 * Get the safe time across all channels in this bundle.
71 * \return The safe time.
72 */
73 static Time GetSafeTime();
74
75 /** Destroy the singleton. */
76 static void Destroy();
77
78 private:
79 /**
80 * Private ctor to prevent creation outside of singleton pattern.
81 */
85
86 /**
87 * Private dtor to prevent destruction outside of singleton pattern.
88 */
92
93 /**
94 * Container for all remote channel bundles for this task.
95 *
96 */
97 typedef std::unordered_map<uint32_t, Ptr<RemoteChannelBundle>> RemoteChannelMap;
98 /** The remote channel bundles. */
100
101 /**
102 * Protect manager class from being initialized twice or incorrect
103 * ordering of method calls.
104 */
105 static bool g_initialized;
106};
107
108} // namespace ns3
109
110#endif
Smart pointer class similar to boost::intrusive_ptr.
Singleton for managing the RemoteChannelBundles for each process.
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.
~RemoteChannelBundleManager()
Private dtor to prevent destruction outside of singleton pattern.
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.
RemoteChannelBundleManager()
Private ctor to prevent creation outside of singleton pattern.
static bool g_initialized
Protect manager class from being initialized twice or incorrect ordering of method calls.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Every class exported by the ns3 library is enclosed in the ns3 namespace.