LEFT | RIGHT |
(no file at all) | |
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 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool GrantedTimeWindowMpiInterface::m_enabled = false; | 81 bool GrantedTimeWindowMpiInterface::m_enabled = false; |
82 uint32_t GrantedTimeWindowMpiInterface::m_rxCount = 0; | 82 uint32_t GrantedTimeWindowMpiInterface::m_rxCount = 0; |
83 uint32_t GrantedTimeWindowMpiInterface::m_txCount = 0; | 83 uint32_t GrantedTimeWindowMpiInterface::m_txCount = 0; |
84 std::list<SentBuffer> GrantedTimeWindowMpiInterface::m_pendingTx; | 84 std::list<SentBuffer> GrantedTimeWindowMpiInterface::m_pendingTx; |
85 | 85 |
86 #ifdef NS3_MPI | 86 #ifdef NS3_MPI |
87 MPI_Request* GrantedTimeWindowMpiInterface::m_requests; | 87 MPI_Request* GrantedTimeWindowMpiInterface::m_requests; |
88 char** GrantedTimeWindowMpiInterface::m_pRxBuffers; | 88 char** GrantedTimeWindowMpiInterface::m_pRxBuffers; |
89 #endif | 89 #endif |
90 | 90 |
91 TypeId | 91 TypeId |
92 GrantedTimeWindowMpiInterface::GetTypeId (void) | 92 GrantedTimeWindowMpiInterface::GetTypeId (void) |
93 { | 93 { |
94 static TypeId tid = TypeId ("ns3::GrantedTimeWindowMpiInterface") | 94 static TypeId tid = TypeId ("ns3::GrantedTimeWindowMpiInterface") |
95 .SetParent<Object> () | 95 .SetParent<Object> () |
96 .SetGroupName ("Mpi") | 96 .SetGroupName ("Mpi") |
97 ; | 97 ; |
98 return tid; | 98 return tid; |
99 } | 99 } |
100 | 100 |
101 void | 101 void |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 { | 156 { |
157 Simulator::GetImplementation (); | 157 Simulator::GetImplementation (); |
158 m_initialized = true; | 158 m_initialized = true; |
159 } | 159 } |
160 return m_enabled; | 160 return m_enabled; |
161 } | 161 } |
162 | 162 |
163 void | 163 void |
164 GrantedTimeWindowMpiInterface::Enable (int* pargc, char*** pargv) | 164 GrantedTimeWindowMpiInterface::Enable (int* pargc, char*** pargv) |
165 { | 165 { |
166 NS_LOG_FUNCTION (this << pargc << pargv); | 166 NS_LOG_FUNCTION (this << pargc << pargv); |
167 | 167 |
168 #ifdef NS3_MPI | 168 #ifdef NS3_MPI |
169 // Initialize the MPI interface | 169 // Initialize the MPI interface |
170 MPI_Init (pargc, pargv); | 170 MPI_Init (pargc, pargv); |
171 MPI_Barrier (MPI_COMM_WORLD); | 171 MPI_Barrier (MPI_COMM_WORLD); |
172 MPI_Comm_rank (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_sid)); | 172 MPI_Comm_rank (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_sid)); |
173 MPI_Comm_size (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_size)); | 173 MPI_Comm_size (MPI_COMM_WORLD, reinterpret_cast <int *> (&m_size)); |
174 m_enabled = true; | 174 m_enabled = true; |
175 m_initialized = true; | 175 m_initialized = true; |
176 // Post a non-blocking receive for all peers | 176 // Post a non-blocking receive for all peers |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 MPI_Isend (reinterpret_cast<void *> (i->GetBuffer ()), serializedSize + 16, MP
I_CHAR, nodeSysId, | 217 MPI_Isend (reinterpret_cast<void *> (i->GetBuffer ()), serializedSize + 16, MP
I_CHAR, nodeSysId, |
218 0, MPI_COMM_WORLD, (i->GetRequest ())); | 218 0, MPI_COMM_WORLD, (i->GetRequest ())); |
219 m_txCount++; | 219 m_txCount++; |
220 #else | 220 #else |
221 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); | 221 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); |
222 #endif | 222 #endif |
223 } | 223 } |
224 | 224 |
225 void | 225 void |
226 GrantedTimeWindowMpiInterface::ReceiveMessages () | 226 GrantedTimeWindowMpiInterface::ReceiveMessages () |
227 { | 227 { |
228 NS_LOG_FUNCTION_NOARGS (); | 228 NS_LOG_FUNCTION_NOARGS (); |
229 | 229 |
230 #ifdef NS3_MPI | 230 #ifdef NS3_MPI |
231 // Poll the non-block reads to see if data arrived | 231 // Poll the non-block reads to see if data arrived |
232 while (true) | 232 while (true) |
233 { | 233 { |
234 int flag = 0; | 234 int flag = 0; |
235 int index = 0; | 235 int index = 0; |
236 MPI_Status status; | 236 MPI_Status status; |
237 | 237 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 { | 328 { |
329 NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it fi
rst"); | 329 NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it fi
rst"); |
330 } | 330 } |
331 #else | 331 #else |
332 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); | 332 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); |
333 #endif | 333 #endif |
334 } | 334 } |
335 | 335 |
336 | 336 |
337 } // namespace ns3 | 337 } // namespace ns3 |
LEFT | RIGHT |