Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
ns-3-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
nsnam
ns-3-dev
Commits
ed72cae1
Commit
ed72cae1
authored
12 years ago
by
Vedran Miletić
Browse files
Options
Downloads
Patches
Plain Diff
Fix MPI build (bug 1237 regression).
parent
d20e2762
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mpi/examples/nms-p2p-nix-distributed.cc
+30
-30
30 additions, 30 deletions
src/mpi/examples/nms-p2p-nix-distributed.cc
with
30 additions
and
30 deletions
src/mpi/examples/nms-p2p-nix-distributed.cc
+
30
−
30
View file @
ed72cae1
...
...
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
TIMER_TYPE
t0
,
t1
,
t2
;
TIMER_NOW
(
t0
);
cout
<<
" ==== DARPA NMS CAMPUS NETWORK SIMULATION ===="
<<
endl
;
std
::
cout
<<
" ==== DARPA NMS CAMPUS NETWORK SIMULATION ===="
<<
std
::
endl
;
GlobalValue
::
Bind
(
"SimulatorImplementationType"
,
StringValue
(
"ns3::DistributedSimulatorImpl"
));
...
...
@@ -94,18 +94,18 @@ main (int argc, char *argv[])
if
(
nCN
<
2
)
{
cout
<<
"Number of total CNs ("
<<
nCN
<<
") lower than minimum of 2"
<<
endl
;
std
::
cout
<<
"Number of total CNs ("
<<
nCN
<<
") lower than minimum of 2"
<<
std
::
endl
;
return
1
;
}
if
(
systemCount
>
nCN
)
{
cout
<<
"Number of total CNs ("
<<
nCN
<<
") should be >= systemCount ("
<<
systemCount
<<
")."
<<
endl
;
std
::
cout
<<
"Number of total CNs ("
<<
nCN
<<
") should be >= systemCount ("
<<
systemCount
<<
")."
<<
std
::
endl
;
return
1
;
}
cout
<<
"Number of CNs: "
<<
nCN
<<
", LAN nodes: "
<<
nLANClients
<<
endl
;
std
::
cout
<<
"Number of CNs: "
<<
nCN
<<
", LAN nodes: "
<<
nLANClients
<<
std
::
endl
;
NodeContainer
nodes_net0
[
nCN
][
3
],
nodes_net1
[
nCN
][
6
],
nodes_netLR
[
nCN
],
nodes_net2
[
nCN
][
14
],
nodes_net2LAN
[
nCN
][
7
][
nLANClients
],
...
...
@@ -139,9 +139,9 @@ main (int argc, char *argv[])
// Create Campus Networks
for
(
uint32_t
z
=
0
;
z
<
nCN
;
++
z
)
{
cout
<<
"Creating Campus Network "
<<
z
<<
":"
<<
endl
;
std
::
cout
<<
"Creating Campus Network "
<<
z
<<
":"
<<
std
::
endl
;
// Create Net0
cout
<<
" SubNet [ 0"
;
std
::
cout
<<
" SubNet [ 0"
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
Ptr
<
Node
>
node
=
CreateObject
<
Node
>
(
z
%
systemCount
);
...
...
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
ndc0
[
i
]
=
p2p_1gb5ms
.
Install
(
nodes_net0
[
z
][
i
]);
}
// Create Net1
cout
<<
" 1"
;
std
::
cout
<<
" 1"
;
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
Ptr
<
Node
>
node
=
CreateObject
<
Node
>
(
z
%
systemCount
);
...
...
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
address
.
SetBase
(
oss
.
str
().
c_str
(),
"255.255.255.0"
);
ifs
=
address
.
Assign
(
ndc0_1
);
// Create Net2
cout
<<
" 2"
;
std
::
cout
<<
" 2"
;
for
(
int
i
=
0
;
i
<
14
;
++
i
)
{
Ptr
<
Node
>
node
=
CreateObject
<
Node
>
(
z
%
systemCount
);
...
...
@@ -232,7 +232,7 @@ main (int argc, char *argv[])
}
}
// Create Net3
cout
<<
" 3 ]"
<<
endl
;
std
::
cout
<<
" 3 ]"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
9
;
++
i
)
{
Ptr
<
Node
>
node
=
CreateObject
<
Node
>
(
z
%
systemCount
);
...
...
@@ -269,7 +269,7 @@ main (int argc, char *argv[])
ifs3LAN
[
z
][
i
][
j
]
=
address
.
Assign
(
ndc3LAN
[
i
][
j
]);
}
}
cout
<<
" Connecting Subnets..."
<<
endl
;
std
::
cout
<<
" Connecting Subnets..."
<<
std
::
endl
;
// Create Lone Routers (Node 4 & 5)
Ptr
<
Node
>
node1
=
CreateObject
<
Node
>
(
z
%
systemCount
);
Ptr
<
Node
>
node2
=
CreateObject
<
Node
>
(
z
%
systemCount
);
...
...
@@ -324,7 +324,7 @@ main (int argc, char *argv[])
address
.
SetBase
(
oss
.
str
().
c_str
(),
"255.255.255.0"
);
ifs
=
address
.
Assign
(
ndc3_5b
);
// Assign IP addresses
cout
<<
" Assigning IP addresses..."
<<
endl
;
std
::
cout
<<
" Assigning IP addresses..."
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
oss
.
str
(
""
);
...
...
@@ -365,7 +365,7 @@ main (int argc, char *argv[])
// Create Ring Links
if
(
nCN
>
1
)
{
cout
<<
"Forming Ring Topology..."
<<
endl
;
std
::
cout
<<
"Forming Ring Topology..."
<<
std
::
endl
;
NodeContainer
nodes_ring
[
nCN
];
for
(
uint32_t
z
=
0
;
z
<
nCN
-
1
;
++
z
)
{
...
...
@@ -386,7 +386,7 @@ main (int argc, char *argv[])
}
// Create Traffic Flows
cout
<<
"Creating UDP Traffic Flows:"
<<
endl
;
std
::
cout
<<
"Creating UDP Traffic Flows:"
<<
std
::
endl
;
Config
::
SetDefault
(
"ns3::OnOffApplication::MaxBytes"
,
UintegerValue
(
nBytes
));
Config
::
SetDefault
(
"ns3::OnOffApplication::OnTime"
,
...
...
@@ -407,7 +407,7 @@ main (int argc, char *argv[])
OnOffHelper
client
(
"ns3::UdpSocketFactory"
,
Address
());
AddressValue
remoteAddress
(
InetSocketAddress
(
ifs1
[
0
][
2
].
GetAddress
(
0
),
9999
));
cout
<<
"Remote Address is "
<<
ifs1
[
0
][
2
].
GetAddress
(
0
)
<<
endl
;
std
::
cout
<<
"Remote Address is "
<<
ifs1
[
0
][
2
].
GetAddress
(
0
)
<<
std
::
endl
;
client
.
SetAttribute
(
"Remote"
,
remoteAddress
);
ApplicationContainer
clientApp
;
...
...
@@ -430,7 +430,7 @@ main (int argc, char *argv[])
AddressValue
remoteAddress
(
InetSocketAddress
(
ifs1
[
1
][
0
].
GetAddress
(
0
),
9999
));
cout
<<
"Remote Address is "
<<
ifs1
[
1
][
0
].
GetAddress
(
0
)
<<
endl
;
std
::
cout
<<
"Remote Address is "
<<
ifs1
[
1
][
0
].
GetAddress
(
0
)
<<
std
::
endl
;
client
.
SetAttribute
(
"Remote"
,
remoteAddress
);
ApplicationContainer
clientApp
;
...
...
@@ -451,7 +451,7 @@ main (int argc, char *argv[])
x
=
0
;
}
// Subnet 2 LANs
cout
<<
" Campus Network "
<<
z
<<
" Flows [ Net2 "
;
std
::
cout
<<
" Campus Network "
<<
z
<<
" Flows [ Net2 "
;
for
(
int
i
=
0
;
i
<
7
;
++
i
)
{
for
(
uint32_t
j
=
0
;
j
<
nLANClients
;
++
j
)
...
...
@@ -511,7 +511,7 @@ main (int argc, char *argv[])
}
}
// Subnet 3 LANs
cout
<<
"Net3 ]"
<<
endl
;
std
::
cout
<<
"Net3 ]"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
uint32_t
j
=
0
;
j
<
nLANClients
;
++
j
)
...
...
@@ -573,40 +573,40 @@ main (int argc, char *argv[])
}
}
cout
<<
"Created "
<<
NodeList
::
GetNNodes
()
<<
" nodes."
<<
endl
;
std
::
cout
<<
"Created "
<<
NodeList
::
GetNNodes
()
<<
" nodes."
<<
std
::
endl
;
TIMER_TYPE
routingStart
;
TIMER_NOW
(
routingStart
);
if
(
nix
)
{
cout
<<
"Using Nix-vectors..."
<<
endl
;
std
::
cout
<<
"Using Nix-vectors..."
<<
std
::
endl
;
}
else
{
// Calculate routing tables
cout
<<
"Populating Routing tables..."
<<
endl
;
std
::
cout
<<
"Populating Routing tables..."
<<
std
::
endl
;
Ipv4GlobalRoutingHelper
::
PopulateRoutingTables
();
}
TIMER_TYPE
routingEnd
;
TIMER_NOW
(
routingEnd
);
cout
<<
"Routing tables population took "
<<
TIMER_DIFF
(
routingEnd
,
routingStart
)
<<
endl
;
std
::
cout
<<
"Routing tables population took "
<<
TIMER_DIFF
(
routingEnd
,
routingStart
)
<<
std
::
endl
;
cout
<<
"Running simulator..."
<<
endl
;
std
::
cout
<<
"Running simulator..."
<<
std
::
endl
;
TIMER_NOW
(
t1
);
Simulator
::
Stop
(
Seconds
(
100.0
));
Simulator
::
Run
();
TIMER_NOW
(
t2
);
cout
<<
"Simulator finished."
<<
endl
;
std
::
cout
<<
"Simulator finished."
<<
std
::
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
;
cout
<<
"Simulator run time: "
<<
d2
<<
endl
;
cout
<<
"Total elapsed time: "
<<
d1
+
d2
<<
endl
;
std
::
cout
<<
"-----"
<<
std
::
endl
<<
"Runtime Stats:"
<<
std
::
endl
;
std
::
cout
<<
"Simulator init time: "
<<
d1
<<
std
::
endl
;
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"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment