From ae3268f6f8aaca7f7dba0a222cd782e913f0c2ef Mon Sep 17 00:00:00 2001 From: Nic McDonald Date: Thu, 27 Feb 2020 00:17:06 -0800 Subject: [PATCH] Fix num routers and router radix assumption in info logging (#8) * Fix num routers and router radix assumption in info logging * Fix Dragonfly router lookup bug --- src/main.cc | 10 ++++++++-- src/network/dragonfly/Network.cc | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.cc b/src/main.cc index 20a1726..c2282a3 100644 --- a/src/main.cc +++ b/src/main.cc @@ -60,13 +60,19 @@ s32 main(s32 _argc, char** _argv) { gSim->setNetwork(network); u32 numInterfaces = network->numInterfaces(); u32 numRouters = network->numRouters(); - u32 routerRadix = network->getRouter(0)->numPorts(); + std::map routerRadices; + for (u32 routerId = 0; routerId < numRouters; routerId++) { + routerRadices[network->getRouter(routerId)->numPorts()] += 1; + } u32 numVcs = network->numVcs(); u64 numComponents = Component::numComponents(); gSim->infoLog.logInfo("Endpoints", std::to_string(numInterfaces)); gSim->infoLog.logInfo("Routers", std::to_string(numRouters)); - gSim->infoLog.logInfo("Router0 Radix", std::to_string(routerRadix)); + for (auto& p : routerRadices) { + gSim->infoLog.logInfo("Router radix " + std::to_string(p.first), + std::to_string(p.second)); + } gSim->infoLog.logInfo("VCs", std::to_string(numVcs)); gSim->infoLog.logInfo("Components", std::to_string(numComponents)); diff --git a/src/network/dragonfly/Network.cc b/src/network/dragonfly/Network.cc index 5a4047c..e9e4217 100644 --- a/src/network/dragonfly/Network.cc +++ b/src/network/dragonfly/Network.cc @@ -310,8 +310,8 @@ u32 Network::numInterfaces() const { Router* Network::getRouter(u32 _id) const { std::vector routerAddress; translateRouterIdToAddress(_id, &routerAddress); - u32 g = routerAddress.at(0); - u32 r = routerAddress.at(1); + u32 g = routerAddress.at(1); + u32 r = routerAddress.at(0); return routers_.at(g).at(r); }