mtp, mpi: Modify simple examples

This commit is contained in:
F5
2023-11-20 21:48:37 +08:00
parent b3f09bcee2
commit b69f13f5d2
2 changed files with 3 additions and 20 deletions

View File

@@ -1,4 +1,3 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -64,7 +63,7 @@
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("SimpleDistributed");
NS_LOG_COMPONENT_DEFINE("SimpleHybrid");
int
main(int argc, char* argv[])
@@ -72,7 +71,6 @@ main(int argc, char* argv[])
LogComponentEnable("LogicalProcess", LOG_LEVEL_INFO);
bool nix = true;
bool nullmsg = false;
bool tracing = false;
bool testing = false;
bool verbose = false;
@@ -80,24 +78,11 @@ main(int argc, char* argv[])
// Parse command line
CommandLine cmd(__FILE__);
cmd.AddValue("nix", "Enable the use of nix-vector or global routing", nix);
cmd.AddValue("nullmsg", "Enable the use of null-message synchronization", nullmsg);
cmd.AddValue("tracing", "Enable pcap tracing", tracing);
cmd.AddValue("verbose", "verbose output", verbose);
cmd.AddValue("test", "Enable regression test output", testing);
cmd.Parse(argc, argv);
// Distributed simulation setup; by default use granted time window algorithm.
if (nullmsg)
{
GlobalValue::Bind("SimulatorImplementationType",
StringValue("ns3::NullMessageSimulatorImpl"));
}
else
{
GlobalValue::Bind("SimulatorImplementationType",
StringValue("ns3::DistributedSimulatorImpl"));
}
// Enable parallel simulator with the command line arguments
MtpInterface::Enable();
MpiInterface::Enable(&argc, &argv);

View File

@@ -196,7 +196,7 @@ main(int argc, char* argv[])
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
}
if (tracing == true)
if (tracing)
{
routerLink.EnablePcap("router-left", routerDevices, true);
leafLink.EnablePcap("leaf-left", leftLeafDevices, true);
@@ -207,7 +207,6 @@ main(int argc, char* argv[])
// Create a packet sink on the right leafs to receive packets from left leafs
uint16_t port = 50000;
Address sinkLocalAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
PacketSinkHelper sinkHelper("ns3::UdpSocketFactory", sinkLocalAddress);
ApplicationContainer sinkApp;
@@ -219,7 +218,6 @@ main(int argc, char* argv[])
sinkApp.Stop(Seconds(5));
// Create the OnOff applications to send
OnOffHelper clientHelper("ns3::UdpSocketFactory", Address());
clientHelper.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
@@ -238,6 +236,6 @@ main(int argc, char* argv[])
Simulator::Run();
Simulator::Destroy();
// Exit the MPI execution environment
// Exit the MTP execution environment
return 0;
}