Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
codes
codes
Commits
92a2f13d
Commit
92a2f13d
authored
May 24, 2018
by
Neil McGlohon
Browse files
Dragonfly Plus: Optimize get_groups_i_connect_to()
parent
317a956e
Changes
2
Hide whitespace changes
Inline
Side-by-side
codes/connection-manager.h
View file @
92a2f13d
...
...
@@ -70,7 +70,8 @@ class ConnectionManager {
map
<
int
,
Connection
>
_portMap
;
//Mapper for ports to connections
set
<
int
>
_other_groups_i_connect_to
;
vector
<
int
>
_other_groups_i_connect_to
;
set
<
int
>
_other_groups_i_connect_to_set
;
// map< int, vector< Connection > > intermediateRouterToGroupMap; //maps group id to list of routers that connect to it.
// //ex: intermediateRouterToGroupMap[3] returns a vector
...
...
@@ -200,6 +201,11 @@ public:
*/
vector
<
int
>
get_connected_group_ids
();
/**
*
*/
void
solidify_connections
();
/**
* @brief prints out the state of the connection manager
*/
...
...
@@ -265,7 +271,7 @@ void ConnectionManager::add_connection(int dest_gid, ConnectionType type)
}
if
(
conn
.
dest_group_id
!=
conn
.
src_group_id
)
_other_groups_i_connect_to
.
insert
(
conn
.
dest_group_id
);
_other_groups_i_connect_to
_set
.
insert
(
conn
.
dest_group_id
);
_portMap
[
conn
.
port
]
=
conn
;
}
...
...
@@ -449,15 +455,19 @@ vector< Connection > ConnectionManager::get_connections_by_type(ConnectionType t
vector
<
int
>
ConnectionManager
::
get_connected_group_ids
()
{
vector
<
int
>
retVec
;
return
_other_groups_i_connect_to
;
}
void
ConnectionManager
::
solidify_connections
()
{
set
<
int
>::
iterator
it
;
for
(
it
=
_other_groups_i_connect_to
.
begin
();
it
!=
_other_groups_i_connect_to
.
end
();
it
++
)
for
(
it
=
_other_groups_i_connect_to
_set
.
begin
();
it
!=
_other_groups_i_connect_to
_set
.
end
();
it
++
)
{
retVec
.
push_back
(
*
it
);
_other_groups_i_connect_to
.
push_back
(
*
it
);
}
return
retVec
;
}
void
ConnectionManager
::
print_connections
()
{
printf
(
"Connections for Router: %d ---------------------------------------
\n
"
,
_source_id_global
);
...
...
src/networks/model-net/dragonfly-plus.C
View file @
92a2f13d
...
...
@@ -1261,6 +1261,9 @@ void router_plus_setup(router_state *r, tw_lp *lp)
}
}
if
(
r
->
dfp_router_type
==
SPINE
)
r
->
connMan
->
solidify_connections
();
return
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment