mpi: (merges !389) Enable user to provide an MPI communication context

This commit is contained in:
Steven Smith
2020-08-28 14:13:11 -07:00
committed by Tom Henderson
parent 2cea1e4ccd
commit 5b2f902d04
38 changed files with 1952 additions and 476 deletions

View File

@@ -16,7 +16,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Steven Smith <smith84@llnl.gov>
*
*/
/**
* \file
* \ingroup mpi
* Implementation of class ns3::MpiInterface.
*/
#include "mpi-interface.h"
@@ -73,7 +78,7 @@ MpiInterface::IsEnabled ()
}
void
MpiInterface::Enable (int* pargc, char*** pargv)
MpiInterface::SetParallelSimulatorImpl (void)
{
StringValue simulationTypeValue;
bool useDefault = true;
@@ -104,10 +109,24 @@ MpiInterface::Enable (int* pargc, char*** pargv)
StringValue ("ns3::DistributedSimulatorImpl"));
NS_LOG_WARN ("SimulatorImplementationType was set to non-parallel simulator; setting type to ns3::DistributedSimulatorImp");
}
}
void
MpiInterface::Enable (int* pargc, char*** pargv)
{
SetParallelSimulatorImpl ();
g_parallelCommunicationInterface->Enable (pargc, pargv);
}
void
MpiInterface::Enable (MPI_Comm communicator)
{
SetParallelSimulatorImpl ();
g_parallelCommunicationInterface->Enable (communicator);
}
void
MpiInterface::SendPacket (Ptr<Packet> p, const Time& rxTime, uint32_t node, uint32_t dev)
{
@@ -115,6 +134,13 @@ MpiInterface::SendPacket (Ptr<Packet> p, const Time& rxTime, uint32_t node, uint
g_parallelCommunicationInterface->SendPacket (p, rxTime, node, dev);
}
MPI_Comm
MpiInterface::GetCommunicator()
{
NS_ASSERT (g_parallelCommunicationInterface);
return g_parallelCommunicationInterface->GetCommunicator ();
}
void
MpiInterface::Disable ()