Commit b734e145 authored by Misbah Mubarak's avatar Misbah Mubarak

Merge branch 'codes-ml-master' into 'master'

Dragonfly Plus: Bugfix and safety check

See merge request codes/codes!61
parents c2ba8ef7 55a9cbf2
......@@ -255,22 +255,34 @@ void ConnectionManager::add_connection(int dest_gid, ConnectionType type)
switch (type)
{
case CONN_LOCAL:
conn.port = this->get_used_ports_for(CONN_LOCAL);
intraGroupConnections[conn.dest_lid].push_back(conn);
_used_intra_ports++;
if (intraGroupConnections.size() < _max_intra_ports) {
conn.port = this->get_used_ports_for(CONN_LOCAL);
intraGroupConnections[conn.dest_lid].push_back(conn);
_used_intra_ports++;
}
else
tw_error(TW_LOC,"Attempting to add too many local connections per router - exceeding configuration value: %d",_max_intra_ports);
break;
case CONN_GLOBAL:
conn.port = _max_intra_ports + this->get_used_ports_for(CONN_GLOBAL);
globalConnections[conn.dest_gid].push_back(conn);
_used_inter_ports++;
if(globalConnections.size() < _max_inter_ports) {
conn.port = _max_intra_ports + this->get_used_ports_for(CONN_GLOBAL);
globalConnections[conn.dest_gid].push_back(conn);
_used_inter_ports++;
}
else
tw_error(TW_LOC,"Attempting to add too many global connections per router - exceeding configuration value: %d",_max_inter_ports);
break;
case CONN_TERMINAL:
conn.port = _max_intra_ports + _max_inter_ports + this->get_used_ports_for(CONN_TERMINAL);
conn.dest_group_id = _source_group;
terminalConnections[conn.dest_gid].push_back(conn);
_used_terminal_ports++;
if(terminalConnections.size() < _max_terminal_ports){
conn.port = _max_intra_ports + _max_inter_ports + this->get_used_ports_for(CONN_TERMINAL);
conn.dest_group_id = _source_group;
terminalConnections[conn.dest_gid].push_back(conn);
_used_terminal_ports++;
}
else
tw_error(TW_LOC,"Attempting to add too many terminal connections per router - exceeding configuration value: %d",_max_terminal_ports);
break;
default:
......@@ -534,18 +546,19 @@ void ConnectionManager::print_connections()
int group_id = it->second.dest_group_id;
int id,gid;
if( get_port_type(port_num) == CONN_LOCAL )
{
if( get_port_type(port_num) == CONN_LOCAL ) {
id = it->second.dest_lid;
gid = it->second.dest_gid;
printf(" %d -> (%d,%d) : %d \n", port_num, id, gid, group_id);
printf(" %d -> (%d,%d) : %d - LOCAL\n", port_num, id, gid, group_id);
}
else if (get_port_type(port_num) == CONN_GLOBAL) {
id = it->second.dest_gid;
printf(" %d -> %d : %d - GLOBAL\n", port_num, id, group_id);
}
else {
else if (get_port_type(port_num) == CONN_TERMINAL) {
id = it->second.dest_gid;
printf(" %d -> %d : %d \n", port_num, id, group_id);
printf(" %d -> %d : %d - TERMINAL\n", port_num, id, group_id);
}
ports_printed++;
......
......@@ -1134,18 +1134,15 @@ int dragonfly_plus_get_assigned_router_id(int terminal_id, const dragonfly_plus_
// currently supports symmetrical bipartite spine/leaf router configurations
// first half of routers in a given group are leafs which have terminals
// second half of routers in a given group are spines which have no terminals
int num_groups = p->num_groups; // number of groups of routers in the network
int num_routers = p->num_routers; // num routers per group
int num_router_leaf = p->num_router_leaf; // num leaf routers per group
int num_cn = p->num_cn; // num compute nodes per leaf router
int num_cn_per_group = (num_router_leaf * num_cn);
int group_id = terminal_id / (num_router_leaf * num_cn);
int local_router_id = terminal_id % (num_router_leaf * num_cn) / num_router_leaf;
int group_id = terminal_id / num_cn_per_group;
int local_router_id = (terminal_id / num_cn) % num_router_leaf;
int router_id = (group_id * num_routers) + local_router_id;
// printf("Terminal %d: assigned to group %d, local router id %d, global router id %d\n",terminal_id,
// group_id, local_router_id, router_id);
return router_id;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment