Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
1d17d7ca
Commit
1d17d7ca
authored
Jan 25, 2024
by
Antoine Kaufmann
Committed by
Hejing Li
Feb 01, 2024
Browse files
experiments: add support to control sync interval for e2e partition internal links
parent
a7aa2b33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
+27
-3
experiments/simbricks/orchestration/e2e_partition.py
experiments/simbricks/orchestration/e2e_partition.py
+27
-3
No files found.
experiments/simbricks/orchestration/e2e_partition.py
View file @
1d17d7ca
...
@@ -57,8 +57,30 @@ class IDMap(object):
...
@@ -57,8 +57,30 @@ class IDMap(object):
def
items
(
self
):
def
items
(
self
):
return
self
.
dict
.
items
()
return
self
.
dict
.
items
()
def
parse_duration
(
s
:
str
)
->
float
:
if
s
.
endswith
(
'ps'
):
return
float
(
s
[:
-
2
])
elif
s
.
endswith
(
'ns'
):
return
float
(
s
[:
-
2
])
*
1000
elif
s
.
endswith
(
'us'
):
return
float
(
s
[:
-
2
])
*
1000000
elif
s
.
endswith
(
'ms'
):
return
float
(
s
[:
-
2
])
*
1000000000
else
:
raise
ValueError
(
'Unknown duration unit'
)
def
stringify_duration
(
x
:
float
)
->
str
:
if
x
<
1000
:
return
f
'
{
x
}
ps'
elif
x
<
1000000
:
return
f
'
{
x
/
1000
}
ns'
elif
x
<
1000000000
:
return
f
'
{
x
/
1000000
}
us'
else
:
return
f
'
{
x
/
1000000000
}
ms'
# Split the topology into N networks, return E2ENetwork instances
# Split the topology into N networks, return E2ENetwork instances
def
partition
(
topology
,
N
,
by_weight
=
False
):
def
partition
(
topology
,
N
,
sync_delay_factor
=
1.0
,
by_weight
=
False
):
adjlists
=
collections
.
defaultdict
(
tuple
)
adjlists
=
collections
.
defaultdict
(
tuple
)
edges
=
[]
edges
=
[]
idmap
=
IDMap
()
idmap
=
IDMap
()
...
@@ -157,13 +179,15 @@ def partition(topology, N, by_weight=False):
...
@@ -157,13 +179,15 @@ def partition(topology, N, by_weight=False):
lst_a
=
comps
.
E2ESimbricksNetworkNicIf
(
f
'crossL_
{
l_i
}
_
{
r_i
}
'
)
lst_a
=
comps
.
E2ESimbricksNetworkNicIf
(
f
'crossL_
{
l_i
}
_
{
r_i
}
'
)
lst_a
.
eth_latency
=
f
'
{
l
.
delay
}
'
lst_a
.
eth_latency
=
f
'
{
l
.
delay
}
'
lst_a
.
sync_delay
=
f
'
{
l
.
delay
}
'
lst_a
.
sync_delay
=
stringify_duration
(
parse_duration
(
l
.
delay
)
*
sync_delay_factor
)
lst_a
.
simbricks_component
=
networks
[
con_p
]
lst_a
.
simbricks_component
=
networks
[
con_p
]
lst
.
add_component
(
lst_a
)
lst
.
add_component
(
lst_a
)
con_a
=
comps
.
E2ESimbricksNetworkNetIf
(
f
'crossC_
{
l_i
}
_
{
r_i
}
'
)
con_a
=
comps
.
E2ESimbricksNetworkNetIf
(
f
'crossC_
{
l_i
}
_
{
r_i
}
'
)
con_a
.
eth_latency
=
f
'
{
l
.
delay
}
'
con_a
.
eth_latency
=
f
'
{
l
.
delay
}
'
con_a
.
sync_delay
=
f
'
{
l
.
delay
}
'
con_a
.
sync_delay
=
stringify_duration
(
parse_duration
(
l
.
delay
)
*
sync_delay_factor
)
con_a
.
simbricks_component
=
networks
[
lst_p
]
con_a
.
simbricks_component
=
networks
[
lst_p
]
con_a
.
set_peer
(
lst_a
)
con_a
.
set_peer
(
lst_a
)
con
.
add_component
(
con_a
)
con
.
add_component
(
con_a
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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