mtp, mpi: Modify examples

This commit is contained in:
F5
2025-05-01 06:06:02 +08:00
parent 23a0788c02
commit bd4fa08a7b
3 changed files with 21 additions and 21 deletions

View File

@@ -550,10 +550,10 @@ main(int argc, char* argv[])
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
uint32_t nHost = conf::k / 2; // number of hosts under a switch uint32_t nHost = conf::k / 2; // number of hosts under a switch
NodeContainer core[nGroup]; NodeContainer core = new NodeContainer[nGroup];
NodeContainer agg[nPod]; NodeContainer agg = new NodeContainer[nPod];
NodeContainer edge[nPod]; NodeContainer edge = new NodeContainer[nPod];
NodeContainer host[nPod][nEdge]; NodeContainer host = new NodeContainer[nPod + nEdge];
// create nodes // create nodes
for (uint32_t i = 0; i < nGroup; i++) for (uint32_t i = 0; i < nGroup; i++)
@@ -573,10 +573,10 @@ main(int argc, char* argv[])
{ {
for (uint32_t j = 0; j < nEdge; j++) for (uint32_t j = 0; j < nEdge; j++)
{ {
host[i][j].Create(nHost, i % conf::system); host[i * nEdge + j].Create(nHost, i % conf::system);
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
hosts[hostId++] = host[i][j].Get(k); hosts[hostId++] = host[i * nEdge + j].Get(k);
} }
} }
} }
@@ -596,7 +596,7 @@ main(int argc, char* argv[])
addr.SetBase(subnet.c_str(), "255.255.255.0"); addr.SetBase(subnet.c_str(), "255.255.255.0");
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
Ptr<Node> node = host[i][j].Get(k); Ptr<Node> node = host[i * nEdge + j].Get(k);
NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j)));
red.Install(ndc.Get(1)); red.Install(ndc.Get(1));
addrs[node] = addr.Assign(ndc).GetAddress(0); addrs[node] = addr.Assign(ndc).GetAddress(0);

View File

@@ -554,10 +554,10 @@ main(int argc, char* argv[])
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
uint32_t nHost = conf::k / 2; // number of hosts under a switch uint32_t nHost = conf::k / 2; // number of hosts under a switch
NodeContainer core[nGroup]; NodeContainer core = new NodeContainer[nGroup];
NodeContainer agg[nPod]; NodeContainer agg = new NodeContainer[nPod];
NodeContainer edge[nPod]; NodeContainer edge = new NodeContainer[nPod];
NodeContainer host[nPod][nEdge]; NodeContainer host = new NodeContainer[nPod * nEdge];
// create nodes // create nodes
for (uint32_t i = 0; i < nGroup; i++) for (uint32_t i = 0; i < nGroup; i++)
@@ -577,10 +577,10 @@ main(int argc, char* argv[])
{ {
for (uint32_t j = 0; j < nEdge; j++) for (uint32_t j = 0; j < nEdge; j++)
{ {
host[i][j].Create(nHost, i % conf::system); host[i * nEdge + j].Create(nHost, i % conf::system);
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
hosts[hostId++] = host[i][j].Get(k); hosts[hostId++] = host[i * nEdge + j].Get(k);
} }
} }
} }
@@ -600,7 +600,7 @@ main(int argc, char* argv[])
addr.SetBase(subnet.c_str(), "255.255.255.0"); addr.SetBase(subnet.c_str(), "255.255.255.0");
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
Ptr<Node> node = host[i][j].Get(k); Ptr<Node> node = host[i * nEdge + j].Get(k);
NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j)));
red.Install(ndc.Get(1)); red.Install(ndc.Get(1));
addrs[node] = addr.Assign(ndc).GetAddress(0); addrs[node] = addr.Assign(ndc).GetAddress(0);

View File

@@ -516,10 +516,10 @@ main(int argc, char* argv[])
uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod uint32_t nAgg = conf::k / 2; // number of aggregation switch in a pod
uint32_t nEdge = conf::k / 2; // number of edge switch in a pod uint32_t nEdge = conf::k / 2; // number of edge switch in a pod
uint32_t nHost = conf::k / 2; // number of hosts under a switch uint32_t nHost = conf::k / 2; // number of hosts under a switch
NodeContainer core[nGroup]; NodeContainer *core = new NodeContainer[nGroup];
NodeContainer agg[nPod]; NodeContainer *agg = new NodeContainer[nPod];
NodeContainer edge[nPod]; NodeContainer *edge = new NodeContainer[nPod];
NodeContainer host[nPod][nEdge]; NodeContainer *host = new NodeContainer[nPod * nEdge];
// create nodes // create nodes
for (uint32_t i = 0; i < nGroup; i++) for (uint32_t i = 0; i < nGroup; i++)
@@ -539,10 +539,10 @@ main(int argc, char* argv[])
{ {
for (uint32_t j = 0; j < nEdge; j++) for (uint32_t j = 0; j < nEdge; j++)
{ {
host[i][j].Create(nHost); host[i * nEdge + j].Create(nHost);
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
hosts[hostId++] = host[i][j].Get(k); hosts[hostId++] = host[i * nEdge + j].Get(k);
} }
} }
} }
@@ -562,7 +562,7 @@ main(int argc, char* argv[])
addr.SetBase(subnet.c_str(), "255.255.255.0"); addr.SetBase(subnet.c_str(), "255.255.255.0");
for (uint32_t k = 0; k < nHost; k++) for (uint32_t k = 0; k < nHost; k++)
{ {
Ptr<Node> node = host[i][j].Get(k); Ptr<Node> node = host[i * nEdge + j].Get(k);
NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j)));
red.Install(ndc.Get(1)); red.Install(ndc.Get(1));
addrs[node] = addr.Assign(ndc).GetAddress(0); addrs[node] = addr.Assign(ndc).GetAddress(0);