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
78d4c701
Commit
78d4c701
authored
Jul 02, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Jul 12, 2022
Browse files
fix all pylint issues except missing doc strings in experiments/
parent
7549fa9e
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
65 deletions
+41
-65
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+41
-65
results/scale_host.py
results/scale_host.py
+0
-0
results/scale_load.py
results/scale_load.py
+0
-0
No files found.
experiments/simbricks/simulators.py
View file @
78d4c701
...
@@ -48,10 +48,12 @@ class Simulator(object):
...
@@ -48,10 +48,12 @@ class Simulator(object):
"""Full name of the simulator."""
"""Full name of the simulator."""
return
''
return
''
# pylint: disable=unused-argument
def
prep_cmds
(
self
,
env
:
ExpEnv
)
->
tp
.
List
[
str
]:
def
prep_cmds
(
self
,
env
:
ExpEnv
)
->
tp
.
List
[
str
]:
"""Commands to run to prepare simulator."""
"""Commands to run to prepare simulator."""
return
[]
return
[]
# pylint: disable=unused-argument
def
run_cmd
(
self
,
env
:
ExpEnv
)
->
tp
.
Optional
[
str
]:
def
run_cmd
(
self
,
env
:
ExpEnv
)
->
tp
.
Optional
[
str
]:
"""Command to run to execute simulator."""
"""Command to run to execute simulator."""
return
None
return
None
...
@@ -61,10 +63,12 @@ class Simulator(object):
...
@@ -61,10 +63,12 @@ class Simulator(object):
return
[]
return
[]
# Sockets to be cleaned up
# Sockets to be cleaned up
# pylint: disable=unused-argument
def
sockets_cleanup
(
self
,
env
:
ExpEnv
):
def
sockets_cleanup
(
self
,
env
:
ExpEnv
):
return
[]
return
[]
# sockets to wait for indicating the simulator is ready
# sockets to wait for indicating the simulator is ready
# pylint: disable=unused-argument
def
sockets_wait
(
self
,
env
:
ExpEnv
):
def
sockets_wait
(
self
,
env
:
ExpEnv
):
return
[]
return
[]
...
@@ -82,9 +86,6 @@ class PCIDevSim(Simulator):
...
@@ -82,9 +86,6 @@ class PCIDevSim(Simulator):
sync_period
=
500
sync_period
=
500
pci_latency
=
500
pci_latency
=
500
def
__init__
(
self
):
super
().
__init__
()
def
full_name
(
self
):
def
full_name
(
self
):
return
'dev.'
+
self
.
name
return
'dev.'
+
self
.
name
...
@@ -100,18 +101,16 @@ class NICSim(PCIDevSim):
...
@@ -100,18 +101,16 @@ class NICSim(PCIDevSim):
mac
=
None
mac
=
None
eth_latency
=
500
eth_latency
=
500
def
__init__
(
self
):
super
().
__init__
()
def
set_network
(
self
,
net
:
NetSim
):
def
set_network
(
self
,
net
:
NetSim
):
self
.
network
=
net
self
.
network
=
net
net
.
nics
.
append
(
self
)
net
.
nics
.
append
(
self
)
def
basic_args
(
self
,
env
,
extra
=
None
):
def
basic_args
(
self
,
env
,
extra
=
None
):
cmd
=
'%s %s %s %d %d %d %d %d'
%
\
cmd
=
(
(
env
.
dev_pci_path
(
self
),
env
.
nic_eth_path
(
self
),
f
'
{
env
.
dev_pci_path
(
self
)
}
{
env
.
nic_eth_path
(
self
)
}
'
env
.
dev_shm_path
(
self
),
self
.
sync_mode
,
self
.
start_tick
,
f
'
{
env
.
dev_shm_path
(
self
)
}
{
self
.
sync_mode
}
{
self
.
sync_period
}
'
self
.
sync_period
,
self
.
pci_latency
,
self
.
eth_latency
)
f
'
{
self
.
start_tick
}
{
self
.
pci_latency
}
{
self
.
eth_latency
}
'
)
if
self
.
mac
is
not
None
:
if
self
.
mac
is
not
None
:
cmd
+=
' '
+
(
''
.
join
(
reversed
(
self
.
mac
.
split
(
':'
))))
cmd
+=
' '
+
(
''
.
join
(
reversed
(
self
.
mac
.
split
(
':'
))))
...
@@ -120,9 +119,7 @@ class NICSim(PCIDevSim):
...
@@ -120,9 +119,7 @@ class NICSim(PCIDevSim):
return
cmd
return
cmd
def
basic_run_cmd
(
self
,
env
,
name
,
extra
=
None
):
def
basic_run_cmd
(
self
,
env
,
name
,
extra
=
None
):
cmd
=
'%s/%s %s'
%
\
cmd
=
f
'
{
env
.
repodir
}
/sims/nic/
{
name
}
{
self
.
basic_args
(
env
,
extra
)
}
'
(
env
.
repodir
+
'/sims/nic'
,
name
,
self
.
basic_args
(
env
,
extra
))
return
cmd
return
cmd
def
full_name
(
self
):
def
full_name
(
self
):
...
@@ -235,9 +232,6 @@ class QemuHost(HostSim):
...
@@ -235,9 +232,6 @@ class QemuHost(HostSim):
sync
=
False
sync
=
False
cpu_freq
=
'4GHz'
cpu_freq
=
'4GHz'
def
__init__
(
self
):
super
().
__init__
()
def
resreq_cores
(
self
):
def
resreq_cores
(
self
):
if
self
.
sync
:
if
self
.
sync
:
return
1
return
1
...
@@ -248,7 +242,6 @@ class QemuHost(HostSim):
...
@@ -248,7 +242,6 @@ class QemuHost(HostSim):
return
8192
return
8192
def
prep_cmds
(
self
,
env
):
def
prep_cmds
(
self
,
env
):
to_path
=
env
.
hdcopy_path
(
self
)
return
[
return
[
f
'
{
env
.
qemu_img_path
}
create -f qcow2 -o '
f
'
{
env
.
qemu_img_path
}
create -f qcow2 -o '
f
'backing_file="
{
env
.
hd_path
(
self
.
node_config
.
disk_image
)
}
" '
f
'backing_file="
{
env
.
hd_path
(
self
.
node_config
.
disk_image
)
}
" '
...
@@ -293,7 +286,7 @@ class QemuHost(HostSim):
...
@@ -293,7 +286,7 @@ class QemuHost(HostSim):
cmd
+=
' '
cmd
+=
' '
# qemu does not currently support net direct ports
# qemu does not currently support net direct ports
assert
(
len
(
self
.
net_directs
)
==
0
)
assert
len
(
self
.
net_directs
)
==
0
return
cmd
return
cmd
...
@@ -332,7 +325,8 @@ class Gem5Host(HostSim):
...
@@ -332,7 +325,8 @@ class Gem5Host(HostSim):
f
'
{
env
.
gem5_py_path
}
--caches --l2cache --l3cache '
f
'
{
env
.
gem5_py_path
}
--caches --l2cache --l3cache '
'--l1d_size=32kB --l1i_size=32kB --l2_size=2MB --l3_size=32MB '
'--l1d_size=32kB --l1i_size=32kB --l2_size=2MB --l3_size=32MB '
'--l1d_assoc=8 --l1i_assoc=8 --l2_assoc=4 --l3_assoc=16 '
'--l1d_assoc=8 --l1i_assoc=8 --l2_assoc=4 --l3_assoc=16 '
f
'--cacheline_size=64 --cpu-clock=
{
self
.
cpu_freq
}
--sys-clock=
{
self
.
sys_clock
}
'
f
'--cacheline_size=64 --cpu-clock=
{
self
.
cpu_freq
}
'
f
' --sys-clock=
{
self
.
sys_clock
}
'
f
'--checkpoint-dir=
{
env
.
gem5_cpdir
(
self
)
}
'
f
'--checkpoint-dir=
{
env
.
gem5_cpdir
(
self
)
}
'
f
'--kernel=
{
env
.
gem5_kernel_path
}
'
f
'--kernel=
{
env
.
gem5_kernel_path
}
'
f
'--disk-image=
{
env
.
hd_raw_path
(
self
.
node_config
.
disk_image
)
}
'
f
'--disk-image=
{
env
.
hd_raw_path
(
self
.
node_config
.
disk_image
)
}
'
...
@@ -377,9 +371,6 @@ class Gem5Host(HostSim):
...
@@ -377,9 +371,6 @@ class Gem5Host(HostSim):
class
CorundumVerilatorNIC
(
NICSim
):
class
CorundumVerilatorNIC
(
NICSim
):
clock_freq
=
250
# MHz
clock_freq
=
250
# MHz
def
__init__
(
self
):
super
().
__init__
()
def
resreq_mem
(
self
):
def
resreq_mem
(
self
):
# this is a guess
# this is a guess
return
512
return
512
...
@@ -392,18 +383,12 @@ class CorundumVerilatorNIC(NICSim):
...
@@ -392,18 +383,12 @@ class CorundumVerilatorNIC(NICSim):
class
CorundumBMNIC
(
NICSim
):
class
CorundumBMNIC
(
NICSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
return
self
.
basic_run_cmd
(
env
,
'/corundum_bm/corundum_bm'
)
return
self
.
basic_run_cmd
(
env
,
'/corundum_bm/corundum_bm'
)
class
I40eNIC
(
NICSim
):
class
I40eNIC
(
NICSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
return
self
.
basic_run_cmd
(
env
,
'/i40e_bm/i40e_bm'
)
return
self
.
basic_run_cmd
(
env
,
'/i40e_bm/i40e_bm'
)
...
@@ -411,9 +396,6 @@ class I40eNIC(NICSim):
...
@@ -411,9 +396,6 @@ class I40eNIC(NICSim):
class
E1000NIC
(
NICSim
):
class
E1000NIC
(
NICSim
):
debug
=
False
debug
=
False
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
self
.
basic_run_cmd
(
env
,
'/e1000_gem5/e1000_gem5'
)
cmd
=
self
.
basic_run_cmd
(
env
,
'/e1000_gem5/e1000_gem5'
)
if
self
.
debug
:
if
self
.
debug
:
...
@@ -462,7 +444,7 @@ class I40eMultiNIC(Simulator):
...
@@ -462,7 +444,7 @@ class I40eMultiNIC(Simulator):
args
+=
' -- '
args
+=
' -- '
first
=
False
first
=
False
args
+=
sn
.
basic_args
(
env
)
args
+=
sn
.
basic_args
(
env
)
return
'%s
/sims/nic/i40e_bm/i40e_bm
%s'
%
(
env
.
repodir
,
args
)
return
f
'
{
env
.
repodir
}
/sims/nic/i40e_bm/i40e_bm
{
args
}
'
def
sockets_cleanup
(
self
,
env
):
def
sockets_cleanup
(
self
,
env
):
ss
=
[]
ss
=
[]
...
@@ -479,16 +461,14 @@ class I40eMultiNIC(Simulator):
...
@@ -479,16 +461,14 @@ class I40eMultiNIC(Simulator):
class
WireNet
(
NetSim
):
class
WireNet
(
NetSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
connects
=
self
.
connect_sockets
(
env
)
connects
=
self
.
connect_sockets
(
env
)
assert
len
(
connects
)
==
2
assert
len
(
connects
)
==
2
cmd
=
'%s/sims/net/wire/net_wire %s %s %d %d %d'
%
\
cmd
=
(
(
env
.
repodir
,
connects
[
0
][
1
],
f
'
{
env
.
repodir
}
/sims/net/wire/net_wire
{
connects
[
0
][
1
]
}
'
connects
[
1
][
1
],
f
' connects[1][1]
{
self
.
sync_mode
}
{
self
.
sync_period
}
'
self
.
sync_mode
,
self
.
sync_period
,
self
.
eth_latency
)
f
'
{
self
.
eth_latency
}
'
)
if
len
(
env
.
pcap_file
)
>
0
:
if
len
(
env
.
pcap_file
)
>
0
:
cmd
+=
' '
+
env
.
pcap_file
cmd
+=
' '
+
env
.
pcap_file
return
cmd
return
cmd
...
@@ -497,9 +477,6 @@ class WireNet(NetSim):
...
@@ -497,9 +477,6 @@ class WireNet(NetSim):
class
SwitchNet
(
NetSim
):
class
SwitchNet
(
NetSim
):
sync
=
True
sync
=
True
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
env
.
repodir
+
'/sims/net/switch/net_switch'
cmd
=
env
.
repodir
+
'/sims/net/switch/net_switch'
cmd
+=
f
' -S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
'
cmd
+=
f
' -S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
'
...
@@ -529,12 +506,12 @@ class TofinoNet(NetSim):
...
@@ -529,12 +506,12 @@ class TofinoNet(NetSim):
tofino_log_path
=
'/tmp/model.ldjson'
tofino_log_path
=
'/tmp/model.ldjson'
sync
=
True
sync
=
True
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
env
.
repodir
+
'/sims/net/tofino/tofino'
cmd
=
f
'
{
env
.
repodir
}
/sims/net/tofino/tofino'
cmd
+=
f
' -S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
-t
{
self
.
tofino_log_path
}
'
cmd
+=
(
f
' -S
{
self
.
sync_period
}
-E
{
self
.
eth_latency
}
'
f
' -t
{
self
.
tofino_log_path
}
'
)
if
not
self
.
sync
:
if
not
self
.
sync
:
cmd
+=
' -u'
cmd
+=
' -u'
for
(
_
,
n
)
in
self
.
connect_sockets
(
env
):
for
(
_
,
n
)
in
self
.
connect_sockets
(
env
):
...
@@ -544,9 +521,6 @@ class TofinoNet(NetSim):
...
@@ -544,9 +521,6 @@ class TofinoNet(NetSim):
class
NS3DumbbellNet
(
NetSim
):
class
NS3DumbbellNet
(
NetSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
ports
=
''
ports
=
''
for
(
n
,
s
)
in
self
.
connect_sockets
(
env
):
for
(
n
,
s
)
in
self
.
connect_sockets
(
env
):
...
@@ -555,7 +529,10 @@ class NS3DumbbellNet(NetSim):
...
@@ -555,7 +529,10 @@ class NS3DumbbellNet(NetSim):
else
:
else
:
ports
+=
'--CosimPortRight='
+
s
+
' '
ports
+=
'--CosimPortRight='
+
s
+
' '
cmd
=
env
.
repodir
+
'/sims/external/ns-3'
+
'/cosim-run.sh cosim cosim-dumbbell-example '
+
ports
+
' '
+
self
.
opt
cmd
=
(
f
'
{
env
.
repodir
}
/sims/external/ns-3'
f
'/cosim-run.sh cosim cosim-dumbbell-example
{
ports
}
{
self
.
opt
}
'
)
print
(
cmd
)
print
(
cmd
)
return
cmd
return
cmd
...
@@ -563,15 +540,15 @@ class NS3DumbbellNet(NetSim):
...
@@ -563,15 +540,15 @@ class NS3DumbbellNet(NetSim):
class
NS3BridgeNet
(
NetSim
):
class
NS3BridgeNet
(
NetSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
ports
=
''
ports
=
''
for
(
_
,
n
)
in
self
.
connect_sockets
(
env
):
for
(
_
,
n
)
in
self
.
connect_sockets
(
env
):
ports
+=
'--CosimPort='
+
n
+
' '
ports
+=
'--CosimPort='
+
n
+
' '
cmd
=
env
.
repodir
+
'/sims/external/ns-3'
+
'/cosim-run.sh cosim cosim-bridge-example '
+
ports
+
' '
+
self
.
opt
cmd
=
(
f
'
{
env
.
repodir
}
/sims/external/ns-3'
f
'/cosim-run.sh cosim cosim-bridge-example
{
ports
}
{
self
.
opt
}
'
)
print
(
cmd
)
print
(
cmd
)
return
cmd
return
cmd
...
@@ -579,9 +556,6 @@ class NS3BridgeNet(NetSim):
...
@@ -579,9 +556,6 @@ class NS3BridgeNet(NetSim):
class
NS3SequencerNet
(
NetSim
):
class
NS3SequencerNet
(
NetSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
ports
=
''
ports
=
''
for
(
n
,
s
)
in
self
.
connect_sockets
(
env
):
for
(
n
,
s
)
in
self
.
connect_sockets
(
env
):
...
@@ -593,17 +567,19 @@ class NS3SequencerNet(NetSim):
...
@@ -593,17 +567,19 @@ class NS3SequencerNet(NetSim):
ports
+=
'--ServerPort='
+
s
+
' '
ports
+=
'--ServerPort='
+
s
+
' '
else
:
else
:
raise
Exception
(
'Wrong NIC type'
)
raise
Exception
(
'Wrong NIC type'
)
cmd
=
env
.
repodir
+
'/sims/external/ns-3'
+
'/cosim-run.sh sequencer sequencer-single-switch-example '
+
ports
+
' '
+
self
.
opt
cmd
=
(
f
'
{
env
.
repodir
}
/sims/external/ns-3'
f
'/cosim-run.sh sequencer sequencer-single-switch-example'
f
'
{
ports
}
{
self
.
opt
}
'
)
return
cmd
return
cmd
class
FEMUDev
(
PCIDevSim
):
class
FEMUDev
(
PCIDevSim
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
'%s%s %s %s'
%
\
cmd
=
(
(
env
.
repodir
,
'/sims/external/femu/femu-simbricks'
,
f
'
{
env
.
repodir
}
/sims/external/femu/femu-simbricks'
env
.
dev_pci_path
(
self
),
env
.
dev_shm_path
(
self
))
f
'
{
env
.
dev_pci_path
(
self
)
}
{
env
.
dev_shm_path
(
self
)
}
'
)
return
cmd
return
cmd
results/
S
cale
H
ost.py
→
results/
s
cale
_h
ost.py
View file @
78d4c701
File moved
results/
S
cale
L
oad.py
→
results/
s
cale
_l
oad.py
View file @
78d4c701
File moved
Prev
1
2
3
4
Next
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