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
92409c58
Commit
92409c58
authored
Aug 29, 2016
by
Noah Wolfe
Browse files
fattree-config-up-connections sim_log.txt
- fattree-config-up-connections - sim_log.txt
parent
49a47efc
Changes
1
Show whitespace changes
Inline
Side-by-side
src/networks/model-net/fattree.c
View file @
92409c58
...
...
@@ -21,12 +21,12 @@
#define TRACK_PKT 2820
#define FATTREE_HELLO 0
#define FATTREE_DEBUG 0
#define FATTREE_CONNECTIONS
0
#define FATTREE_CONNECTIONS
1
#define FATTREE_MSG 0
#define DEBUG_RC 0
//Data Collection Output Files
#define PARAMS_LOG
0
#define PARAMS_LOG
1
#define LP_CONFIG_NM (model_net_lp_config_names[FATTREE])
#define LP_METHOD_NM (model_net_method_names[FATTREE])
...
...
@@ -103,6 +103,10 @@ struct fattree_param
int
ft_type
;
// configuration parameters
int
num_levels
;
int
link_repetitions
;
int
requested_terminals
;
//Number of terminals to shoot for if possible
int
Ns
;
// number of switches per pod
int
Np
;
//Number of pods
int
*
num_switches
;
//switches at various levels
int
*
switch_radix
;
//radix of switches are various levels
double
link_bandwidth
;
/* bandwidth of a wire connecting switches */
...
...
@@ -403,6 +407,9 @@ static void fattree_read_config(const char * anno, fattree_param *p){
tw_error
(
TW_LOC
,
"Too many num_levels, only upto 3 supported Aborting
\n
"
);
}
configuration_get_value_int
(
&
config
,
"PARAMS"
,
"requested_terminals"
,
anno
,
&
p
->
requested_terminals
);
p
->
num_switches
=
(
int
*
)
malloc
(
p
->
num_levels
*
sizeof
(
int
));
p
->
switch_radix
=
(
int
*
)
malloc
(
p
->
num_levels
*
sizeof
(
int
));
...
...
@@ -447,14 +454,35 @@ static void fattree_read_config(const char * anno, fattree_param *p){
token
=
strtok
(
NULL
,
","
);
}
p
->
Ns
=
p
->
switch_radix
[
0
]
/
2
;
if
(
p
->
num_levels
==
2
)
{
p
->
num_switches
[
1
]
=
p
->
num_switches
[
0
]
/
2
;
p
->
switch_radix
[
1
]
=
p
->
switch_radix
[
0
];
}
else
{
if
(
p
->
ft_type
==
0
){
p
->
Np
=
ceil
((
double
)
p
->
requested_terminals
/
(
double
)(
p
->
Ns
*
p
->
Ns
));
p
->
num_switches
[
1
]
=
p
->
num_switches
[
0
];
p
->
num_switches
[
2
]
=
ceil
((
p
->
Ns
*
p
->
Ns
)
/
floor
(
p
->
switch_radix
[
0
]
/
p
->
Np
));
p
->
switch_radix
[
1
]
=
p
->
switch_radix
[
2
]
=
p
->
switch_radix
[
0
];
p
->
link_repetitions
=
floor
(
p
->
switch_radix
[
2
]
/
p
->
Np
);
printf
(
"Np:%d Ns:%d requested_terminals:%d
\n
"
,
p
->
Np
,
p
->
Ns
,
p
->
requested_terminals
);
}
else
{
p
->
num_switches
[
1
]
=
p
->
num_switches
[
0
];
p
->
num_switches
[
2
]
=
p
->
num_switches
[
0
]
/
2
;
p
->
switch_radix
[
1
]
=
p
->
switch_radix
[
2
]
=
p
->
switch_radix
[
0
];
}
}
if
(
p
->
num_levels
==
2
){
if
(
p
->
requested_terminals
>
2
*
(
p
->
switch_radix
[
0
]
/
2
)
*
(
p
->
switch_radix
[
0
]
/
2
)){
tw_error
(
TW_LOC
,
"too many terminals requested. Can't maintain full bisection bandwidth for given radix."
);
}
}
else
{
if
(
p
->
requested_terminals
>
2
*
(
p
->
switch_radix
[
0
]
/
2
)
*
(
p
->
switch_radix
[
0
]
/
2
)
*
(
p
->
switch_radix
[
0
]
/
2
)){
tw_error
(
TW_LOC
,
"too many terminals requested. Can't maintain full bisection bandwidth for given radix."
);
}
}
#if FATTREE_DEBUG
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
)
...
...
@@ -468,15 +496,15 @@ static void fattree_read_config(const char * anno, fattree_param *p){
for
(
i
=
1
;
i
<
p
->
num_levels
-
1
;
i
++
)
{
if
(
p
->
num_switches
[
i
-
1
]
*
p
->
switch_radix
[
i
-
1
]
>
p
->
num_switches
[
i
]
*
p
->
switch_radix
[
i
])
{
tw_error
(
TW_LOC
,
"Not enough switches/radix at level %d for full "
"bisection bandwidth
\n
"
,
i
);
//
tw_error(TW_LOC, "Not enough switches/radix at level %d for full "
//
"bisection bandwidth\n", i);
}
}
if
(
p
->
num_switches
[
i
-
1
]
*
p
->
switch_radix
[
i
-
1
]
>
2
*
p
->
num_switches
[
i
]
*
p
->
switch_radix
[
i
])
{
tw_error
(
TW_LOC
,
"Not enough switches/radix at level %d (top) for full "
"bisection bandwidth
\n
"
,
i
);
//
tw_error(TW_LOC, "Not enough switches/radix at level %d (top) for full "
//
"bisection bandwidth\n", i);
}
configuration_get_value_int
(
&
config
,
"PARAMS"
,
"packet_size"
,
anno
,
...
...
@@ -838,9 +866,34 @@ void switch_init(switch_state * r, tw_lp * lp)
if
(
p
->
num_levels
==
3
)
{
int
l2_base
=
0
;
if
(
p
->
ft_type
==
0
)
{
for
(
int
rep
=
0
;
rep
<
p
->
link_repetitions
;
rep
++
){
int
l2
=
((
r
->
switch_id
-
p
->
num_switches
[
0
])
%
p
->
l1_set_size
+
rep
*
p
->
l1_set_size
);
printf
(
"link_repetitions:%d
\n
"
,
p
->
link_repetitions
);
/* not true anymore */
r
->
start_uneigh
=
p
->
num_switches
[
0
]
+
l2
;
r
->
con_per_uneigh
=
p
->
link_repetitions
;
for
(;
l2
<
p
->
num_switches
[
2
];
l2
+=
p
->
l1_set_size
)
{
tw_lpid
nextTerm
;
codes_mapping_get_lp_id
(
lp_group_name
,
"fattree_switch"
,
NULL
,
1
,
l2
,
2
,
&
nextTerm
);
for
(
int
con
=
0
;
con
<
r
->
con_per_uneigh
;
con
++
)
{
r
->
port_connections
[
r
->
num_cons
++
]
=
nextTerm
;
#if FATTREE_CONNECTIONS
codes_mapping_get_lp_info
(
nextTerm
,
lp_group_name
,
&
mapping_grp_id
,
NULL
,
&
mapping_type_id
,
anno
,
&
mapping_rep_id
,
&
mapping_offset
);
next_switch_lid
=
mapping_rep_id
+
mapping_offset
*
p
->
num_switches
[
0
];
written
+=
sprintf
(
r
->
output_buf
+
written
,
"%u, %llu, "
,
r
->
switch_id
+
p
->
num_terminals
,
LLU
(
next_switch_lid
)
+
p
->
num_terminals
);
#endif
#if FATTREE_DEBUG
printf
(
"I am switch %d, connect to upper switch %d L2 (%llu) at port %d yes collecting
\n
"
,
r
->
switch_id
,
l2
+
rep
*
p
->
l1_set_size
,
LLU
(
nextTerm
),
r
->
num_cons
-
1
);
#endif
}
}
}
// int l2_base = 0;
/* not true anymore */
r
->
start_uneigh
=
p
->
num_switches
[
0
]
+
l2_base
;
/*
r->start_uneigh = p->num_switches[0] + l2_base;
r->con_per_uneigh = 1;
if(((int)r->switch_id - p->num_switches[0]) % p->l1_set_size >=
p->l1_set_size/2) {
...
...
@@ -864,12 +917,17 @@ void switch_init(switch_state * r, tw_lp * lp)
#endif
}
l2_base++;
}
*/
}
else
{
int
l2
=
((
r
->
switch_id
-
p
->
num_switches
[
0
])
%
p
->
l1_set_size
);
/* not true anymore */
r
->
start_uneigh
=
p
->
num_switches
[
0
]
+
l2
;
if
(
p
->
ft_type
==
1
){
r
->
con_per_uneigh
=
1
;
}
else
{
r
->
con_per_uneigh
=
2
;
}
for
(;
l2
<
p
->
num_switches
[
2
];
l2
+=
p
->
l1_set_size
)
{
tw_lpid
nextTerm
;
codes_mapping_get_lp_id
(
lp_group_name
,
"fattree_switch"
,
NULL
,
1
,
...
...
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