OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright 2013. Lawrence Livermore National Security, LLC. | 3 * Copyright 2013. Lawrence Livermore National Security, LLC. |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 27 matching lines...) Expand all Loading... |
38 class RemoteChannelBundle; | 38 class RemoteChannelBundle; |
39 | 39 |
40 /** | 40 /** |
41 * \ingroup mpi | 41 * \ingroup mpi |
42 * | 42 * |
43 * \brief Simulator implementation using MPI and a Null Message algorithm. | 43 * \brief Simulator implementation using MPI and a Null Message algorithm. |
44 */ | 44 */ |
45 class NullMessageSimulatorImpl : public SimulatorImpl | 45 class NullMessageSimulatorImpl : public SimulatorImpl |
46 { | 46 { |
47 public: | 47 public: |
| 48 /** |
| 49 * \brief Get the type ID. |
| 50 * \return the object TypeId |
| 51 */ |
48 static TypeId GetTypeId (void); | 52 static TypeId GetTypeId (void); |
49 | 53 |
50 NullMessageSimulatorImpl (); | 54 NullMessageSimulatorImpl (); |
51 | 55 |
52 ~NullMessageSimulatorImpl (); | 56 ~NullMessageSimulatorImpl (); |
53 | 57 |
54 // virtual from SimulatorImpl | 58 // virtual from SimulatorImpl |
55 virtual void Destroy (); | 59 virtual void Destroy (); |
56 virtual bool IsFinished (void) const; | 60 virtual bool IsFinished (void) const; |
57 virtual void Stop (void); | 61 virtual void Stop (void); |
58 virtual void Stop (Time const &delay); | 62 virtual void Stop (Time const &delay); |
59 virtual EventId Schedule (Time const &delay, EventImpl *event); | 63 virtual EventId Schedule (Time const &delay, EventImpl *event); |
60 virtual void ScheduleWithContext (uint32_t context, Time const &delay, EventIm
pl *event); | 64 virtual void ScheduleWithContext (uint32_t context, Time const &delay, EventIm
pl *event); |
61 virtual EventId ScheduleNow (EventImpl *event); | 65 virtual EventId ScheduleNow (EventImpl *event); |
62 virtual EventId ScheduleDestroy (EventImpl *event); | 66 virtual EventId ScheduleDestroy (EventImpl *event); |
63 virtual void Remove (const EventId &id); | 67 virtual void Remove (const EventId &id); |
64 virtual void Cancel (const EventId &id); | 68 virtual void Cancel (const EventId &id); |
65 virtual bool IsExpired (const EventId &id) const; | 69 virtual bool IsExpired (const EventId &id) const; |
66 virtual void Run (void); | 70 virtual void Run (void); |
| 71 /// Run one event function |
67 virtual void RunOneEvent (void); | 72 virtual void RunOneEvent (void); |
68 virtual Time Now (void) const; | 73 virtual Time Now (void) const; |
69 virtual Time GetDelayLeft (const EventId &id) const; | 74 virtual Time GetDelayLeft (const EventId &id) const; |
70 virtual Time GetMaximumSimulationTime (void) const; | 75 virtual Time GetMaximumSimulationTime (void) const; |
71 virtual void SetScheduler (ObjectFactory schedulerFactory); | 76 virtual void SetScheduler (ObjectFactory schedulerFactory); |
72 virtual uint32_t GetSystemId (void) const; | 77 virtual uint32_t GetSystemId (void) const; |
73 virtual uint32_t GetContext (void) const; | 78 virtual uint32_t GetContext (void) const; |
74 | 79 |
75 /** | 80 /** |
76 * \return singleton instance | 81 * \return singleton instance |
77 * | 82 * |
78 * Singleton accessor. | 83 * Singleton accessor. |
79 */ | 84 */ |
80 static NullMessageSimulatorImpl * GetInstance (void); | 85 static NullMessageSimulatorImpl * GetInstance (void); |
81 | 86 |
82 private: | 87 private: |
| 88 /// allow NullMessageEvent class friend access |
83 friend class NullMessageEvent; | 89 friend class NullMessageEvent; |
| 90 /// allow NullMessageMpiInterface class friend access |
84 friend class NullMessageMpiInterface; | 91 friend class NullMessageMpiInterface; |
| 92 /// allow RemoteChannelBundleManager class friend access |
85 friend class RemoteChannelBundleManager; | 93 friend class RemoteChannelBundleManager; |
86 | 94 |
87 /** | 95 /** |
88 * Non blocking receive of pending messages. | 96 * Non blocking receive of pending messages. |
89 */ | 97 */ |
90 void HandleArrivingMessagesNonBlocking (void); | 98 void HandleArrivingMessagesNonBlocking (void); |
91 | 99 |
92 /** | 100 /** |
93 * Blocking receive of arriving messages. | 101 * Blocking receive of arriving messages. |
94 */ | 102 */ |
95 void HandleArrivingMessagesBlocking (void); | 103 void HandleArrivingMessagesBlocking (void); |
96 | 104 |
97 virtual void DoDispose (void); | 105 virtual void DoDispose (void); |
98 | 106 |
(...skipping 15 matching lines...) Expand all Loading... |
114 | 122 |
115 /** | 123 /** |
116 * Calculate the SafeTime. Should be called after message receives. | 124 * Calculate the SafeTime. Should be called after message receives. |
117 */ | 125 */ |
118 void CalculateSafeTime (void); | 126 void CalculateSafeTime (void); |
119 | 127 |
120 /** | 128 /** |
121 * Get the current SafeTime; the maximum time that events can | 129 * Get the current SafeTime; the maximum time that events can |
122 * be processed based on information received from neighboring | 130 * be processed based on information received from neighboring |
123 * MPI tasks. | 131 * MPI tasks. |
| 132 * \returns the time |
124 */ | 133 */ |
125 Time GetSafeTime (void); | 134 Time GetSafeTime (void); |
126 | 135 |
127 /** | 136 /** |
128 * \param bundle Bundle to schedule Null Message event for | 137 * \param bundle Bundle to schedule Null Message event for |
129 * | 138 * |
130 * Schedule Null Message event for the specified RemoteChannelBundle. | 139 * Schedule Null Message event for the specified RemoteChannelBundle. |
131 */ | 140 */ |
132 void ScheduleNullMessageEvent (Ptr<RemoteChannelBundle> bundle); | 141 void ScheduleNullMessageEvent (Ptr<RemoteChannelBundle> bundle); |
133 | 142 |
(...skipping 24 matching lines...) Expand all Loading... |
158 */ | 167 */ |
159 Time CalculateGuaranteeTime (uint32_t systemId); | 168 Time CalculateGuaranteeTime (uint32_t systemId); |
160 | 169 |
161 /** | 170 /** |
162 * \param bundle remote channel bundle to schedule an event for. | 171 * \param bundle remote channel bundle to schedule an event for. |
163 * | 172 * |
164 * Null message event handler. Scheduled to send a null message | 173 * Null message event handler. Scheduled to send a null message |
165 * for the specified bundle at regular intervals. Will canceled | 174 * for the specified bundle at regular intervals. Will canceled |
166 * and rescheduled when packets are sent. | 175 * and rescheduled when packets are sent. |
167 */ | 176 */ |
168 void NullMessageEventHandler(RemoteChannelBundle* bundle); | 177 void NullMessageEventHandler (RemoteChannelBundle* bundle); |
169 | 178 |
170 typedef std::list<EventId> DestroyEvents; | 179 typedef std::list<EventId> DestroyEvents; ///< DestroyEvents typedef |
171 | 180 |
172 DestroyEvents m_destroyEvents; | 181 DestroyEvents m_destroyEvents; ///< destroy events |
173 bool m_stop; | 182 bool m_stop; ///< stop? |
174 Ptr<Scheduler> m_events; | 183 Ptr<Scheduler> m_events; ///< events |
175 uint32_t m_uid; | 184 uint32_t m_uid; ///< UID |
176 uint32_t m_currentUid; | 185 uint32_t m_currentUid; ///< current UID |
177 uint64_t m_currentTs; | 186 uint64_t m_currentTs; ///< current timestamp |
178 uint32_t m_currentContext; | 187 uint32_t m_currentContext; ///< current context |
179 // number of events that have been inserted but not yet scheduled, | 188 // number of events that have been inserted but not yet scheduled, |
180 // not counting the "destroy" events; this is used for validation | 189 // not counting the "destroy" events; this is used for validation |
181 int m_unscheduledEvents; | 190 int m_unscheduledEvents; ///< unscheduled events |
182 | 191 |
183 uint32_t m_myId; // MPI Rank | 192 uint32_t m_myId; ///< MPI Rank |
184 uint32_t m_systemCount; // MPI Size | 193 uint32_t m_systemCount; ///< MPI Size |
185 | 194 |
186 /* | 195 /** |
187 * The time for which it is safe for this task to execute events | 196 * The time for which it is safe for this task to execute events |
188 * without danger of out-of-order events. | 197 * without danger of out-of-order events. |
189 */ | 198 */ |
190 Time m_safeTime; | 199 Time m_safeTime; |
191 | 200 |
192 /* | 201 /** |
193 * Null Message performance tuning parameter. Controls when Null | 202 * Null Message performance tuning parameter. Controls when Null |
194 * messages are sent. When value is 1 the minimum number of Null | 203 * messages are sent. When value is 1 the minimum number of Null |
195 * messages are sent conserving bandwidth. The delay in arrival of | 204 * messages are sent conserving bandwidth. The delay in arrival of |
196 * lookahead information is the greatest resulting in maximum | 205 * lookahead information is the greatest resulting in maximum |
197 * unnecessary blocking of the receiver. When the value is near 0 | 206 * unnecessary blocking of the receiver. When the value is near 0 |
198 * Null Messages are sent with high frequency, costing more | 207 * Null Messages are sent with high frequency, costing more |
199 * bandwidth and Null Message processing time, but there is minimum | 208 * bandwidth and Null Message processing time, but there is minimum |
200 * unnecessary block of the receiver. | 209 * unnecessary block of the receiver. |
201 */ | 210 */ |
202 double m_schedulerTune; | 211 double m_schedulerTune; |
203 | 212 |
204 /* | 213 /** |
205 * Singleton instance. | 214 * Singleton instance. |
206 */ | 215 */ |
207 static NullMessageSimulatorImpl* g_instance; | 216 static NullMessageSimulatorImpl* g_instance; |
208 }; | 217 }; |
209 | 218 |
210 } // namespace ns3 | 219 } // namespace ns3 |
211 | 220 |
212 #endif /* NULLMESSAGE_SIMULATOR_IMPL_H */ | 221 #endif /* NULLMESSAGE_SIMULATOR_IMPL_H */ |
OLD | NEW |