Bugzilla – Attachment #1101: patch for bug #1087
TIMER_NOW (t2);
cout << "Simulator finished." << endl;
Simulator::Destroy ();
// Exit the MPI execution environment
MpiInterface::Disable ();
double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1);
cout << "-----" << endl << "Runtime Stats:" << endl;
cout << "Simulator init time: " << d1 << endl;
Simulator::Stop (Seconds (5));
Simulator::Run ();
return 0;
#else
NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in");
#endif
}
void
MpiInterface::Disable ()
{
#ifdef NS3_MPI
int flag = 0 ;
MPI_Initialized (&flag);
if (flag)
MPI_Finalize ();
m_enabled = false;
m_initialized = false;
else
NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it first");
} // namespace ns3
* Sets up MPI interface
*/
static void Enable (int* pargc, char*** pargv);
/**
* Terminates the MPI environment by calling MPI_Finalize
* This function must be called after Destroy ()
* It also resets m_initialized, m_enabled
static void Disable ();
* \param p packet to send
* \param rxTime received time at destination node