diff --git a/src/internet/model/global-route-manager-impl.cc b/src/internet/model/global-route-manager-impl.cc index 8945a84b7..6cf131cf3 100644 --- a/src/internet/model/global-route-manager-impl.cc +++ b/src/internet/model/global-route-manager-impl.cc @@ -34,7 +34,6 @@ #include "ns3/ipv4.h" #include "ns3/ipv4-routing-protocol.h" #include "ns3/ipv4-list-routing.h" -#include "ns3/mpi-interface.h" #include "global-router-interface.h" #include "global-route-manager-impl.h" #include "candidate-queue.h" @@ -711,7 +710,7 @@ GlobalRouteManagerImpl::InitializeRoutes () Ptr rtr = node->GetObject (); - uint32_t systemId = MpiInterface::GetSystemId (); + uint32_t systemId = Simulator::GetSystemId (); // Ignore nodes that are not assigned to our systemId (distributed sim) if (node->GetSystemId () != systemId) { diff --git a/src/internet/wscript b/src/internet/wscript index a1cc7f6b7..b77428e1d 100644 --- a/src/internet/wscript +++ b/src/internet/wscript @@ -103,8 +103,8 @@ def configure(conf): def build(bld): - # bridge and mpi dependencies are due to global routing - obj = bld.create_ns3_module('internet', ['bridge', 'mpi', 'traffic-control', 'network', 'core']) + # bridge dependency is due to global routing + obj = bld.create_ns3_module('internet', ['bridge', 'traffic-control', 'network', 'core']) obj.source = [ 'model/ip-l4-protocol.cc', 'model/udp-header.cc', diff --git a/src/mpi/examples/nms-p2p-nix-distributed.cc b/src/mpi/examples/nms-p2p-nix-distributed.cc index ddd69088e..be6dd12e8 100644 --- a/src/mpi/examples/nms-p2p-nix-distributed.cc +++ b/src/mpi/examples/nms-p2p-nix-distributed.cc @@ -60,8 +60,6 @@ NS_LOG_COMPONENT_DEFINE ("CampusNetworkModelDistributed"); int main (int argc, char *argv[]) { -#ifdef NS3_MPI - typedef std::vector vectorOfNodeContainer; typedef std::vector vectorOfVectorOfNodeContainer; typedef std::vector vectorOfVectorOfVectorOfNodeContainer; @@ -624,8 +622,5 @@ main (int argc, char *argv[]) std::cout << "Simulator run time: " << d2 << std::endl; std::cout << "Total elapsed time: " << d1 + d2 << std::endl; return 0; -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } diff --git a/src/mpi/examples/simple-distributed-empty-node.cc b/src/mpi/examples/simple-distributed-empty-node.cc index f478795c1..b8ccffa46 100644 --- a/src/mpi/examples/simple-distributed-empty-node.cc +++ b/src/mpi/examples/simple-distributed-empty-node.cc @@ -66,10 +66,7 @@ #include "ns3/ipv4-address-helper.h" #include "ns3/on-off-helper.h" #include "ns3/packet-sink-helper.h" - -#ifdef NS3_MPI #include -#endif using namespace ns3; @@ -78,8 +75,6 @@ NS_LOG_COMPONENT_DEFINE ("SimpleDistributed"); int main (int argc, char *argv[]) { -#ifdef NS3_MPI - bool nix = true; bool nullmsg = false; bool tracing = false; @@ -295,7 +290,4 @@ main (int argc, char *argv[]) // Exit the MPI execution environment MpiInterface::Disable (); return 0; -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } diff --git a/src/mpi/examples/simple-distributed.cc b/src/mpi/examples/simple-distributed.cc index 3c82739d9..7c71a618a 100644 --- a/src/mpi/examples/simple-distributed.cc +++ b/src/mpi/examples/simple-distributed.cc @@ -51,10 +51,7 @@ #include "ns3/ipv4-address-helper.h" #include "ns3/on-off-helper.h" #include "ns3/packet-sink-helper.h" - -#ifdef NS3_MPI #include -#endif using namespace ns3; @@ -63,8 +60,6 @@ NS_LOG_COMPONENT_DEFINE ("SimpleDistributed"); int main (int argc, char *argv[]) { -#ifdef NS3_MPI - bool nix = true; bool nullmsg = false; bool tracing = false; @@ -271,7 +266,4 @@ main (int argc, char *argv[]) // Exit the MPI execution environment MpiInterface::Disable (); return 0; -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } diff --git a/src/mpi/examples/third-distributed.cc b/src/mpi/examples/third-distributed.cc index a7c4821cf..bc5579702 100644 --- a/src/mpi/examples/third-distributed.cc +++ b/src/mpi/examples/third-distributed.cc @@ -82,8 +82,6 @@ main (int argc, char *argv[]) uint32_t systemId = 0; uint32_t systemCount = 1; -#ifdef NS3_MPI - // Distributed simulation setup; by default use granted time window algorithm. if(nullmsg) { @@ -109,8 +107,6 @@ main (int argc, char *argv[]) return 1; } -#endif // NS3_MPI - // System id of Wifi side uint32_t systemWifi = 0; @@ -262,10 +258,8 @@ main (int argc, char *argv[]) Simulator::Run (); Simulator::Destroy (); -#ifdef NS3_MPI // Exit the MPI execution environment MpiInterface::Disable (); -#endif return 0; } diff --git a/src/mpi/examples/wscript b/src/mpi/examples/wscript index d9a8212ac..528409da3 100644 --- a/src/mpi/examples/wscript +++ b/src/mpi/examples/wscript @@ -2,17 +2,17 @@ def build(bld): obj = bld.create_ns3_program('simple-distributed', - ['point-to-point', 'internet', 'nix-vector-routing', 'applications']) + ['mpi', 'point-to-point', 'internet', 'nix-vector-routing', 'applications']) obj.source = 'simple-distributed.cc' obj = bld.create_ns3_program('third-distributed', - ['point-to-point', 'internet', 'mobility', 'wifi', 'csma', 'applications']) + ['mpi', 'point-to-point', 'internet', 'mobility', 'wifi', 'csma', 'applications']) obj.source = 'third-distributed.cc' obj = bld.create_ns3_program('nms-p2p-nix-distributed', - ['point-to-point', 'internet', 'nix-vector-routing', 'applications']) + ['mpi', 'point-to-point', 'internet', 'nix-vector-routing', 'applications']) obj.source = 'nms-p2p-nix-distributed.cc' obj = bld.create_ns3_program('simple-distributed-empty-node', - ['point-to-point', 'internet', 'nix-vector-routing', 'applications']) + ['mpi', 'point-to-point', 'internet', 'nix-vector-routing', 'applications']) obj.source = 'simple-distributed-empty-node.cc' diff --git a/src/mpi/model/distributed-simulator-impl.cc b/src/mpi/model/distributed-simulator-impl.cc index 0d3a424a7..e63df26d3 100644 --- a/src/mpi/model/distributed-simulator-impl.cc +++ b/src/mpi/model/distributed-simulator-impl.cc @@ -31,11 +31,8 @@ #include "ns3/assert.h" #include "ns3/log.h" -#include - -#ifdef NS3_MPI #include -#endif +#include namespace ns3 { @@ -93,17 +90,12 @@ DistributedSimulatorImpl::DistributedSimulatorImpl () { NS_LOG_FUNCTION (this); -#ifdef NS3_MPI m_myId = MpiInterface::GetSystemId (); m_systemCount = MpiInterface::GetSize (); // Allocate the LBTS message buffer m_pLBTS = new LbtsMessage[m_systemCount]; m_grantedTime = Seconds (0); -#else - NS_UNUSED (m_systemCount); - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif m_stop = false; m_globalFinished = false; @@ -166,7 +158,6 @@ DistributedSimulatorImpl::CalculateLookAhead (void) { NS_LOG_FUNCTION (this); -#ifdef NS3_MPI if (MpiInterface::GetSize () <= 1) { m_lookAhead = Seconds (0); @@ -276,10 +267,6 @@ DistributedSimulatorImpl::CalculateLookAhead (void) m_lookAhead = Time (recvbuf); m_grantedTime = m_lookAhead; } - -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } void @@ -372,7 +359,6 @@ DistributedSimulatorImpl::Run (void) { NS_LOG_FUNCTION (this); -#ifdef NS3_MPI CalculateLookAhead (); m_stop = false; m_globalFinished = false; @@ -446,9 +432,6 @@ DistributedSimulatorImpl::Run (void) // If the simulator stopped naturally by lack of events, make a // consistency test to check that we didn't lose any events along the way. NS_ASSERT (!m_events->IsEmpty () || m_unscheduledEvents == 0); -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } uint32_t DistributedSimulatorImpl::GetSystemId () const diff --git a/src/mpi/model/granted-time-window-mpi-interface.cc b/src/mpi/model/granted-time-window-mpi-interface.cc index dc94e7f70..47cc25b8b 100644 --- a/src/mpi/model/granted-time-window-mpi-interface.cc +++ b/src/mpi/model/granted-time-window-mpi-interface.cc @@ -36,9 +36,7 @@ #include "ns3/nstime.h" #include "ns3/log.h" -#ifdef NS3_MPI #include -#endif namespace ns3 { @@ -67,13 +65,11 @@ SentBuffer::SetBuffer (uint8_t* buffer) m_buffer = buffer; } -#ifdef NS3_MPI MPI_Request* SentBuffer::GetRequest () { return &m_request; } -#endif uint32_t GrantedTimeWindowMpiInterface::m_sid = 0; uint32_t GrantedTimeWindowMpiInterface::m_size = 1; @@ -83,10 +79,8 @@ uint32_t GrantedTimeWindowMpiInterface::m_rxCount = 0; uint32_t GrantedTimeWindowMpiInterface::m_txCount = 0; std::list GrantedTimeWindowMpiInterface::m_pendingTx; -#ifdef NS3_MPI MPI_Request* GrantedTimeWindowMpiInterface::m_requests; char** GrantedTimeWindowMpiInterface::m_pRxBuffers; -#endif TypeId GrantedTimeWindowMpiInterface::GetTypeId (void) @@ -103,7 +97,6 @@ GrantedTimeWindowMpiInterface::Destroy () { NS_LOG_FUNCTION (this); -#ifdef NS3_MPI for (uint32_t i = 0; i < GetSize (); ++i) { delete [] m_pRxBuffers[i]; @@ -112,7 +105,6 @@ GrantedTimeWindowMpiInterface::Destroy () delete [] m_requests; m_pendingTx.clear (); -#endif } uint32_t @@ -165,7 +157,6 @@ GrantedTimeWindowMpiInterface::Enable (int* pargc, char*** pargv) { NS_LOG_FUNCTION (this << pargc << pargv); -#ifdef NS3_MPI // Initialize the MPI interface MPI_Init (pargc, pargv); MPI_Barrier (MPI_COMM_WORLD); @@ -182,9 +173,6 @@ GrantedTimeWindowMpiInterface::Enable (int* pargc, char*** pargv) MPI_Irecv (m_pRxBuffers[i], MAX_MPI_MSG_SIZE, MPI_CHAR, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &m_requests[i]); } -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } void @@ -192,7 +180,6 @@ GrantedTimeWindowMpiInterface::SendPacket (Ptr p, const Time& rxTime, ui { NS_LOG_FUNCTION (this << p << rxTime.GetTimeStep () << node << dev); -#ifdef NS3_MPI SentBuffer sendBuf; m_pendingTx.push_back (sendBuf); std::list::reverse_iterator i = m_pendingTx.rbegin (); // Points to the last element @@ -217,9 +204,6 @@ GrantedTimeWindowMpiInterface::SendPacket (Ptr p, const Time& rxTime, ui MPI_Isend (reinterpret_cast (i->GetBuffer ()), serializedSize + 16, MPI_CHAR, nodeSysId, 0, MPI_COMM_WORLD, (i->GetRequest ())); m_txCount++; -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } void @@ -227,7 +211,6 @@ GrantedTimeWindowMpiInterface::ReceiveMessages () { NS_LOG_FUNCTION_NOARGS (); -#ifdef NS3_MPI // Poll the non-block reads to see if data arrived while (true) { @@ -281,9 +264,6 @@ GrantedTimeWindowMpiInterface::ReceiveMessages () MPI_Irecv (m_pRxBuffers[index], MAX_MPI_MSG_SIZE, MPI_CHAR, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &m_requests[index]); } -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } void @@ -291,7 +271,6 @@ GrantedTimeWindowMpiInterface::TestSendComplete () { NS_LOG_FUNCTION_NOARGS (); -#ifdef NS3_MPI std::list::iterator i = m_pendingTx.begin (); while (i != m_pendingTx.end ()) { @@ -305,9 +284,6 @@ GrantedTimeWindowMpiInterface::TestSendComplete () m_pendingTx.erase (current); } } -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } void @@ -315,7 +291,6 @@ GrantedTimeWindowMpiInterface::Disable () { NS_LOG_FUNCTION_NOARGS (); -#ifdef NS3_MPI int flag = 0; MPI_Initialized (&flag); if (flag) @@ -328,9 +303,6 @@ GrantedTimeWindowMpiInterface::Disable () { NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it first"); } -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif } diff --git a/src/mpi/model/granted-time-window-mpi-interface.h b/src/mpi/model/granted-time-window-mpi-interface.h index 780f2c5e3..bdc0bed91 100644 --- a/src/mpi/model/granted-time-window-mpi-interface.h +++ b/src/mpi/model/granted-time-window-mpi-interface.h @@ -31,11 +31,7 @@ #include "parallel-communication-interface.h" -#ifdef NS3_MPI #include "mpi.h" -#else -typedef void* MPI_Request; -#endif namespace ns3 { diff --git a/src/mpi/model/null-message-mpi-interface.cc b/src/mpi/model/null-message-mpi-interface.cc index 1a986ff70..825c5461c 100644 --- a/src/mpi/model/null-message-mpi-interface.cc +++ b/src/mpi/model/null-message-mpi-interface.cc @@ -33,9 +33,7 @@ #include "ns3/simulator.h" #include "ns3/log.h" -#ifdef NS3_MPI #include -#endif #include #include @@ -49,9 +47,7 @@ NS_LOG_COMPONENT_DEFINE ("NullMessageMpiInterface"); * maximum MPI message size for easy * buffer creation */ -#ifdef NS3_MPI const uint32_t NULL_MESSAGE_MAX_MPI_MSG_SIZE = 2000; -#endif NullMessageSentBuffer::NullMessageSentBuffer () { @@ -95,14 +91,6 @@ char** NullMessageMpiInterface::g_pRxBuffers; NullMessageMpiInterface::NullMessageMpiInterface () { NS_LOG_FUNCTION (this); - -#ifndef NS3_MPI - /* - * This class can only be constructed if MPI is available. Fail if an - * attempt is made to instantiate this class without MPI. - */ - NS_FATAL_ERROR ("Must compile with MPI if Null Message simulator is used, see --enable-mpi option for waf"); -#endif } NullMessageMpiInterface::~NullMessageMpiInterface () @@ -146,10 +134,6 @@ NullMessageMpiInterface::Enable (int* pargc, char*** pargv) { NS_LOG_FUNCTION (this << *pargc); -#ifndef NS3_MPI - NS_UNUSED(pargv); -#else - // Initialize the MPI interface MPI_Init (pargc, pargv); MPI_Barrier (MPI_COMM_WORLD); @@ -165,15 +149,12 @@ NullMessageMpiInterface::Enable (int* pargc, char*** pargv) g_enabled = true; g_initialized = true; - -#endif } void NullMessageMpiInterface::InitializeSendReceiveBuffers(void) { NS_LOG_FUNCTION_NOARGS (); -#ifdef NS3_MPI NS_ASSERT (g_enabled); g_numNeighbors = RemoteChannelBundleManager::Size(); @@ -193,7 +174,6 @@ NullMessageMpiInterface::InitializeSendReceiveBuffers(void) ++index; } } -#endif } void @@ -203,8 +183,6 @@ NullMessageMpiInterface::SendPacket (Ptr p, const Time& rxTime, uint32_t NS_ASSERT (g_enabled); -#ifdef NS3_MPI - // Find the system id for the destination node Ptr destNode = NodeList::GetNode (node); uint32_t nodeSysId = destNode->GetSystemId (); @@ -235,8 +213,6 @@ NullMessageMpiInterface::SendPacket (Ptr p, const Time& rxTime, uint32_t 0, MPI_COMM_WORLD, (iter->GetRequest ())); NullMessageSimulatorImpl::GetInstance ()->RescheduleNullMessageEvent (nodeSysId); - -#endif } void @@ -246,8 +222,6 @@ NullMessageMpiInterface::SendNullMessage (const Time& guarantee_update, Ptr::reverse_iterator iter = g_pendingTx.rbegin (); // Points to the last element @@ -268,7 +242,6 @@ NullMessageMpiInterface::SendNullMessage (const Time& guarantee_update, Ptr (iter->GetBuffer ()), bufferSize, MPI_CHAR, nodeSysId, 0, MPI_COMM_WORLD, (iter->GetRequest ())); -#endif } void @@ -296,8 +269,6 @@ NullMessageMpiInterface::ReceiveMessages (bool blocking) NS_ASSERT (g_enabled); -#ifdef NS3_MPI - // stop flag set to true when no more messages are found to // process. bool stop = false; @@ -387,7 +358,6 @@ NullMessageMpiInterface::ReceiveMessages (bool blocking) } } while (!stop); -#endif } void @@ -397,7 +367,6 @@ NullMessageMpiInterface::TestSendComplete () NS_ASSERT (g_enabled); -#ifdef NS3_MPI std::list::iterator iter = g_pendingTx.begin (); while (iter != g_pendingTx.end ()) { @@ -411,7 +380,6 @@ NullMessageMpiInterface::TestSendComplete () g_pendingTx.erase (current); } } -#endif } void @@ -419,7 +387,6 @@ NullMessageMpiInterface::Disable () { NS_LOG_FUNCTION (this); -#ifdef NS3_MPI int flag = 0; MPI_Initialized (&flag); if (flag) @@ -458,7 +425,6 @@ NullMessageMpiInterface::Disable () { NS_FATAL_ERROR ("Cannot disable MPI environment without Initializing it first"); } -#endif } } // namespace ns3 diff --git a/src/mpi/model/null-message-mpi-interface.h b/src/mpi/model/null-message-mpi-interface.h index 6575ee52c..eb8b81b96 100644 --- a/src/mpi/model/null-message-mpi-interface.h +++ b/src/mpi/model/null-message-mpi-interface.h @@ -27,12 +27,7 @@ #include #include -#ifdef NS3_MPI #include "mpi.h" -#else -typedef void* MPI_Request; -#endif - #include namespace ns3 { diff --git a/src/mpi/model/null-message-simulator-impl.cc b/src/mpi/model/null-message-simulator-impl.cc index e0e7a7b06..8c41c47ae 100644 --- a/src/mpi/model/null-message-simulator-impl.cc +++ b/src/mpi/model/null-message-simulator-impl.cc @@ -67,7 +67,6 @@ NullMessageSimulatorImpl::GetTypeId (void) NullMessageSimulatorImpl::NullMessageSimulatorImpl () { -#ifdef NS3_MPI NS_LOG_FUNCTION (this); m_myId = MpiInterface::GetSystemId (); @@ -91,10 +90,6 @@ NullMessageSimulatorImpl::NullMessageSimulatorImpl () NS_ASSERT (g_instance == 0); g_instance = this; - -#else - NS_FATAL_ERROR ("Can't use Null Message simulator without MPI compiled in"); -#endif } NullMessageSimulatorImpl::~NullMessageSimulatorImpl () diff --git a/src/mpi/model/parallel-communication-interface.h b/src/mpi/model/parallel-communication-interface.h index 167aadbd8..4388ece59 100644 --- a/src/mpi/model/parallel-communication-interface.h +++ b/src/mpi/model/parallel-communication-interface.h @@ -30,9 +30,7 @@ #include #include -#if defined(NS3_MPI) #include "mpi.h" -#endif namespace ns3 { diff --git a/src/mpi/wscript b/src/mpi/wscript index afbcfbd36..5c007441c 100644 --- a/src/mpi/wscript +++ b/src/mpi/wscript @@ -31,12 +31,17 @@ def configure(conf): conf.report_optional_feature("mpi", "MPI Support", True, '') else: conf.report_optional_feature("mpi", "MPI Support", False, 'mpic++ not found') + conf.env['MODULES_NOT_BUILT'].append('mpi') else: conf.report_optional_feature("mpi", "MPI Support", False, 'option --enable-mpi not selected') + conf.env['MODULES_NOT_BUILT'].append('mpi') def build(bld): - env = bld.env + # Don't do anything for this module if mpi's not enabled. + if 'mpi' in bld.env['MODULES_NOT_BUILT']: + return + sim = bld.create_ns3_module('mpi', ['core', 'network']) sim.source = [ 'model/distributed-simulator-impl.cc', @@ -57,7 +62,7 @@ def build(bld): 'model/parallel-communication-interface.h', ] - if env['ENABLE_MPI']: + if bld.env['ENABLE_MPI']: sim.use.append('MPI') if bld.env['ENABLE_EXAMPLES']: diff --git a/src/point-to-point/helper/point-to-point-helper.cc b/src/point-to-point/helper/point-to-point-helper.cc index 179cffe6f..9e8f7fc53 100644 --- a/src/point-to-point/helper/point-to-point-helper.cc +++ b/src/point-to-point/helper/point-to-point-helper.cc @@ -23,14 +23,17 @@ #include "ns3/simulator.h" #include "ns3/point-to-point-net-device.h" #include "ns3/point-to-point-channel.h" -#include "ns3/point-to-point-remote-channel.h" #include "ns3/queue.h" #include "ns3/net-device-queue-interface.h" #include "ns3/config.h" #include "ns3/packet.h" #include "ns3/names.h" + +#ifdef NS3_MPI #include "ns3/mpi-interface.h" #include "ns3/mpi-receiver.h" +#include "ns3/point-to-point-remote-channel.h" +#endif #include "ns3/trace-helper.h" #include "point-to-point-helper.h" @@ -44,7 +47,9 @@ PointToPointHelper::PointToPointHelper () m_queueFactory.SetTypeId ("ns3::DropTailQueue"); m_deviceFactory.SetTypeId ("ns3::PointToPointNetDevice"); m_channelFactory.SetTypeId ("ns3::PointToPointChannel"); +#ifdef NS3_MPI m_remoteChannelFactory.SetTypeId ("ns3::PointToPointRemoteChannel"); +#endif } void @@ -73,7 +78,9 @@ void PointToPointHelper::SetChannelAttribute (std::string n1, const AttributeValue &v1) { m_channelFactory.Set (n1, v1); +#ifdef NS3_MPI m_remoteChannelFactory.Set (n1, v1); +#endif } void @@ -247,12 +254,13 @@ PointToPointHelper::Install (Ptr a, Ptr b) ndqiB->GetTxQueue (0)->ConnectQueueTraces (queueB); devB->AggregateObject (ndqiB); - // If MPI is enabled, we need to see if both nodes have the same system id - // (rank), and the rank is the same as this instance. If both are true, - //use a normal p2p channel, otherwise use a remote channel - bool useNormalChannel = true; Ptr channel = 0; + // If MPI is enabled, we need to see if both nodes have the same system id + // (rank), and the rank is the same as this instance. If both are true, + // use a normal p2p channel, otherwise use a remote channel +#ifdef NS3_MPI + bool useNormalChannel = true; if (MpiInterface::IsEnabled ()) { uint32_t n1SystemId = a->GetSystemId (); @@ -277,6 +285,9 @@ PointToPointHelper::Install (Ptr a, Ptr b) devA->AggregateObject (mpiRecA); devB->AggregateObject (mpiRecB); } +#else + channel = m_channelFactory.Create (); +#endif devA->Attach (channel); devB->Attach (channel); diff --git a/src/point-to-point/helper/point-to-point-helper.h b/src/point-to-point/helper/point-to-point-helper.h index 5ac2f8db3..a401f665c 100644 --- a/src/point-to-point/helper/point-to-point-helper.h +++ b/src/point-to-point/helper/point-to-point-helper.h @@ -183,8 +183,10 @@ private: ObjectFactory m_queueFactory; //!< Queue Factory ObjectFactory m_channelFactory; //!< Channel Factory - ObjectFactory m_remoteChannelFactory; //!< Remote Channel Factory ObjectFactory m_deviceFactory; //!< Device Factory +#ifdef NS3_MPI + ObjectFactory m_remoteChannelFactory; //!< Remote Channel Factory +#endif }; } // namespace ns3 diff --git a/src/point-to-point/model/point-to-point-remote-channel.cc b/src/point-to-point/model/point-to-point-remote-channel.cc index 46fe81be3..10a883630 100644 --- a/src/point-to-point/model/point-to-point-remote-channel.cc +++ b/src/point-to-point/model/point-to-point-remote-channel.cc @@ -67,13 +67,9 @@ PointToPointRemoteChannel::TransmitStart ( uint32_t wire = src == GetSource (0) ? 0 : 1; Ptr dst = GetDestination (wire); -#ifdef NS3_MPI // Calculate the rxTime (absolute) Time rxTime = Simulator::Now () + txTime + GetDelay (); MpiInterface::SendPacket (p->Copy (), rxTime, dst->GetNode ()->GetId (), dst->GetIfIndex ()); -#else - NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); -#endif return true; } diff --git a/src/point-to-point/wscript b/src/point-to-point/wscript index 7fbf40ad2..febc60243 100644 --- a/src/point-to-point/wscript +++ b/src/point-to-point/wscript @@ -2,15 +2,19 @@ def build(bld): - module = bld.create_ns3_module('point-to-point', ['network', 'mpi']) + if bld.env['ENABLE_MPI']: + module = bld.create_ns3_module('point-to-point', ['network', 'mpi']) + else: + module = bld.create_ns3_module('point-to-point', ['network']) module.source = [ 'model/point-to-point-net-device.cc', 'model/point-to-point-channel.cc', - 'model/point-to-point-remote-channel.cc', 'model/ppp-header.cc', 'helper/point-to-point-helper.cc', ] - + if bld.env['ENABLE_MPI']: + module.source.append('model/point-to-point-remote-channel.cc') + module_test = bld.create_ns3_module_test_library('point-to-point') module_test.source = [ 'test/point-to-point-test.cc', @@ -21,10 +25,11 @@ def build(bld): headers.source = [ 'model/point-to-point-net-device.h', 'model/point-to-point-channel.h', - 'model/point-to-point-remote-channel.h', 'model/ppp-header.h', 'helper/point-to-point-helper.h', ] + if bld.env['ENABLE_MPI']: + headers.source.append('model/point-to-point-remote-channel.h') if (bld.env['ENABLE_EXAMPLES']): bld.recurse('examples') diff --git a/wscript b/wscript index f5e7f4e36..ed18619cb 100644 --- a/wscript +++ b/wscript @@ -551,8 +551,6 @@ def configure(conf): elif not_built_name in conf.env['NS3_ENABLED_CONTRIBUTED_MODULES']: conf.env['NS3_ENABLED_CONTRIBUTED_MODULES'].remove(not_built_name) - conf.recurse('src/mpi') - # for suid bits try: conf.find_program('sudo', var='SUDO')