View | Details | Raw Unified | Return to bug 1087
Collapse All | Expand All

(-)a/src/mpi/examples/nms-p2p-nix-distributed.cc (-1 / +2 lines)
 Lines 601-607    Link Here 
601
  TIMER_NOW (t2);
601
  TIMER_NOW (t2);
602
  cout << "Simulator finished." << endl;
602
  cout << "Simulator finished." << endl;
603
  Simulator::Destroy ();
603
  Simulator::Destroy ();
604
604
  // Exit the MPI execution environment
605
  MpiInterface::Disable ();
605
  double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
606
  double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
606
  cout << "-----" << endl << "Runtime Stats:" << endl;
607
  cout << "-----" << endl << "Runtime Stats:" << endl;
607
  cout << "Simulator init time: " << d1 << endl;
608
  cout << "Simulator init time: " << d1 << endl;
(-)a/src/mpi/examples/simple-distributed.cc (+2 lines)
 Lines 245-250    Link Here 
245
  Simulator::Stop (Seconds (5));
245
  Simulator::Stop (Seconds (5));
246
  Simulator::Run ();
246
  Simulator::Run ();
247
  Simulator::Destroy ();
247
  Simulator::Destroy ();
248
  // Exit the MPI execution environment
249
  MpiInterface::Disable ();
248
  return 0;
250
  return 0;
249
#else
251
#else
250
  NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in");
252
  NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in");
(-)a/src/mpi/examples/third-distributed.cc (+2 lines)
 Lines 239-244    Link Here 
239
239
240
  Simulator::Run ();
240
  Simulator::Run ();
241
  Simulator::Destroy ();
241
  Simulator::Destroy ();
242
  // Exit the MPI execution environment
243
  MpiInterface::Disable ();
242
  return 0;
244
  return 0;
243
245
244
#else
246
#else
(-)a/src/mpi/model/mpi-interface.cc (+22 lines)
 Lines 284-287    Link Here 
284
#endif
284
#endif
285
}
285
}
286
286
287
void 
288
MpiInterface::Disable ()
289
{
290
#ifdef NS3_MPI
291
  int flag = 0 ;
292
  MPI_Initialized (&flag);
293
  if (flag)
294
    {
295
      MPI_Finalize ();
296
      m_enabled = false;
297
      m_initialized = false;
298
    }
299
  else
300
    {
301
      NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it first");
302
    }
303
#else
304
  NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in");
305
#endif
306
}
307
308
287
} // namespace ns3
309
} // namespace ns3
(-)a/src/mpi/model/mpi-interface.h (-1 / +6 lines)
 Lines 97-103    Link Here 
97
   * Sets up MPI interface
97
   * Sets up MPI interface
98
   */
98
   */
99
  static void Enable (int* pargc, char*** pargv);
99
  static void Enable (int* pargc, char*** pargv);
100
100
  /**
101
   * Terminates the MPI environment by calling MPI_Finalize
102
   * This function must be called after Destroy ()
103
   * It also resets m_initialized, m_enabled
104
   */
105
  static void Disable ();
101
  /**
106
  /**
102
   * \param p packet to send
107
   * \param p packet to send
103
   * \param rxTime received time at destination node
108
   * \param rxTime received time at destination node

Return to bug 1087