diff --git a/src/mpi/examples/fat-tree-hybrid.cc b/src/mpi/examples/fat-tree-hybrid.cc index d5b335afe..c12df7a6b 100644 --- a/src/mpi/examples/fat-tree-hybrid.cc +++ b/src/mpi/examples/fat-tree-hybrid.cc @@ -550,10 +550,10 @@ main(int argc, char* argv[]) 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 nHost = conf::k / 2; // number of hosts under a switch - NodeContainer core[nGroup]; - NodeContainer agg[nPod]; - NodeContainer edge[nPod]; - NodeContainer host[nPod][nEdge]; + NodeContainer core = new NodeContainer[nGroup]; + NodeContainer agg = new NodeContainer[nPod]; + NodeContainer edge = new NodeContainer[nPod]; + NodeContainer host = new NodeContainer[nPod + nEdge]; // create nodes 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++) { - 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++) { - 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"); for (uint32_t k = 0; k < nHost; k++) { - Ptr node = host[i][j].Get(k); + Ptr node = host[i * nEdge + j].Get(k); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); red.Install(ndc.Get(1)); addrs[node] = addr.Assign(ndc).GetAddress(0); diff --git a/src/mpi/examples/fat-tree-mpi.cc b/src/mpi/examples/fat-tree-mpi.cc index a3443e1b3..6952eb2bd 100644 --- a/src/mpi/examples/fat-tree-mpi.cc +++ b/src/mpi/examples/fat-tree-mpi.cc @@ -554,10 +554,10 @@ main(int argc, char* argv[]) 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 nHost = conf::k / 2; // number of hosts under a switch - NodeContainer core[nGroup]; - NodeContainer agg[nPod]; - NodeContainer edge[nPod]; - NodeContainer host[nPod][nEdge]; + NodeContainer core = new NodeContainer[nGroup]; + NodeContainer agg = new NodeContainer[nPod]; + NodeContainer edge = new NodeContainer[nPod]; + NodeContainer host = new NodeContainer[nPod * nEdge]; // create nodes 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++) { - 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++) { - 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"); for (uint32_t k = 0; k < nHost; k++) { - Ptr node = host[i][j].Get(k); + Ptr node = host[i * nEdge + j].Get(k); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); red.Install(ndc.Get(1)); addrs[node] = addr.Assign(ndc).GetAddress(0); diff --git a/src/mtp/examples/fat-tree-mtp.cc b/src/mtp/examples/fat-tree-mtp.cc index 4b9127b4c..0104a4571 100644 --- a/src/mtp/examples/fat-tree-mtp.cc +++ b/src/mtp/examples/fat-tree-mtp.cc @@ -516,10 +516,10 @@ main(int argc, char* argv[]) 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 nHost = conf::k / 2; // number of hosts under a switch - NodeContainer core[nGroup]; - NodeContainer agg[nPod]; - NodeContainer edge[nPod]; - NodeContainer host[nPod][nEdge]; + NodeContainer *core = new NodeContainer[nGroup]; + NodeContainer *agg = new NodeContainer[nPod]; + NodeContainer *edge = new NodeContainer[nPod]; + NodeContainer *host = new NodeContainer[nPod * nEdge]; // create nodes 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++) { - host[i][j].Create(nHost); + host[i * nEdge + j].Create(nHost); 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"); for (uint32_t k = 0; k < nHost; k++) { - Ptr node = host[i][j].Get(k); + Ptr node = host[i * nEdge + j].Get(k); NetDeviceContainer ndc = p2p.Install(NodeContainer(node, edge[i].Get(j))); red.Install(ndc.Get(1)); addrs[node] = addr.Assign(ndc).GetAddress(0);