From 36f05e5cb7e938656540a67903c22893dd63a3d2 Mon Sep 17 00:00:00 2001 From: mubarak Date: Thu, 3 Mar 2016 11:10:53 -0500 Subject: [PATCH] Adding back router count safety checks for dragonfly, they got lost during recent changes --- src/networks/model-net/dragonfly.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/networks/model-net/dragonfly.c b/src/networks/model-net/dragonfly.c index da20879..ef84ccb 100644 --- a/src/networks/model-net/dragonfly.c +++ b/src/networks/model-net/dragonfly.c @@ -57,6 +57,7 @@ static double maxd(double a, double b) { return a < b ? b : a; } /* minimal and non-minimal packet counts for adaptive routing*/ static int minimal_count=0, nonmin_count=0; +static int num_routers_per_mgrp = 0; typedef struct dragonfly_param dragonfly_param; /* annotation-specific parameters (unannotated entry occurs at the @@ -796,6 +797,14 @@ void router_setup(router_state * r, tw_lp * lp) // shorthand const dragonfly_param *p = r->params; + num_routers_per_mgrp = codes_mapping_get_lp_count (lp_group_name, 1, "modelnet_dragonfly_router", + NULL, 0); + int num_grp_reps = codes_mapping_get_group_reps(lp_group_name); + if(p->total_routers != num_grp_reps * num_routers_per_mgrp) + tw_error(TW_LOC, "\n Config error: num_routers specified %d total routers computed in the network %d " + "does not match with repetitions * dragonfly_router %d ", + p->num_routers, p->total_routers, num_grp_reps * num_routers_per_mgrp); + r->router_id=mapping_rep_id + mapping_offset; r->group_id=r->router_id/p->num_routers; -- 2.26.2