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
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
323 additions
and
306 deletions
+323
-306
experiments/pyexps/pci_validation.py
experiments/pyexps/pci_validation.py
+4
-3
experiments/pyexps/qemu_tcp_multi.py
experiments/pyexps/qemu_tcp_multi.py
+4
-4
experiments/pyexps/qemu_tcp_single.py
experiments/pyexps/qemu_tcp_single.py
+6
-6
experiments/pyexps/qemu_udp_multi.py
experiments/pyexps/qemu_udp_multi.py
+4
-4
experiments/pyexps/qemu_udp_single.py
experiments/pyexps/qemu_udp_single.py
+6
-6
experiments/pyexps/rpc_singlecore.py
experiments/pyexps/rpc_singlecore.py
+6
-6
experiments/pyexps/scalability.py
experiments/pyexps/scalability.py
+12
-12
experiments/pyexps/scale_host.py
experiments/pyexps/scale_host.py
+15
-15
experiments/pyexps/scale_load.py
experiments/pyexps/scale_load.py
+25
-25
experiments/run.py
experiments/run.py
+23
-19
experiments/simbricks/exectools.py
experiments/simbricks/exectools.py
+26
-20
experiments/simbricks/experiment/experiment_environment.py
experiments/simbricks/experiment/experiment_environment.py
+24
-19
experiments/simbricks/experiments.py
experiments/simbricks/experiments.py
+25
-25
experiments/simbricks/nodeconfig.py
experiments/simbricks/nodeconfig.py
+92
-74
experiments/simbricks/proxy.py
experiments/simbricks/proxy.py
+2
-20
experiments/simbricks/runtime/common.py
experiments/simbricks/runtime/common.py
+8
-8
experiments/simbricks/runtime/distributed.py
experiments/simbricks/runtime/distributed.py
+10
-9
experiments/simbricks/runtime/local.py
experiments/simbricks/runtime/local.py
+15
-15
experiments/simbricks/runtime/slurm.py
experiments/simbricks/runtime/slurm.py
+10
-10
experiments/simbricks/simulator_utils.py
experiments/simbricks/simulator_utils.py
+6
-6
No files found.
experiments/pyexps/pci_validation.py
View file @
78d4c701
...
@@ -67,9 +67,10 @@ for internal in [True, False]:
...
@@ -67,9 +67,10 @@ for internal in [True, False]:
for
h
in
[
client
,
server
]:
for
h
in
[
client
,
server
]:
h
.
cpu_type
=
h
.
cpu_type_cp
=
'TimingSimpleCPU'
h
.
cpu_type
=
h
.
cpu_type_cp
=
'TimingSimpleCPU'
h
.
variant
=
'opt'
# need opt gem5 variant with debug support
h
.
variant
=
'opt'
# need opt gem5 variant with debug support
h
.
extra_main_args
.
append
(
h
.
extra_main_args
.
append
((
'--debug-flags=SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc'
'--debug-flags='
)
'SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc'
))
if
internal
:
if
internal
:
h
.
add_netdirect
(
net
)
h
.
add_netdirect
(
net
)
else
:
else
:
...
...
experiments/pyexps/qemu_tcp_multi.py
View file @
78d4c701
...
@@ -45,15 +45,15 @@ experiments = []
...
@@ -45,15 +45,15 @@ experiments = []
for
n
in
kinds_of_net
:
for
n
in
kinds_of_net
:
if
n
==
'switch'
:
if
n
==
'switch'
:
n
et
_c
lass
=
sim
.
SwitchNet
N
et
C
lass
=
sim
.
SwitchNet
if
n
==
'dumbbell'
:
if
n
==
'dumbbell'
:
n
et
_c
lass
=
sim
.
NS3DumbbellNet
N
et
C
lass
=
sim
.
NS3DumbbellNet
if
n
==
'bridge'
:
if
n
==
'bridge'
:
n
et
_c
lass
=
sim
.
NS3BridgeNet
N
et
C
lass
=
sim
.
NS3BridgeNet
# set nic sim
# set nic sim
for
c
in
kinds_of_nic
:
for
c
in
kinds_of_nic
:
net
=
n
et
_c
lass
()
net
=
N
et
C
lass
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPm'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPm'
)
e
.
add_network
(
net
)
e
.
add_network
(
net
)
...
...
experiments/pyexps/qemu_tcp_single.py
View file @
78d4c701
...
@@ -43,19 +43,19 @@ experiments = []
...
@@ -43,19 +43,19 @@ experiments = []
# set network sim
# set network sim
for
n
in
kinds_of_net
:
for
n
in
kinds_of_net
:
if
n
==
'wire'
:
if
n
==
'wire'
:
n
et
_c
lass
=
sim
.
WireNet
N
et
C
lass
=
sim
.
WireNet
if
n
==
'switch'
:
if
n
==
'switch'
:
n
et
_c
lass
=
sim
.
SwitchNet
N
et
C
lass
=
sim
.
SwitchNet
if
n
==
'dumbbell'
:
if
n
==
'dumbbell'
:
n
et
_c
lass
=
sim
.
NS3DumbbellNet
N
et
C
lass
=
sim
.
NS3DumbbellNet
if
n
==
'bridge'
:
if
n
==
'bridge'
:
n
et
_c
lass
=
sim
.
NS3BridgeNet
N
et
C
lass
=
sim
.
NS3BridgeNet
if
n
==
'tofino'
:
if
n
==
'tofino'
:
n
et
_c
lass
=
sim
.
TofinoNet
N
et
C
lass
=
sim
.
TofinoNet
# set nic sim
# set nic sim
for
c
in
kinds_of_nic
:
for
c
in
kinds_of_nic
:
net
=
n
et
_c
lass
()
net
=
N
et
C
lass
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPs'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPs'
)
e
.
add_network
(
net
)
e
.
add_network
(
net
)
...
...
experiments/pyexps/qemu_udp_multi.py
View file @
78d4c701
...
@@ -47,15 +47,15 @@ experiments = []
...
@@ -47,15 +47,15 @@ experiments = []
for
n
in
kinds_of_net
:
for
n
in
kinds_of_net
:
if
n
==
'switch'
:
if
n
==
'switch'
:
n
et
_c
lass
=
sim
.
SwitchNet
N
et
C
lass
=
sim
.
SwitchNet
if
n
==
'dumbbell'
:
if
n
==
'dumbbell'
:
n
et
_c
lass
=
sim
.
NS3DumbbellNet
N
et
C
lass
=
sim
.
NS3DumbbellNet
if
n
==
'bridge'
:
if
n
==
'bridge'
:
n
et
_c
lass
=
sim
.
NS3BridgeNet
N
et
C
lass
=
sim
.
NS3BridgeNet
# set nic sim
# set nic sim
for
c
in
kinds_of_nic
:
for
c
in
kinds_of_nic
:
net
=
n
et
_c
lass
()
net
=
N
et
C
lass
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPm'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPm'
)
e
.
add_network
(
net
)
e
.
add_network
(
net
)
...
...
experiments/pyexps/qemu_udp_single.py
View file @
78d4c701
...
@@ -45,19 +45,19 @@ experiments = []
...
@@ -45,19 +45,19 @@ experiments = []
# set network sim
# set network sim
for
n
in
kinds_of_net
:
for
n
in
kinds_of_net
:
if
n
==
'wire'
:
if
n
==
'wire'
:
n
et
_c
lass
=
sim
.
WireNet
N
et
C
lass
=
sim
.
WireNet
if
n
==
'switch'
:
if
n
==
'switch'
:
n
et
_c
lass
=
sim
.
SwitchNet
N
et
C
lass
=
sim
.
SwitchNet
if
n
==
'dumbbell'
:
if
n
==
'dumbbell'
:
n
et
_c
lass
=
sim
.
NS3DumbbellNet
N
et
C
lass
=
sim
.
NS3DumbbellNet
if
n
==
'bridge'
:
if
n
==
'bridge'
:
n
et
_c
lass
=
sim
.
NS3BridgeNet
N
et
C
lass
=
sim
.
NS3BridgeNet
if
n
==
'tofino'
:
if
n
==
'tofino'
:
n
et
_c
lass
=
sim
.
TofinoNet
N
et
C
lass
=
sim
.
TofinoNet
# set nic sim
# set nic sim
for
c
in
kinds_of_nic
:
for
c
in
kinds_of_nic
:
net
=
n
et
_c
lass
()
net
=
N
et
C
lass
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPs'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPs'
)
e
.
add_network
(
net
)
e
.
add_network
(
net
)
...
...
experiments/pyexps/rpc_singlecore.py
View file @
78d4c701
...
@@ -34,20 +34,20 @@ experiments = []
...
@@ -34,20 +34,20 @@ experiments = []
for
msg_size
in
msg_sizes
:
for
msg_size
in
msg_sizes
:
for
stack
in
stacks
:
for
stack
in
stacks
:
e
=
exp
.
Experiment
(
e
=
exp
.
Experiment
(
'qemu-ib-switch-rpc-
%s
-1t-1fpc-
%db-0mpc'
%
(
stack
,
msg_size
)
f
'qemu-ib-switch-rpc-
{
stack
}
-1t-1fpc-
{
msg_size
}
b-0mpc'
)
)
net
=
sim
.
SwitchNet
()
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
e
.
add_network
(
net
)
if
stack
==
'tas'
:
if
stack
==
'tas'
:
n
=
node
.
TASNode
N
=
node
.
TASNode
elif
stack
==
'mtcp'
:
elif
stack
==
'mtcp'
:
n
=
node
.
MtcpNode
N
=
node
.
MtcpNode
else
:
else
:
n
=
node
.
I40eLinuxNode
N
=
node
.
I40eLinuxNode
servers
=
create_basic_hosts
(
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
n
,
node
.
RPCServer
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
N
,
node
.
RPCServer
)
)
clients
=
create_basic_hosts
(
clients
=
create_basic_hosts
(
...
@@ -57,7 +57,7 @@ for msg_size in msg_sizes:
...
@@ -57,7 +57,7 @@ for msg_size in msg_sizes:
net
,
net
,
sim
.
I40eNIC
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
sim
.
QemuHost
,
n
,
N
,
node
.
RPCClient
,
node
.
RPCClient
,
ip_start
=
2
ip_start
=
2
)
)
...
...
experiments/pyexps/scalability.py
View file @
78d4c701
...
@@ -37,14 +37,14 @@ for host_config in host_configs:
...
@@ -37,14 +37,14 @@ for host_config in host_configs:
e
=
exp
.
Experiment
(
'scalability-'
+
host_config
+
'-'
+
str
(
nc
))
e
=
exp
.
Experiment
(
'scalability-'
+
host_config
+
'-'
+
str
(
nc
))
if
host_config
==
'bm'
:
if
host_config
==
'bm'
:
h
ost
_c
lass
=
sim
.
QemuHost
H
ost
C
lass
=
sim
.
QemuHost
n
ic
_c
lass
=
sim
.
CorundumBMNIC
N
ic
C
lass
=
sim
.
CorundumBMNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
net
=
sim
.
SwitchNet
()
net
=
sim
.
SwitchNet
()
elif
host_config
==
'cycle'
:
elif
host_config
==
'cycle'
:
h
ost
_c
lass
=
sim
.
Gem5Host
H
ost
C
lass
=
sim
.
Gem5Host
n
ic
_c
lass
=
sim
.
CorundumVerilatorNIC
N
ic
C
lass
=
sim
.
CorundumVerilatorNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
net
=
sim
.
NS3BridgeNet
()
net
=
sim
.
NS3BridgeNet
()
else
:
else
:
raise
NameError
(
host_config
)
raise
NameError
(
host_config
)
...
@@ -56,9 +56,9 @@ for host_config in host_configs:
...
@@ -56,9 +56,9 @@ for host_config in host_configs:
1
,
1
,
'server'
,
'server'
,
net
,
net
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPServer
node
.
IperfUDPServer
)
)
...
@@ -67,9 +67,9 @@ for host_config in host_configs:
...
@@ -67,9 +67,9 @@ for host_config in host_configs:
nc
,
nc
,
'client'
,
'client'
,
net
,
net
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPClient
node
.
IperfUDPClient
)
)
...
...
experiments/pyexps/
S
cale
H
ost.py
→
experiments/pyexps/
s
cale
_h
ost.py
View file @
78d4c701
...
@@ -72,7 +72,7 @@ for n_client in num_client_types:
...
@@ -72,7 +72,7 @@ for n_client in num_client_types:
# host
# host
if
host_type
==
'qemu'
:
if
host_type
==
'qemu'
:
h
ost
_c
lass
=
sim
.
QemuHost
H
ost
C
lass
=
sim
.
QemuHost
elif
host_type
==
'qt'
:
elif
host_type
==
'qt'
:
def
qemu_timing
():
def
qemu_timing
():
...
@@ -80,23 +80,23 @@ for n_client in num_client_types:
...
@@ -80,23 +80,23 @@ for n_client in num_client_types:
h
.
sync
=
True
h
.
sync
=
True
return
h
return
h
h
ost
_c
lass
=
qemu_timing
H
ost
C
lass
=
qemu_timing
elif
host_type
==
'gt'
:
elif
host_type
==
'gt'
:
h
ost
_c
lass
=
sim
.
Gem5Host
H
ost
C
lass
=
sim
.
Gem5Host
e
.
checkpoint
=
True
e
.
checkpoint
=
True
else
:
else
:
raise
NameError
(
host_type
)
raise
NameError
(
host_type
)
# nic
# nic
if
nic_type
==
'ib'
:
if
nic_type
==
'ib'
:
n
ic
_c
lass
=
sim
.
I40eNIC
N
ic
C
lass
=
sim
.
I40eNIC
nc_c
lass
=
node
.
I40eLinuxNode
NcC
lass
=
node
.
I40eLinuxNode
elif
nic_type
==
'cb'
:
elif
nic_type
==
'cb'
:
n
ic
_c
lass
=
sim
.
CorundumBMNIC
N
ic
C
lass
=
sim
.
CorundumBMNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
elif
nic_type
==
'cv'
:
elif
nic_type
==
'cv'
:
n
ic
_c
lass
=
sim
.
CorundumVerilatorNIC
N
ic
C
lass
=
sim
.
CorundumVerilatorNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
else
:
else
:
raise
NameError
(
nic_type
)
raise
NameError
(
nic_type
)
...
@@ -106,9 +106,9 @@ for n_client in num_client_types:
...
@@ -106,9 +106,9 @@ for n_client in num_client_types:
1
,
1
,
'server'
,
'server'
,
net
,
net
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPServer
node
.
IperfUDPServer
)
)
...
@@ -117,9 +117,9 @@ for n_client in num_client_types:
...
@@ -117,9 +117,9 @@ for n_client in num_client_types:
n_client
,
n_client
,
'client'
,
'client'
,
net
,
net
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPClient
,
node
.
IperfUDPClient
,
ip_start
=
2
ip_start
=
2
)
)
...
...
experiments/pyexps/
S
cale
L
oad.py
→
experiments/pyexps/
s
cale
_l
oad.py
View file @
78d4c701
...
@@ -59,18 +59,18 @@ for rate in rate_types:
...
@@ -59,18 +59,18 @@ for rate in rate_types:
)
)
# network
# network
if
net_type
==
'sw'
:
if
net_type
==
'sw'
:
n
et
=
sim
.
SwitchNet
()
N
et
Class
=
sim
.
SwitchNet
()
elif
net_type
==
'br'
:
elif
net_type
==
'br'
:
n
et
=
sim
.
NS3BridgeNet
()
N
et
Class
=
sim
.
NS3BridgeNet
()
elif
net_type
==
'wire'
:
elif
net_type
==
'wire'
:
n
et
=
sim
.
WireNet
()
N
et
Class
=
sim
.
WireNet
()
else
:
else
:
raise
NameError
(
net_type
)
raise
NameError
(
net_type
)
e
.
add_network
(
n
et
)
e
.
add_network
(
N
et
Class
)
# host
# host
if
host_type
==
'qemu'
:
if
host_type
==
'qemu'
:
h
ost
_c
lass
=
sim
.
QemuHost
H
ost
C
lass
=
sim
.
QemuHost
elif
host_type
==
'qt'
:
elif
host_type
==
'qt'
:
def
qemu_timing
():
def
qemu_timing
():
...
@@ -78,23 +78,23 @@ for rate in rate_types:
...
@@ -78,23 +78,23 @@ for rate in rate_types:
h
.
sync
=
True
h
.
sync
=
True
return
h
return
h
h
ost
_c
lass
=
qemu_timing
H
ost
C
lass
=
qemu_timing
elif
host_type
==
'gt'
:
elif
host_type
==
'gt'
:
h
ost
_c
lass
=
sim
.
Gem5Host
H
ost
C
lass
=
sim
.
Gem5Host
e
.
checkpoint
=
True
e
.
checkpoint
=
True
else
:
else
:
raise
NameError
(
host_type
)
raise
NameError
(
host_type
)
# nic
# nic
if
nic_type
==
'ib'
:
if
nic_type
==
'ib'
:
n
ic
_c
lass
=
sim
.
I40eNIC
N
ic
C
lass
=
sim
.
I40eNIC
nc_c
lass
=
node
.
I40eLinuxNode
NcC
lass
=
node
.
I40eLinuxNode
elif
nic_type
==
'cb'
:
elif
nic_type
==
'cb'
:
n
ic
_c
lass
=
sim
.
CorundumBMNIC
N
ic
C
lass
=
sim
.
CorundumBMNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
elif
nic_type
==
'cv'
:
elif
nic_type
==
'cv'
:
n
ic
_c
lass
=
sim
.
CorundumVerilatorNIC
N
ic
C
lass
=
sim
.
CorundumVerilatorNIC
nc_c
lass
=
node
.
CorundumLinuxNode
NcC
lass
=
node
.
CorundumLinuxNode
else
:
else
:
raise
NameError
(
nic_type
)
raise
NameError
(
nic_type
)
...
@@ -103,10 +103,10 @@ for rate in rate_types:
...
@@ -103,10 +103,10 @@ for rate in rate_types:
e
,
e
,
1
,
1
,
'server'
,
'server'
,
n
et
,
N
et
Class
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPServer
node
.
IperfUDPServer
)
)
...
@@ -115,10 +115,10 @@ for rate in rate_types:
...
@@ -115,10 +115,10 @@ for rate in rate_types:
e
,
e
,
1
,
1
,
'client'
,
'client'
,
n
et
,
N
et
Class
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPClientSleep
,
node
.
IperfUDPClientSleep
,
ip_start
=
2
ip_start
=
2
)
)
...
@@ -127,10 +127,10 @@ for rate in rate_types:
...
@@ -127,10 +127,10 @@ for rate in rate_types:
e
,
e
,
1
,
1
,
'client'
,
'client'
,
n
et
,
N
et
Class
,
n
ic
_c
lass
,
N
ic
C
lass
,
h
ost
_c
lass
,
H
ost
C
lass
,
nc_c
lass
,
NcC
lass
,
node
.
IperfUDPClient
,
node
.
IperfUDPClient
,
ip_start
=
2
ip_start
=
2
)
)
...
...
experiments/run.py
View file @
78d4c701
...
@@ -30,15 +30,16 @@ import pickle
...
@@ -30,15 +30,16 @@ import pickle
import
sys
import
sys
import
typing
as
tp
import
typing
as
tp
import
simbricks.exectools
as
exectools
from
simbricks.runtime.common
import
Run
from
simbricks.runtime.common
import
*
from
simbricks.runtime.distributed
import
DistributedSimpleRuntime
,
auto_dist
from
simbricks.runtime.distributed
import
*
from
simbricks.runtime.local
import
LocalParallelRuntime
,
LocalSimpleRuntime
from
simbricks.runtime.local
import
*
from
simbricks.runtime.slurm
import
SlurmRuntime
from
simbricks.runtime.slurm
import
*
import
simbricks.experiments
as
exp
import
simbricks.experiments
as
exp
from
simbricks
import
exectools
# pylint: disable=redefined-outer-name
def
mkdir_if_not_exists
(
path
):
def
mkdir_if_not_exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
os
.
mkdir
(
path
)
os
.
mkdir
(
path
)
...
@@ -212,9 +213,10 @@ g_dist.add_argument(
...
@@ -212,9 +213,10 @@ g_dist.add_argument(
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
# pylint: disable=redefined-outer-name
def
load_executors
(
path
):
def
load_executors
(
path
):
"""Load hosts list from json file and return list of executors."""
"""Load hosts list from json file and return list of executors."""
with
open
(
path
,
'r'
)
as
f
:
with
open
(
path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
hosts
=
json
.
load
(
f
)
hosts
=
json
.
load
(
f
)
exs
=
[]
exs
=
[]
...
@@ -252,7 +254,10 @@ def warn_multi_exec():
...
@@ -252,7 +254,10 @@ def warn_multi_exec():
if
args
.
runtime
==
'parallel'
:
if
args
.
runtime
==
'parallel'
:
warn_multi_exec
()
warn_multi_exec
()
rt
=
LocalParallelRuntime
(
rt
=
LocalParallelRuntime
(
cores
=
args
.
cores
,
mem
=
args
.
mem
,
verbose
=
args
.
verbose
,
exec
=
executors
[
0
]
cores
=
args
.
cores
,
mem
=
args
.
mem
,
verbose
=
args
.
verbose
,
executor
=
executors
[
0
]
)
)
elif
args
.
runtime
==
'slurm'
:
elif
args
.
runtime
==
'slurm'
:
rt
=
SlurmRuntime
(
args
.
slurmdir
,
args
,
verbose
=
args
.
verbose
)
rt
=
SlurmRuntime
(
args
.
slurmdir
,
args
,
verbose
=
args
.
verbose
)
...
@@ -260,9 +265,10 @@ elif args.runtime == 'dist':
...
@@ -260,9 +265,10 @@ elif args.runtime == 'dist':
rt
=
DistributedSimpleRuntime
(
executors
,
verbose
=
args
.
verbose
)
rt
=
DistributedSimpleRuntime
(
executors
,
verbose
=
args
.
verbose
)
else
:
else
:
warn_multi_exec
()
warn_multi_exec
()
rt
=
LocalSimpleRuntime
(
verbose
=
args
.
verbose
,
exec
=
executors
[
0
])
rt
=
LocalSimpleRuntime
(
verbose
=
args
.
verbose
,
exec
utor
=
executors
[
0
])
# pylint: disable=redefined-outer-name
def
add_exp
(
def
add_exp
(
e
:
exp
.
Experiment
,
e
:
exp
.
Experiment
,
run
:
int
,
run
:
int
,
...
@@ -271,15 +277,15 @@ def add_exp(
...
@@ -271,15 +277,15 @@ def add_exp(
restore_cp
:
bool
,
restore_cp
:
bool
,
no_simbricks
:
bool
no_simbricks
:
bool
):
):
outpath
=
'%s/%s-%d.json'
%
(
args
.
outdir
,
e
.
name
,
run
)
outpath
=
f
'
{
args
.
outdir
}
/
{
e
.
name
}
-
{
run
}
.json'
if
os
.
path
.
exists
(
outpath
)
and
not
args
.
force
:
if
os
.
path
.
exists
(
outpath
)
and
not
args
.
force
:
print
(
'skip
%s run %d'
%
(
e
.
name
,
run
)
)
print
(
f
'skip
{
e
.
name
}
run
{
run
}
'
)
return
None
return
None
workdir
=
'%s/%s/%d'
%
(
args
.
workdir
,
e
.
name
,
run
)
workdir
=
f
'
{
args
.
workdir
}
/
{
e
.
name
}
/
{
run
}
'
cpdir
=
'%s/%s/%d'
%
(
args
.
cpdir
,
e
.
name
,
0
)
cpdir
=
f
'
{
args
.
cpdir
}
/
{
e
.
name
}
/0'
if
args
.
shmdir
is
not
None
:
if
args
.
shmdir
is
not
None
:
shmdir
=
'%s/%s/%d'
%
(
args
.
shmdir
,
e
.
name
,
run
)
shmdir
=
f
'
{
args
.
shmdir
}
/
{
e
.
name
}
/
{
run
}
'
env
=
exp
.
ExpEnv
(
args
.
repo
,
workdir
,
cpdir
)
env
=
exp
.
ExpEnv
(
args
.
repo
,
workdir
,
cpdir
)
env
.
create_cp
=
create_cp
env
.
create_cp
=
create_cp
...
@@ -320,17 +326,15 @@ if not args.pickled:
...
@@ -320,17 +326,15 @@ if not args.pickled:
if
(
args
.
filter
)
and
(
len
(
args
.
filter
)
>
0
):
if
(
args
.
filter
)
and
(
len
(
args
.
filter
)
>
0
):
match
=
False
match
=
False
for
f
in
args
.
filter
:
for
f
in
args
.
filter
:
if
fnmatch
.
fnmatch
(
e
.
name
,
f
)
:
match
=
fnmatch
.
fnmatch
(
e
.
name
,
f
)
match
=
True
if
match
:
break
break
if
not
match
:
if
not
match
:
continue
continue
# if this is an experiment with a checkpoint we might have to create it
# if this is an experiment with a checkpoint we might have to create it
if
e
.
no_simbricks
:
no_simbricks
=
e
.
no_simbricks
no_simbricks
=
True
else
:
no_simbricks
=
False
if
e
.
checkpoint
:
if
e
.
checkpoint
:
prereq
=
add_exp
(
e
,
0
,
None
,
True
,
False
,
no_simbricks
)
prereq
=
add_exp
(
e
,
0
,
None
,
True
,
False
,
no_simbricks
)
else
:
else
:
...
...
experiments/simbricks/exectools.py
View file @
78d4c701
...
@@ -32,7 +32,10 @@ from asyncio.subprocess import Process
...
@@ -32,7 +32,10 @@ from asyncio.subprocess import Process
class
HostConfig
(
object
):
class
HostConfig
(
object
):
def
__init__
(
self
,
name
,
ip
,
mac
,
sudopwd
,
other
=
{}):
def
__init__
(
self
,
name
,
ip
,
mac
,
sudopwd
,
other
=
None
):
if
other
is
None
:
other
=
{}
self
.
name
=
name
self
.
name
=
name
self
.
ip
=
ip
self
.
ip
=
ip
self
.
used_ip
=
ip
self
.
used_ip
=
ip
...
@@ -170,7 +173,7 @@ class Component(object):
...
@@ -170,7 +173,7 @@ class Component(object):
class
SimpleComponent
(
Component
):
class
SimpleComponent
(
Component
):
def
__init__
(
def
__init__
(
self
,
label
,
cmd_parts
,
verbose
=
True
,
canfail
=
False
,
*
args
,
**
kwargs
self
,
label
,
cmd_parts
,
*
args
,
verbose
=
True
,
canfail
=
False
,
**
kwargs
):
):
self
.
label
=
label
self
.
label
=
label
self
.
verbose
=
verbose
self
.
verbose
=
verbose
...
@@ -180,12 +183,12 @@ class SimpleComponent(Component):
...
@@ -180,12 +183,12 @@ class SimpleComponent(Component):
async
def
process_out
(
self
,
lines
,
eof
):
async
def
process_out
(
self
,
lines
,
eof
):
if
self
.
verbose
:
if
self
.
verbose
:
for
l
in
lines
:
for
_
in
lines
:
print
(
self
.
label
,
'OUT:'
,
lines
,
flush
=
True
)
print
(
self
.
label
,
'OUT:'
,
lines
,
flush
=
True
)
async
def
process_err
(
self
,
lines
,
eof
):
async
def
process_err
(
self
,
lines
,
eof
):
if
self
.
verbose
:
if
self
.
verbose
:
for
l
in
lines
:
for
_
in
lines
:
print
(
self
.
label
,
'ERR:'
,
lines
,
flush
=
True
)
print
(
self
.
label
,
'ERR:'
,
lines
,
flush
=
True
)
async
def
terminated
(
self
,
rc
):
async
def
terminated
(
self
,
rc
):
...
@@ -203,11 +206,14 @@ class SimpleRemoteComponent(SimpleComponent):
...
@@ -203,11 +206,14 @@ class SimpleRemoteComponent(SimpleComponent):
host_name
,
host_name
,
label
,
label
,
cmd_parts
,
cmd_parts
,
cwd
=
None
,
ssh_extra_args
=
[],
*
args
,
*
args
,
cwd
=
None
,
ssh_extra_args
=
None
,
**
kwargs
**
kwargs
):
):
if
ssh_extra_args
is
None
:
ssh_extra_args
=
[]
self
.
host_name
=
host_name
self
.
host_name
=
host_name
self
.
extra_flags
=
ssh_extra_args
self
.
extra_flags
=
ssh_extra_args
# add a wrapper to print the PID
# add a wrapper to print the PID
...
@@ -300,14 +306,14 @@ class Executor(object):
...
@@ -300,14 +306,14 @@ class Executor(object):
raise
NotImplementedError
(
'Please Implement this method'
)
raise
NotImplementedError
(
'Please Implement this method'
)
# runs the list of commands as strings sequentially
# runs the list of commands as strings sequentially
async
def
run_cmdlist
(
self
,
label
,
cmds
,
verbose
=
True
,
host
=
None
):
async
def
run_cmdlist
(
self
,
label
,
cmds
,
verbose
=
True
):
i
=
0
i
=
0
for
cmd
in
cmds
:
for
cmd
in
cmds
:
cmd
C
=
self
.
create_component
(
cmd
_c
=
self
.
create_component
(
label
+
'.'
+
str
(
i
),
shlex
.
split
(
cmd
),
verbose
=
verbose
label
+
'.'
+
str
(
i
),
shlex
.
split
(
cmd
),
verbose
=
verbose
)
)
await
cmd
C
.
start
()
await
cmd
_c
.
start
()
await
cmd
C
.
wait
()
await
cmd
_c
.
wait
()
async
def
await_files
(
self
,
paths
,
*
args
,
**
kwargs
):
async
def
await_files
(
self
,
paths
,
*
args
,
**
kwargs
):
xs
=
[]
xs
=
[]
...
@@ -323,7 +329,7 @@ class LocalExecutor(Executor):
...
@@ -323,7 +329,7 @@ class LocalExecutor(Executor):
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
,
timeout
=
30
):
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
,
timeout
=
30
):
if
verbose
:
if
verbose
:
print
(
'await_file(
%s)'
%
path
)
print
(
f
'await_file(
{
path
}
)'
)
t
=
0
t
=
0
while
not
os
.
path
.
exists
(
path
):
while
not
os
.
path
.
exists
(
path
):
if
t
>=
timeout
:
if
t
>=
timeout
:
...
@@ -365,18 +371,18 @@ class RemoteExecutor(Executor):
...
@@ -365,18 +371,18 @@ class RemoteExecutor(Executor):
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
,
timeout
=
30
):
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
,
timeout
=
30
):
if
verbose
:
if
verbose
:
print
(
'%s
.await_file(
%s
) started'
%
(
self
.
host_name
,
path
)
)
print
(
f
'
{
self
.
host_name
}
.await_file(
{
path
}
) started'
)
to_its
=
timeout
/
delay
to_its
=
timeout
/
delay
loop_cmd
=
(
loop_cmd
=
(
'i=0 ; while [ ! -e
%s
] ; do '
f
'i=0 ; while [ ! -e
{
path
}
] ; do '
'if [ $i -ge
%u
] ; then exit 1 ; fi ; '
f
'if [ $i -ge
{
to_its
:
u
}
] ; then exit 1 ; fi ; '
'sleep
%f
; '
f
'sleep
{
delay
}
; '
'i=$(($i+1)) ; done; exit 0'
'i=$(($i+1)) ; done; exit 0'
)
%
(
path
,
to_its
,
delay
)
)
%
(
path
,
to_its
,
delay
)
parts
=
[
'/bin/sh'
,
'-c'
,
loop_cmd
]
parts
=
[
'/bin/sh'
,
'-c'
,
loop_cmd
]
sc
=
self
.
create_component
(
sc
=
self
.
create_component
(
"%s.await_file('%s')"
%
(
self
.
host_name
,
path
)
,
f
"
{
self
.
host_name
}
.await_file('
{
path
}
')"
,
parts
,
parts
,
canfail
=
False
,
canfail
=
False
,
verbose
=
verbose
verbose
=
verbose
...
@@ -393,9 +399,9 @@ class RemoteExecutor(Executor):
...
@@ -393,9 +399,9 @@ class RemoteExecutor(Executor):
'UserKnownHostsFile=/dev/null'
,
'UserKnownHostsFile=/dev/null'
,
'-o'
,
'-o'
,
'StrictHostKeyChecking=no'
'StrictHostKeyChecking=no'
]
+
self
.
scp_extra_args
+
[
path
,
'%s:%s'
%
(
self
.
host_name
,
path
)
]
]
+
self
.
scp_extra_args
+
[
path
,
f
'
{
self
.
host_name
}
:
{
path
}
'
]
sc
=
SimpleComponent
(
sc
=
SimpleComponent
(
"%s.send_file('%s')"
%
(
self
.
host_name
,
path
)
,
f
'
{
self
.
host_name
}
.send_file("
{
path
}
")'
,
parts
,
parts
,
canfail
=
False
,
canfail
=
False
,
verbose
=
verbose
verbose
=
verbose
...
@@ -405,7 +411,7 @@ class RemoteExecutor(Executor):
...
@@ -405,7 +411,7 @@ class RemoteExecutor(Executor):
async
def
mkdir
(
self
,
path
,
verbose
=
False
):
async
def
mkdir
(
self
,
path
,
verbose
=
False
):
sc
=
self
.
create_component
(
sc
=
self
.
create_component
(
"%s.mkdir('%s')"
%
(
self
.
host_name
,
path
)
,
[
'mkdir'
,
'-p'
,
path
],
f
"
{
self
.
host_name
}
.mkdir('
{
path
}
')"
,
[
'mkdir'
,
'-p'
,
path
],
canfail
=
False
,
canfail
=
False
,
verbose
=
verbose
verbose
=
verbose
)
)
...
@@ -414,7 +420,7 @@ class RemoteExecutor(Executor):
...
@@ -414,7 +420,7 @@ class RemoteExecutor(Executor):
async
def
rmtree
(
self
,
path
,
verbose
=
False
):
async
def
rmtree
(
self
,
path
,
verbose
=
False
):
sc
=
self
.
create_component
(
sc
=
self
.
create_component
(
"%s.rmtree('%s')"
%
(
self
.
host_name
,
path
)
,
[
'rm'
,
'-rf'
,
path
],
f
'
{
self
.
host_name
}
.rmtree("
{
path
}
")'
,
[
'rm'
,
'-rf'
,
path
],
canfail
=
False
,
canfail
=
False
,
verbose
=
verbose
verbose
=
verbose
)
)
...
...
experiments/simbricks/experiment/experiment_environment.py
View file @
78d4c701
...
@@ -33,50 +33,55 @@ class ExpEnv(object):
...
@@ -33,50 +33,55 @@ class ExpEnv(object):
self
.
workdir
=
os
.
path
.
abspath
(
workdir
)
self
.
workdir
=
os
.
path
.
abspath
(
workdir
)
self
.
cpdir
=
os
.
path
.
abspath
(
cpdir
)
self
.
cpdir
=
os
.
path
.
abspath
(
cpdir
)
self
.
shm_base
=
self
.
workdir
self
.
shm_base
=
self
.
workdir
self
.
qemu_img_path
=
self
.
repodir
+
'/sims/external/qemu/build/qemu-img'
self
.
qemu_img_path
=
f
'
{
self
.
repodir
}
/sims/external/qemu/build/qemu-img'
self
.
qemu_path
=
self
.
repodir
+
'/sims/external/qemu/build/x86_64-softmmu/qemu-system-x86_64'
self
.
qemu_path
=
(
self
.
qemu_kernel_path
=
self
.
repodir
+
'/images/bzImage'
f
'
{
self
.
repodir
}
/sims/external/qemu/build/'
self
.
gem5_py_path
=
self
.
repodir
+
'/sims/external/gem5/configs/simbricks/simbricks.py'
'x86_64-softmmu/qemu-system-x86_64'
self
.
gem5_kernel_path
=
self
.
repodir
+
'/images/vmlinux'
)
self
.
qemu_kernel_path
=
f
'
{
self
.
repodir
}
/images/bzImage'
self
.
gem5_py_path
=
(
f
'
{
self
.
repodir
}
/sims/external/gem5/configs/simbricks/simbricks.py'
)
self
.
gem5_kernel_path
=
f
'
{
self
.
repodir
}
/images/vmlinux'
def
gem5_path
(
self
,
variant
):
def
gem5_path
(
self
,
variant
):
return
self
.
repodir
+
'
/sims/external/gem5/build/X86/gem5.
'
+
variant
return
f
'
{
self
.
repodir
}
/sims/external/gem5/build/X86/gem5.
{
variant
}
'
def
hdcopy_path
(
self
,
sim
):
def
hdcopy_path
(
self
,
sim
):
return
'%s/hdcopy.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
f
'
{
self
.
workdir
}
/hdcopy.
{
sim
.
name
}
'
def
hd_path
(
self
,
hd_name
):
def
hd_path
(
self
,
hd_name
):
return
'%s/images/output-%s/%s'
%
(
self
.
repodir
,
hd_name
,
hd_name
)
return
f
'
{
self
.
repodir
}
/images/output-
{
hd_name
}
/
{
hd_name
}
'
def
hd_raw_path
(
self
,
hd_name
):
def
hd_raw_path
(
self
,
hd_name
):
return
'%s/images/output-%s/%s.raw'
%
(
self
.
repodir
,
hd_name
,
hd_name
)
return
f
'
{
self
.
repodir
}
/images/output-
{
hd_name
}
/
{
hd_name
}
.raw'
def
cfgtar_path
(
self
,
sim
):
def
cfgtar_path
(
self
,
sim
):
return
'%s/cfg.%s.tar'
%
(
self
.
workdir
,
sim
.
name
)
return
f
'
{
self
.
workdir
}
/cfg.
{
sim
.
name
}
.tar'
def
dev_pci_path
(
self
,
sim
):
def
dev_pci_path
(
self
,
sim
):
return
'%s/dev.pci.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
f
'
{
self
.
workdir
}
/dev.pci.
{
sim
.
name
}
'
def
nic_eth_path
(
self
,
sim
):
def
nic_eth_path
(
self
,
sim
):
return
'%s/nic.eth.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
f
'
{
self
.
workdir
}
/nic.eth.
{
sim
.
name
}
'
def
dev_shm_path
(
self
,
sim
):
def
dev_shm_path
(
self
,
sim
):
return
'%s/dev.shm.%s'
%
(
self
.
shm_base
,
sim
.
name
)
return
f
'
{
self
.
shm_base
}
/dev.shm.
{
sim
.
name
}
'
def
n2n_eth_path
(
self
,
sim_l
,
sim_c
):
def
n2n_eth_path
(
self
,
sim_l
,
sim_c
):
return
'%s/n2n.eth.%s.%s'
%
(
self
.
workdir
,
sim_l
.
name
,
sim_c
.
name
)
return
f
'
{
self
.
workdir
}
/n2n.eth.
{
sim_l
.
name
}
.
{
sim_c
.
name
}
'
def
net2host_eth_path
(
self
,
sim_n
,
sim_h
):
def
net2host_eth_path
(
self
,
sim_n
,
sim_h
):
return
'%s/n2h.eth.%s.%s'
%
(
self
.
workdir
,
sim_n
.
name
,
sim_h
.
name
)
return
f
'
{
self
.
workdir
}
/n2h.eth.
{
sim_n
.
name
}
.
{
sim_h
.
name
}
'
def
net2host_shm_path
(
self
,
sim_n
,
sim_h
):
def
net2host_shm_path
(
self
,
sim_n
,
sim_h
):
return
'%s/n2h.shm.%s.%s'
%
(
self
.
workdir
,
sim_n
.
name
,
sim_h
.
name
)
return
f
'
{
self
.
workdir
}
/n2h.shm.
{
sim_n
.
name
}
.
{
sim_h
.
name
}
'
def
proxy_shm_path
(
self
,
sim
):
def
proxy_shm_path
(
self
,
sim
):
return
'%s/proxy.shm.%s'
%
(
self
.
shm_base
,
sim
.
name
)
return
f
'
{
self
.
shm_base
}
/proxy.shm.
{
sim
.
name
}
'
def
gem5_outdir
(
self
,
sim
):
def
gem5_outdir
(
self
,
sim
):
return
'%s/gem5-out.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
f
'
{
self
.
workdir
}
/gem5-out.
{
sim
.
name
}
'
def
gem5_cpdir
(
self
,
sim
):
def
gem5_cpdir
(
self
,
sim
):
return
'%s/gem5-cp.%s'
%
(
self
.
cpdir
,
sim
.
name
)
return
f
'
{
self
.
cpdir
}
/gem5-cp.
{
sim
.
name
}
'
experiments/simbricks/experiments.py
View file @
78d4c701
...
@@ -26,7 +26,6 @@ import shlex
...
@@ -26,7 +26,6 @@ import shlex
import
traceback
import
traceback
import
typing
as
tp
import
typing
as
tp
import
simbricks.utils.graphlib
as
graphlib
from
simbricks.exectools
import
Executor
,
SimpleComponent
from
simbricks.exectools
import
Executor
,
SimpleComponent
from
simbricks.experiment.experiment_environment
import
ExpEnv
from
simbricks.experiment.experiment_environment
import
ExpEnv
from
simbricks.experiment.experiment_output
import
ExpOutput
from
simbricks.experiment.experiment_output
import
ExpOutput
...
@@ -34,6 +33,7 @@ from simbricks.proxy import NetProxyConnecter, NetProxyListener, SimProxy
...
@@ -34,6 +33,7 @@ from simbricks.proxy import NetProxyConnecter, NetProxyListener, SimProxy
from
simbricks.simulators
import
(
from
simbricks.simulators
import
(
HostSim
,
I40eMultiNIC
,
NetSim
,
NICSim
,
PCIDevSim
,
Simulator
HostSim
,
I40eMultiNIC
,
NetSim
,
NICSim
,
PCIDevSim
,
Simulator
)
)
from
simbricks.utils
import
graphlib
class
Experiment
(
object
):
class
Experiment
(
object
):
...
@@ -135,7 +135,7 @@ class DistributedExperiment(Experiment):
...
@@ -135,7 +135,7 @@ class DistributedExperiment(Experiment):
def
assign_sim_host
(
self
,
sim
:
Simulator
,
host
:
int
):
def
assign_sim_host
(
self
,
sim
:
Simulator
,
host
:
int
):
"""Assign host ID (< self.num_hosts) for a simulator."""
"""Assign host ID (< self.num_hosts) for a simulator."""
assert
(
host
>=
0
and
host
<
self
.
num_hosts
)
assert
0
<=
host
<
self
.
num_hosts
self
.
host_mapping
[
sim
]
=
host
self
.
host_mapping
[
sim
]
=
host
def
all_sims_assigned
(
self
):
def
all_sims_assigned
(
self
):
...
@@ -178,17 +178,17 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -178,17 +178,17 @@ class ExperimentBaseRunner(tp.Generic[T]):
name
=
sim
.
full_name
()
name
=
sim
.
full_name
()
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s: starting %s'
%
(
self
.
exp
.
name
,
name
)
)
print
(
f
'
{
self
.
exp
.
name
}
: starting
{
name
}
'
)
run_cmd
=
sim
.
run_cmd
(
self
.
env
)
run_cmd
=
sim
.
run_cmd
(
self
.
env
)
if
run_cmd
is
None
:
if
run_cmd
is
None
:
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s: started dummy %s'
%
(
self
.
exp
.
name
,
name
)
)
print
(
f
'
{
self
.
exp
.
name
}
: started dummy
{
name
}
'
)
return
return
# run simulator
# run simulator
exec
=
self
.
sim_executor
(
sim
)
exec
utor
=
self
.
sim_executor
(
sim
)
sc
=
exec
.
create_component
(
sc
=
exec
utor
.
create_component
(
name
,
shlex
.
split
(
run_cmd
),
verbose
=
self
.
verbose
,
canfail
=
True
name
,
shlex
.
split
(
run_cmd
),
verbose
=
self
.
verbose
,
canfail
=
True
)
)
await
sc
.
start
()
await
sc
.
start
()
...
@@ -196,15 +196,15 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -196,15 +196,15 @@ class ExperimentBaseRunner(tp.Generic[T]):
# add sockets for cleanup
# add sockets for cleanup
for
s
in
sim
.
sockets_cleanup
(
self
.
env
):
for
s
in
sim
.
sockets_cleanup
(
self
.
env
):
self
.
sockets
.
append
((
exec
,
s
))
self
.
sockets
.
append
((
exec
utor
,
s
))
# Wait till sockets exist
# Wait till sockets exist
wait_socks
=
sim
.
sockets_wait
(
self
.
env
)
wait_socks
=
sim
.
sockets_wait
(
self
.
env
)
if
wait_socks
:
if
wait_socks
:
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s
: waiting for sockets
%s'
%
(
self
.
exp
.
name
,
name
)
)
print
(
f
'
{
self
.
exp
.
name
}
: waiting for sockets
{
name
}
'
)
await
exec
.
await_files
(
wait_socks
,
verbose
=
self
.
verbose
)
await
exec
utor
.
await_files
(
wait_socks
,
verbose
=
self
.
verbose
)
# add time delay if required
# add time delay if required
delay
=
sim
.
start_delay
()
delay
=
sim
.
start_delay
()
...
@@ -215,7 +215,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -215,7 +215,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
self
.
wait_sims
.
append
(
sc
)
self
.
wait_sims
.
append
(
sc
)
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s: started %s'
%
(
self
.
exp
.
name
,
name
)
)
print
(
f
'
{
self
.
exp
.
name
}
: started
{
name
}
'
)
async
def
before_wait
(
self
):
async
def
before_wait
(
self
):
pass
pass
...
@@ -240,10 +240,10 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -240,10 +240,10 @@ class ExperimentBaseRunner(tp.Generic[T]):
# prepare all simulators in parallel
# prepare all simulators in parallel
sims
=
[]
sims
=
[]
for
sim
in
self
.
exp
.
all_simulators
():
for
sim
in
self
.
exp
.
all_simulators
():
prep_cmds
=
[
pc
for
pc
in
sim
.
prep_cmds
(
self
.
env
)
]
prep_cmds
=
list
(
sim
.
prep_cmds
(
self
.
env
)
)
exec
=
self
.
sim_executor
(
sim
)
exec
utor
=
self
.
sim_executor
(
sim
)
sims
.
append
(
sims
.
append
(
exec
.
run_cmdlist
(
exec
utor
.
run_cmdlist
(
'prepare_'
+
self
.
exp
.
name
,
prep_cmds
,
verbose
=
self
.
verbose
'prepare_'
+
self
.
exp
.
name
,
prep_cmds
,
verbose
=
self
.
verbose
)
)
)
)
...
@@ -252,7 +252,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -252,7 +252,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
async
def
wait_for_sims
(
self
):
async
def
wait_for_sims
(
self
):
"""Wait for simulators to terminate (the ones marked to wait on)."""
"""Wait for simulators to terminate (the ones marked to wait on)."""
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s
: waiting for hosts to terminate'
%
self
.
exp
.
name
)
print
(
f
'
{
self
.
exp
.
name
}
: waiting for hosts to terminate'
)
for
sc
in
self
.
wait_sims
:
for
sc
in
self
.
wait_sims
:
await
sc
.
wait
()
await
sc
.
wait
()
...
@@ -279,7 +279,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -279,7 +279,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
await
self
.
before_wait
()
await
self
.
before_wait
()
await
self
.
wait_for_sims
()
await
self
.
wait_for_sims
()
except
:
except
:
# pylint: disable=bare-except
self
.
out
.
set_failed
()
self
.
out
.
set_failed
()
traceback
.
print_exc
()
traceback
.
print_exc
()
...
@@ -288,7 +288,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -288,7 +288,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
# shut things back down
# shut things back down
if
self
.
verbose
:
if
self
.
verbose
:
print
(
'%s: cleaning up'
%
self
.
exp
.
name
)
print
(
f
'
{
self
.
exp
.
name
}
: cleaning up'
)
await
self
.
before_cleanup
()
await
self
.
before_cleanup
()
...
@@ -304,9 +304,9 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -304,9 +304,9 @@ class ExperimentBaseRunner(tp.Generic[T]):
# remove all sockets
# remove all sockets
scs
=
[]
scs
=
[]
for
(
exec
,
sock
)
in
self
.
sockets
:
for
(
exec
utor
,
sock
)
in
self
.
sockets
:
scs
.
append
(
exec
.
rmtree
(
sock
))
scs
.
append
(
exec
utor
.
rmtree
(
sock
))
if
len
(
scs
)
:
if
scs
:
await
asyncio
.
wait
(
scs
)
await
asyncio
.
wait
(
scs
)
# add all simulator components to the output
# add all simulator components to the output
...
@@ -320,12 +320,12 @@ class ExperimentBaseRunner(tp.Generic[T]):
...
@@ -320,12 +320,12 @@ class ExperimentBaseRunner(tp.Generic[T]):
class
ExperimentSimpleRunner
(
ExperimentBaseRunner
[
Experiment
]):
class
ExperimentSimpleRunner
(
ExperimentBaseRunner
[
Experiment
]):
"""Simple experiment runner with just one executor."""
"""Simple experiment runner with just one executor."""
def
__init__
(
self
,
exec
:
Executor
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
exec
utor
:
Executor
,
*
args
,
**
kwargs
):
self
.
exec
=
exec
self
.
exec
utor
=
exec
utor
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
def
sim_executor
(
self
,
sim
:
Simulator
):
def
sim_executor
(
self
,
sim
:
Simulator
):
return
self
.
exec
return
self
.
exec
utor
class
ExperimentDistributedRunner
(
ExperimentBaseRunner
[
DistributedExperiment
]):
class
ExperimentDistributedRunner
(
ExperimentBaseRunner
[
DistributedExperiment
]):
...
@@ -342,13 +342,13 @@ class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]):
...
@@ -342,13 +342,13 @@ class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]):
async
def
prepare
(
self
):
async
def
prepare
(
self
):
# make sure all simulators are assigned to an executor
# make sure all simulators are assigned to an executor
assert
(
self
.
exp
.
all_sims_assigned
()
)
assert
self
.
exp
.
all_sims_assigned
()
# set IP addresses for proxies based on assigned executors
# set IP addresses for proxies based on assigned executors
for
p
in
itertools
.
chain
(
for
p
in
itertools
.
chain
(
self
.
exp
.
proxies_listen
,
self
.
exp
.
proxies_connect
self
.
exp
.
proxies_listen
,
self
.
exp
.
proxies_connect
):
):
exec
=
self
.
sim_executor
(
p
)
exec
utor
=
self
.
sim_executor
(
p
)
p
.
ip
=
exec
.
ip
p
.
ip
=
exec
utor
.
ip
await
super
().
prepare
()
await
super
().
prepare
()
experiments/simbricks/nodeconfig.py
View file @
78d4c701
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from
__future__
import
annotations
import
io
import
io
import
tarfile
import
tarfile
...
@@ -27,7 +29,8 @@ import tarfile
...
@@ -27,7 +29,8 @@ import tarfile
class
AppConfig
(
object
):
class
AppConfig
(
object
):
"""Manages the application to be run on a simulated host."""
"""Manages the application to be run on a simulated host."""
def
run_cmds
(
self
,
node
):
# pylint: disable=unused-argument
def
run_cmds
(
self
,
node
:
NodeConfig
):
return
[]
return
[]
def
prepare_pre_cp
(
self
):
def
prepare_pre_cp
(
self
):
...
@@ -69,7 +72,7 @@ class NodeConfig(object):
...
@@ -69,7 +72,7 @@ class NodeConfig(object):
cp_es
=
[]
cp_es
=
[]
exit_es
=
[
'poweroff -f'
]
exit_es
=
[
'poweroff -f'
]
else
:
else
:
if
(
self
.
nockp
)
:
if
self
.
nockp
:
cp_es
=
[]
cp_es
=
[]
else
:
else
:
cp_es
=
[
'm5 checkpoint'
]
cp_es
=
[
'm5 checkpoint'
]
...
@@ -81,8 +84,7 @@ class NodeConfig(object):
...
@@ -81,8 +84,7 @@ class NodeConfig(object):
return
'
\n
'
.
join
(
es
)
return
'
\n
'
.
join
(
es
)
def
make_tar
(
self
,
path
):
def
make_tar
(
self
,
path
):
tar
=
tarfile
.
open
(
path
,
'w:'
)
with
tarfile
.
open
(
path
,
'w:'
)
as
tar
:
# add main run script
# add main run script
cfg_i
=
tarfile
.
TarInfo
(
'guest/run.sh'
)
cfg_i
=
tarfile
.
TarInfo
(
'guest/run.sh'
)
cfg_i
.
mode
=
0o777
cfg_i
.
mode
=
0o777
...
@@ -103,8 +105,6 @@ class NodeConfig(object):
...
@@ -103,8 +105,6 @@ class NodeConfig(object):
tar
.
addfile
(
tarinfo
=
f_i
,
fileobj
=
f
)
tar
.
addfile
(
tarinfo
=
f_i
,
fileobj
=
f
)
f
.
close
()
f
.
close
()
tar
.
close
()
def
prepare_pre_cp
(
self
):
def
prepare_pre_cp
(
self
):
return
[
return
[
'set -x'
,
'set -x'
,
...
@@ -150,9 +150,7 @@ class LinuxNode(NodeConfig):
...
@@ -150,9 +150,7 @@ class LinuxNode(NodeConfig):
self
.
force_mac_addr
self
.
force_mac_addr
)
)
l
.
append
(
'ip link set dev '
+
self
.
ifname
+
' up'
)
l
.
append
(
'ip link set dev '
+
self
.
ifname
+
' up'
)
l
.
append
(
l
.
append
(
f
'ip addr add
{
self
.
ip
}
/
{
self
.
prefix
}
dev
{
self
.
ifname
}
'
)
'ip addr add %s/%d dev %s'
%
(
self
.
ip
,
self
.
prefix
,
self
.
ifname
)
)
return
super
().
prepare_post_cp
()
+
l
return
super
().
prepare_post_cp
()
+
l
...
@@ -169,6 +167,7 @@ class CorundumLinuxNode(LinuxNode):
...
@@ -169,6 +167,7 @@ class CorundumLinuxNode(LinuxNode):
super
().
__init__
()
super
().
__init__
()
self
.
drivers
.
append
(
'/tmp/guest/mqnic.ko'
)
self
.
drivers
.
append
(
'/tmp/guest/mqnic.ko'
)
# pylint: disable=consider-using-with
def
config_files
(
self
):
def
config_files
(
self
):
m
=
{
'mqnic.ko'
:
open
(
'../images/mqnic/mqnic.ko'
,
'rb'
)}
m
=
{
'mqnic.ko'
:
open
(
'../images/mqnic/mqnic.ko'
,
'rb'
)}
return
{
**
m
,
**
super
().
config_files
()}
return
{
**
m
,
**
super
().
config_files
()}
...
@@ -207,7 +206,7 @@ class MtcpNode(NodeConfig):
...
@@ -207,7 +206,7 @@ class MtcpNode(NodeConfig):
'insmod /root/mtcp/dpdk-iface-kmod/dpdk_iface.ko'
,
'insmod /root/mtcp/dpdk-iface-kmod/dpdk_iface.ko'
,
'/root/mtcp/dpdk-iface-kmod/dpdk_iface_main'
,
'/root/mtcp/dpdk-iface-kmod/dpdk_iface_main'
,
'ip link set dev dpdk0 up'
,
'ip link set dev dpdk0 up'
,
'ip addr add
%s/%d dev dpdk0'
%
(
self
.
ip
,
self
.
prefix
)
f
'ip addr add
{
self
.
ip
}
/
{
self
.
prefix
}
dev dpdk0'
]
]
def
config_files
(
self
):
def
config_files
(
self
):
...
@@ -256,8 +255,10 @@ class TASNode(NodeConfig):
...
@@ -256,8 +255,10 @@ class TASNode(NodeConfig):
'insmod /root/dpdk/lib/modules/5.4.46/extra/dpdk/igb_uio.ko'
,
'insmod /root/dpdk/lib/modules/5.4.46/extra/dpdk/igb_uio.ko'
,
'/root/dpdk/sbin/dpdk-devbind -b igb_uio '
+
self
.
pci_dev
,
'/root/dpdk/sbin/dpdk-devbind -b igb_uio '
+
self
.
pci_dev
,
'cd /root/tas'
,
'cd /root/tas'
,
'tas/tas --ip-addr=%s/%d --fp-cores-max=%d --fp-no-ints &'
%
(
(
self
.
ip
,
self
.
prefix
,
self
.
fp_cores
),
f
'tas/tas --ip-addr=
{
self
.
ip
}
/
{
self
.
prefix
}
'
f
' --fp-cores-max=
{
self
.
fp_cores
}
--fp-no-ints &'
),
'sleep 1'
'sleep 1'
]
]
...
@@ -358,7 +359,7 @@ class DctcpClient(AppConfig):
...
@@ -358,7 +359,7 @@ class DctcpClient(AppConfig):
is_last
=
False
is_last
=
False
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
if
(
self
.
is_last
)
:
if
self
.
is_last
:
return
[
return
[
'sleep 1'
,
'sleep 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
...
@@ -454,10 +455,10 @@ class NoTraffic(AppConfig):
...
@@ -454,10 +455,10 @@ class NoTraffic(AppConfig):
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
cmds
=
[]
cmds
=
[]
if
(
self
.
is_server
)
:
if
self
.
is_server
:
cmds
.
append
(
'sleep infinity'
)
cmds
.
append
(
'sleep infinity'
)
else
:
else
:
if
(
self
.
is_sleep
)
:
if
self
.
is_sleep
:
cmds
.
append
(
'sleep 10'
)
cmds
.
append
(
'sleep 10'
)
else
:
else
:
...
@@ -478,10 +479,15 @@ class NetperfClient(AppConfig):
...
@@ -478,10 +479,15 @@ class NetperfClient(AppConfig):
duration_lat
=
10
duration_lat
=
10
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
return
[
'netserver'
,
'sleep 0.5'
,
return
[
'netperf -H '
+
self
.
server_ip
+
' -l '
+
str
(
self
.
duration_tp
),
'netserver'
,
'netperf -H '
+
self
.
server_ip
+
' -l '
+
str
(
self
.
duration_lat
)
+
\
'sleep 0.5'
,
' -t TCP_RR -- -o mean_latency,p50_latency,p90_latency,p99_latency'
]
f
'netperf -H
{
self
.
server_ip
}
-l
{
self
.
duration_tp
}
'
,
(
f
'netperf -H
{
self
.
server_ip
}
-l
{
self
.
duration_lat
}
-t TCP_RR'
' -- -o mean_latency,p50_latency,p90_latency,p99_latency'
)
]
class
VRReplica
(
AppConfig
):
class
VRReplica
(
AppConfig
):
...
@@ -542,9 +548,10 @@ class NOPaxosClient(AppConfig):
...
@@ -542,9 +548,10 @@ class NOPaxosClient(AppConfig):
class
NOPaxosSequencer
(
AppConfig
):
class
NOPaxosSequencer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
return
[
return
[(
'/root/nopaxos/sequencer/sequencer -c /root/nopaxos.config -m nopaxos'
'/root/nopaxos/sequencer/sequencer -c /root/nopaxos.config'
]
' -m nopaxos'
)]
class
RPCServer
(
AppConfig
):
class
RPCServer
(
AppConfig
):
...
@@ -558,8 +565,10 @@ class RPCServer(AppConfig):
...
@@ -558,8 +565,10 @@ class RPCServer(AppConfig):
'echoserver_mtcp'
'echoserver_mtcp'
return
[
return
[
'cd /root/tasbench/micro_rpc'
,
'cd /root/tasbench/micro_rpc'
,
'./%s %d %d /tmp/guest/mtcp.conf %d %d'
%
(
(
exe
,
self
.
port
,
self
.
threads
,
self
.
max_flows
,
self
.
max_bytes
)
f
'./
{
exe
}
{
self
.
port
}
{
self
.
threads
}
/tmp/guest/mtcp.conf'
f
'
{
self
.
max_flows
}
{
self
.
max_bytes
}
'
)
]
]
...
@@ -580,19 +589,13 @@ class RPCClient(AppConfig):
...
@@ -580,19 +589,13 @@ class RPCClient(AppConfig):
'testclient_mtcp'
'testclient_mtcp'
return
[
return
[
'cd /root/tasbench/micro_rpc'
,
'cd /root/tasbench/micro_rpc'
,
'./%s %s %d %d /tmp/guest/mtcp.conf %d %d %d %d %d %d &'
%
(
(
exe
,
f
'./
{
exe
}
{
self
.
server_ip
}
{
self
.
port
}
{
self
.
threads
}
'
self
.
server_ip
,
f
' /tmp/guest/mtcp.conf
{
self
.
max_bytes
}
{
self
.
max_pending
}
'
self
.
port
,
f
'
{
self
.
max_flows
}
{
self
.
openall_delay
}
{
self
.
max_msgs_conn
}
'
self
.
threads
,
f
'
{
self
.
max_pend_conns
}
&'
self
.
max_bytes
,
self
.
max_pending
,
self
.
max_flows
,
self
.
openall_delay
,
self
.
max_msgs_conn
,
self
.
max_pend_conns
),
),
'sleep
%d'
%
(
self
.
time
)
f
'sleep
{
self
.
time
}
'
]
]
...
@@ -606,14 +609,22 @@ class HTTPD(AppConfig):
...
@@ -606,14 +609,22 @@ class HTTPD(AppConfig):
httpd_dir
:
str
# TODO added because doesn't originally exist
httpd_dir
:
str
# TODO added because doesn't originally exist
def
prepare_pre_cp
(
self
):
def
prepare_pre_cp
(
self
):
return
[
'mkdir -p /srv/www/htdocs/ /tmp/lighttpd/'
,
return
[
'dd if=/dev/zero of=/srv/www/htdocs/file bs=%d count=1'
%
\
'mkdir -p /srv/www/htdocs/ /tmp/lighttpd/'
,
(
self
.
file_size
)]
(
f
'dd if=/dev/zero of=/srv/www/htdocs/file bs=
{
self
.
file_size
}
'
' count=1'
)
]
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
return
[
'cd %s/src/'
%
(
self
.
httpd_dir
),
return
[
'./lighttpd -D -f ../doc/config/%s -n %d -m ./.libs/'
%
\
f
'cd
{
self
.
httpd_dir
}
/src/'
,
(
self
.
mtcp_config
,
self
.
threads
)]
(
f
'./lighttpd -D -f ../doc/config/
{
self
.
mtcp_config
}
'
f
' -n
{
self
.
threads
}
-m ./.libs/'
)
]
class
HTTPDLinux
(
HTTPD
):
class
HTTPDLinux
(
HTTPD
):
...
@@ -630,9 +641,12 @@ class HTTPDMtcp(HTTPD):
...
@@ -630,9 +641,12 @@ class HTTPDMtcp(HTTPD):
def
prepare_pre_cp
(
self
):
def
prepare_pre_cp
(
self
):
return
super
().
prepare_pre_cp
()
+
[
return
super
().
prepare_pre_cp
()
+
[
'cp /tmp/guest/mtcp.conf %s/src/mtcp.conf'
%
(
self
.
httpd_dir
),
f
'cp /tmp/guest/mtcp.conf
{
self
.
httpd_dir
}
/src/mtcp.conf'
,
'sed -i "s:^server.document-root =.*:server.document-root = server_root +
\\
"/htdocs
\\
":" %s'
%
\
(
(
self
.
httpd_dir
+
'/doc/config/'
+
self
.
mtcp_config
)
'sed -i "s:^server.document-root =.*:server.document-root = '
'server_root +
\\
"/htdocs
\\
":" '
f
'
{
self
.
httpd_dir
}
/doc/config/
{
self
.
mtcp_config
}
'
)
]
]
...
@@ -646,10 +660,13 @@ class HTTPC(AppConfig):
...
@@ -646,10 +660,13 @@ class HTTPC(AppConfig):
ab_dir
:
str
# TODO added because doesn't originally exist
ab_dir
:
str
# TODO added because doesn't originally exist
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
return
[
'cd %s/support/'
%
(
self
.
ab_dir
),
return
[
'./ab -N %d -c %d -n %d %s%s'
%
\
f
'cd
{
self
.
ab_dir
}
/support/'
,
(
self
.
threads
,
self
.
conns
,
self
.
requests
,
self
.
server_ip
,
(
self
.
url
)]
f
'./ab -N
{
self
.
threads
}
-c
{
self
.
conns
}
-n
{
self
.
requests
}
'
f
'
{
self
.
server_ip
}{
self
.
url
}
'
)
]
class
HTTPCLinux
(
HTTPC
):
class
HTTPCLinux
(
HTTPC
):
...
@@ -661,9 +678,8 @@ class HTTPCMtcp(HTTPC):
...
@@ -661,9 +678,8 @@ class HTTPCMtcp(HTTPC):
def
prepare_pre_cp
(
self
):
def
prepare_pre_cp
(
self
):
return
super
().
prepare_pre_cp
()
+
[
return
super
().
prepare_pre_cp
()
+
[
'cp /tmp/guest/mtcp.conf %s/support/config/mtcp.conf'
%
\
f
'cp /tmp/guest/mtcp.conf
{
self
.
ab_dir
}
/support/config/mtcp.conf'
,
(
self
.
ab_dir
),
f
'rm -f
{
self
.
ab_dir
}
/support/config/arp.conf'
'rm -f %s/support/config/arp.conf'
%
(
self
.
ab_dir
)
]
]
...
@@ -682,6 +698,8 @@ class MemcachedClient(AppConfig):
...
@@ -682,6 +698,8 @@ class MemcachedClient(AppConfig):
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
servers
=
[
ip
+
':11211'
for
ip
in
self
.
server_ips
]
servers
=
[
ip
+
':11211'
for
ip
in
self
.
server_ips
]
servers
=
','
.
join
(
servers
)
servers
=
','
.
join
(
servers
)
return
[
return
[(
f
'memaslap --binary --time 10s --server=
{
servers
}
--thread=
{
self
.
threads
}
--concurrency=
{
self
.
concurrency
}
--tps=
{
self
.
throughput
}
--verbose'
f
'memaslap --binary --time 10s --server=
{
servers
}
'
]
f
' --thread=
{
self
.
threads
}
--concurrency=
{
self
.
concurrency
}
'
f
' --tps=
{
self
.
throughput
}
--verbose'
)]
experiments/simbricks/proxy.py
View file @
78d4c701
...
@@ -29,9 +29,6 @@ class SimProxy(Simulator):
...
@@ -29,9 +29,6 @@ class SimProxy(Simulator):
ip
=
''
ip
=
''
listen
=
False
listen
=
False
def
__init__
(
self
):
super
().
__init__
()
def
full_name
(
self
):
def
full_name
(
self
):
return
'proxy.'
+
self
.
name
return
'proxy.'
+
self
.
name
...
@@ -47,9 +44,6 @@ class NetProxy(SimProxy):
...
@@ -47,9 +44,6 @@ class NetProxy(SimProxy):
# Shared memory size in GB
# Shared memory size in GB
shm_size
=
2048
shm_size
=
2048
def
__init__
(
self
):
super
().
__init__
()
def
start_delay
(
self
):
def
start_delay
(
self
):
return
10
return
10
...
@@ -83,7 +77,7 @@ class NetProxyListener(NetProxy):
...
@@ -83,7 +77,7 @@ class NetProxyListener(NetProxy):
for
(
nic
,
local
)
in
self
.
nics
:
for
(
nic
,
local
)
in
self
.
nics
:
if
local
:
if
local
:
deps
.
append
(
nic
)
deps
.
append
(
nic
)
for
((
net_c
,
net_l
),
local
)
in
self
.
n2ns
:
for
((
_
,
net_l
),
local
)
in
self
.
n2ns
:
if
local
:
if
local
:
deps
.
append
(
net_l
)
deps
.
append
(
net_l
)
return
deps
return
deps
...
@@ -151,7 +145,7 @@ class NetProxyConnecter(NetProxy):
...
@@ -151,7 +145,7 @@ class NetProxyConnecter(NetProxy):
for
(
nic
,
local
)
in
self
.
nics
:
for
(
nic
,
local
)
in
self
.
nics
:
if
not
local
:
if
not
local
:
deps
.
append
(
nic
)
deps
.
append
(
nic
)
for
((
net_c
,
net_l
),
local
)
in
self
.
n2ns
:
for
((
_
,
net_l
),
local
)
in
self
.
n2ns
:
if
not
local
:
if
not
local
:
deps
.
append
(
net_l
)
deps
.
append
(
net_l
)
return
deps
return
deps
...
@@ -194,9 +188,6 @@ class NetProxyConnecter(NetProxy):
...
@@ -194,9 +188,6 @@ class NetProxyConnecter(NetProxy):
class
RDMANetProxyListener
(
NetProxyListener
):
class
RDMANetProxyListener
(
NetProxyListener
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
f
'
{
env
.
repodir
}
/dist/rdma/net_rdma -l '
cmd
=
f
'
{
env
.
repodir
}
/dist/rdma/net_rdma -l '
cmd
+=
super
().
run_cmd_base
(
env
)
cmd
+=
super
().
run_cmd_base
(
env
)
...
@@ -205,9 +196,6 @@ class RDMANetProxyListener(NetProxyListener):
...
@@ -205,9 +196,6 @@ class RDMANetProxyListener(NetProxyListener):
class
RDMANetProxyConnecter
(
NetProxyConnecter
):
class
RDMANetProxyConnecter
(
NetProxyConnecter
):
def
__init__
(
self
,
listener
):
super
().
__init__
(
listener
)
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
f
'
{
env
.
repodir
}
/dist/rdma/net_rdma '
cmd
=
f
'
{
env
.
repodir
}
/dist/rdma/net_rdma '
cmd
+=
super
().
run_cmd_base
(
env
)
cmd
+=
super
().
run_cmd_base
(
env
)
...
@@ -216,9 +204,6 @@ class RDMANetProxyConnecter(NetProxyConnecter):
...
@@ -216,9 +204,6 @@ class RDMANetProxyConnecter(NetProxyConnecter):
class
SocketsNetProxyListener
(
NetProxyListener
):
class
SocketsNetProxyListener
(
NetProxyListener
):
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
f
'
{
env
.
repodir
}
/dist/sockets/net_sockets -l '
cmd
=
f
'
{
env
.
repodir
}
/dist/sockets/net_sockets -l '
cmd
+=
super
().
run_cmd_base
(
env
)
cmd
+=
super
().
run_cmd_base
(
env
)
...
@@ -227,9 +212,6 @@ class SocketsNetProxyListener(NetProxyListener):
...
@@ -227,9 +212,6 @@ class SocketsNetProxyListener(NetProxyListener):
class
SocketsNetProxyConnecter
(
NetProxyConnecter
):
class
SocketsNetProxyConnecter
(
NetProxyConnecter
):
def
__init__
(
self
,
listener
):
super
().
__init__
(
listener
)
def
run_cmd
(
self
,
env
):
def
run_cmd
(
self
,
env
):
cmd
=
f
'
{
env
.
repodir
}
/dist/sockets/net_sockets '
cmd
=
f
'
{
env
.
repodir
}
/dist/sockets/net_sockets '
cmd
+=
super
().
run_cmd_base
(
env
)
cmd
+=
super
().
run_cmd_base
(
env
)
...
...
experiments/simbricks/runtime/common.py
View file @
78d4c701
...
@@ -28,10 +28,10 @@ import shutil
...
@@ -28,10 +28,10 @@ import shutil
import
typing
as
tp
import
typing
as
tp
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
import
simbricks.exectools
as
exectools
from
simbricks.experiment.experiment_environment
import
ExpEnv
from
simbricks.experiment.experiment_environment
import
ExpEnv
from
simbricks.experiment.experiment_output
import
ExpOutput
from
simbricks.experiment.experiment_output
import
ExpOutput
from
simbricks
import
exectools
from
simbricks.experiments
import
Experiment
from
simbricks.experiments
import
Experiment
...
@@ -56,22 +56,22 @@ class Run(object):
...
@@ -56,22 +56,22 @@ class Run(object):
def
name
(
self
):
def
name
(
self
):
return
self
.
experiment
.
name
+
'.'
+
str
(
self
.
index
)
return
self
.
experiment
.
name
+
'.'
+
str
(
self
.
index
)
async
def
prep_dirs
(
self
,
exec
=
exectools
.
LocalExecutor
()):
async
def
prep_dirs
(
self
,
exec
utor
=
exectools
.
LocalExecutor
()):
shutil
.
rmtree
(
self
.
env
.
workdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
self
.
env
.
workdir
,
ignore_errors
=
True
)
await
exec
.
rmtree
(
self
.
env
.
workdir
)
await
exec
utor
.
rmtree
(
self
.
env
.
workdir
)
shutil
.
rmtree
(
self
.
env
.
shm_base
,
ignore_errors
=
True
)
shutil
.
rmtree
(
self
.
env
.
shm_base
,
ignore_errors
=
True
)
await
exec
.
rmtree
(
self
.
env
.
shm_base
)
await
exec
utor
.
rmtree
(
self
.
env
.
shm_base
)
if
self
.
env
.
create_cp
:
if
self
.
env
.
create_cp
:
shutil
.
rmtree
(
self
.
env
.
cpdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
self
.
env
.
cpdir
,
ignore_errors
=
True
)
await
exec
.
rmtree
(
self
.
env
.
cpdir
)
await
exec
utor
.
rmtree
(
self
.
env
.
cpdir
)
pathlib
.
Path
(
self
.
env
.
workdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
self
.
env
.
workdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
exec
.
mkdir
(
self
.
env
.
workdir
)
await
exec
utor
.
mkdir
(
self
.
env
.
workdir
)
pathlib
.
Path
(
self
.
env
.
cpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
self
.
env
.
cpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
exec
.
mkdir
(
self
.
env
.
cpdir
)
await
exec
utor
.
mkdir
(
self
.
env
.
cpdir
)
pathlib
.
Path
(
self
.
env
.
shm_base
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
self
.
env
.
shm_base
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
exec
.
mkdir
(
self
.
env
.
shm_base
)
await
exec
utor
.
mkdir
(
self
.
env
.
shm_base
)
class
Runtime
(
metaclass
=
ABCMeta
):
class
Runtime
(
metaclass
=
ABCMeta
):
...
...
experiments/simbricks/runtime/distributed.py
View file @
78d4c701
...
@@ -22,21 +22,22 @@
...
@@ -22,21 +22,22 @@
import
asyncio
import
asyncio
import
pathlib
import
pathlib
import
typing
as
tp
import
simbricks.proxy
as
proxy
from
simbricks.exectools
import
Executor
from
simbricks.exectools
import
Executor
from
simbricks.runtime.common
import
*
from
simbricks.runtime.common
import
Run
,
Runtime
import
simbricks.experiments
as
exp
import
simbricks.experiments
as
exp
from
simbricks
import
proxy
class
DistributedSimpleRuntime
(
Runtime
):
class
DistributedSimpleRuntime
(
Runtime
):
def
__init__
(
self
,
execs
,
verbose
=
False
):
def
__init__
(
self
,
exec
utor
s
,
verbose
=
False
):
self
.
runnable
=
[]
self
.
runnable
=
[]
self
.
complete
=
[]
self
.
complete
=
[]
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
execs
=
execs
self
.
exec
utor
s
=
exec
utor
s
def
add_run
(
self
,
run
:
Run
):
def
add_run
(
self
,
run
:
Run
):
if
not
isinstance
(
run
.
experiment
,
exp
.
DistributedExperiment
):
if
not
isinstance
(
run
.
experiment
,
exp
.
DistributedExperiment
):
...
@@ -46,16 +47,16 @@ class DistributedSimpleRuntime(Runtime):
...
@@ -46,16 +47,16 @@ class DistributedSimpleRuntime(Runtime):
async
def
do_run
(
self
,
run
:
Run
):
async
def
do_run
(
self
,
run
:
Run
):
runner
=
exp
.
ExperimentDistributedRunner
(
runner
=
exp
.
ExperimentDistributedRunner
(
self
.
execs
,
run
.
experiment
,
run
.
env
,
self
.
verbose
self
.
exec
utor
s
,
run
.
experiment
,
run
.
env
,
self
.
verbose
)
)
for
exec
in
self
.
execs
:
for
exec
utor
in
self
.
exec
utor
s
:
await
run
.
prep_dirs
(
exec
)
await
run
.
prep_dirs
(
exec
utor
)
await
runner
.
prepare
()
await
runner
.
prepare
()
run
.
output
=
await
runner
.
run
()
run
.
output
=
await
runner
.
run
()
self
.
complete
.
append
(
run
)
self
.
complete
.
append
(
run
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
with
open
(
run
.
outpath
,
'w'
)
as
f
:
with
open
(
run
.
outpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
run
.
output
.
dumps
())
f
.
write
(
run
.
output
.
dumps
())
def
start
(
self
):
def
start
(
self
):
...
@@ -64,7 +65,7 @@ class DistributedSimpleRuntime(Runtime):
...
@@ -64,7 +65,7 @@ class DistributedSimpleRuntime(Runtime):
def
auto_dist
(
def
auto_dist
(
e
:
Experiment
,
execs
:
tp
.
List
[
Executor
],
proxy_type
:
str
=
'sockets'
e
:
exp
.
Experiment
,
execs
:
tp
.
List
[
Executor
],
proxy_type
:
str
=
'sockets'
):
):
"""
"""
Converts an Experiment into a DistributedExperiment.
Converts an Experiment into a DistributedExperiment.
...
...
experiments/simbricks/runtime/local.py
View file @
78d4c701
...
@@ -22,12 +22,12 @@
...
@@ -22,12 +22,12 @@
import
asyncio
import
asyncio
import
pathlib
import
pathlib
from
typing
import
Optional
import
typing
as
tp
import
simbricks.exectools
as
exectools
from
simbricks.runtime.common
import
Run
,
Runtime
from
simbricks.runtime.common
import
*
import
simbricks.experiments
as
exp
import
simbricks.experiments
as
exp
from
simbricks
import
exectools
class
LocalSimpleRuntime
(
Runtime
):
class
LocalSimpleRuntime
(
Runtime
):
...
@@ -36,12 +36,12 @@ class LocalSimpleRuntime(Runtime):
...
@@ -36,12 +36,12 @@ class LocalSimpleRuntime(Runtime):
def
__init__
(
def
__init__
(
self
,
self
,
verbose
=
False
,
verbose
=
False
,
exec
:
exectools
.
Executor
=
exectools
.
LocalExecutor
()
exec
utor
:
exectools
.
Executor
=
exectools
.
LocalExecutor
()
):
):
self
.
runnable
:
tp
.
List
[
Run
]
=
[]
self
.
runnable
:
tp
.
List
[
Run
]
=
[]
self
.
complete
:
tp
.
List
[
Run
]
=
[]
self
.
complete
:
tp
.
List
[
Run
]
=
[]
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
exec
=
exec
self
.
exec
utor
=
exec
utor
def
add_run
(
self
,
run
:
Run
):
def
add_run
(
self
,
run
:
Run
):
self
.
runnable
.
append
(
run
)
self
.
runnable
.
append
(
run
)
...
@@ -49,15 +49,15 @@ class LocalSimpleRuntime(Runtime):
...
@@ -49,15 +49,15 @@ class LocalSimpleRuntime(Runtime):
async
def
do_run
(
self
,
run
:
Run
):
async
def
do_run
(
self
,
run
:
Run
):
"""Actually executes `run`."""
"""Actually executes `run`."""
runner
=
exp
.
ExperimentSimpleRunner
(
runner
=
exp
.
ExperimentSimpleRunner
(
self
.
exec
,
run
.
experiment
,
run
.
env
,
self
.
verbose
self
.
exec
utor
,
run
.
experiment
,
run
.
env
,
self
.
verbose
)
)
await
run
.
prep_dirs
(
self
.
exec
)
await
run
.
prep_dirs
(
self
.
exec
utor
)
await
runner
.
prepare
()
await
runner
.
prepare
()
run
.
output
=
await
runner
.
run
()
run
.
output
=
await
runner
.
run
()
self
.
complete
.
append
(
run
)
self
.
complete
.
append
(
run
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
with
open
(
run
.
outpath
,
'w'
)
as
f
:
with
open
(
run
.
outpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
run
.
output
.
dumps
())
f
.
write
(
run
.
output
.
dumps
())
def
start
(
self
):
def
start
(
self
):
...
@@ -72,9 +72,9 @@ class LocalParallelRuntime(Runtime):
...
@@ -72,9 +72,9 @@ class LocalParallelRuntime(Runtime):
def
__init__
(
def
__init__
(
self
,
self
,
cores
:
int
,
cores
:
int
,
mem
:
Optional
[
int
]
=
None
,
mem
:
tp
.
Optional
[
int
]
=
None
,
verbose
=
False
,
verbose
=
False
,
exec
:
exectools
.
Executor
=
exectools
.
LocalExecutor
()
exec
utor
:
exectools
.
Executor
=
exectools
.
LocalExecutor
()
):
):
self
.
runs_noprereq
:
tp
.
List
[
Run
]
=
[]
self
.
runs_noprereq
:
tp
.
List
[
Run
]
=
[]
"""Runs with no prerequesite runs."""
"""Runs with no prerequesite runs."""
...
@@ -84,7 +84,7 @@ class LocalParallelRuntime(Runtime):
...
@@ -84,7 +84,7 @@ class LocalParallelRuntime(Runtime):
self
.
cores
=
cores
self
.
cores
=
cores
self
.
mem
=
mem
self
.
mem
=
mem
self
.
verbose
=
verbose
self
.
verbose
=
verbose
self
.
exec
=
exec
self
.
exec
utor
=
exec
utor
def
add_run
(
self
,
run
:
Run
):
def
add_run
(
self
,
run
:
Run
):
if
run
.
experiment
.
resreq_cores
()
>
self
.
cores
:
if
run
.
experiment
.
resreq_cores
()
>
self
.
cores
:
...
@@ -101,15 +101,15 @@ class LocalParallelRuntime(Runtime):
...
@@ -101,15 +101,15 @@ class LocalParallelRuntime(Runtime):
async
def
do_run
(
self
,
run
:
Run
):
async
def
do_run
(
self
,
run
:
Run
):
"""Actually executes `run`."""
"""Actually executes `run`."""
runner
=
exp
.
ExperimentSimpleRunner
(
runner
=
exp
.
ExperimentSimpleRunner
(
self
.
exec
,
run
.
experiment
,
run
.
env
,
self
.
verbose
self
.
exec
utor
,
run
.
experiment
,
run
.
env
,
self
.
verbose
)
)
await
run
.
prep_dirs
(
exec
=
self
.
exec
)
await
run
.
prep_dirs
(
exec
utor
=
self
.
exec
utor
)
await
runner
.
prepare
()
await
runner
.
prepare
()
print
(
'starting run '
,
run
.
name
())
print
(
'starting run '
,
run
.
name
())
run
.
output
=
await
runner
.
run
()
run
.
output
=
await
runner
.
run
()
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
with
open
(
run
.
outpath
,
'w'
)
as
f
:
with
open
(
run
.
outpath
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
run
.
output
.
dumps
())
f
.
write
(
run
.
output
.
dumps
())
print
(
'finished run '
,
run
.
name
())
print
(
'finished run '
,
run
.
name
())
return
run
return
run
...
@@ -130,7 +130,7 @@ class LocalParallelRuntime(Runtime):
...
@@ -130,7 +130,7 @@ class LocalParallelRuntime(Runtime):
def
enough_resources
(
self
,
run
:
Run
):
def
enough_resources
(
self
,
run
:
Run
):
"""Check if enough cores and mem are available for the run."""
"""Check if enough cores and mem are available for the run."""
exp
=
run
.
experiment
exp
=
run
.
experiment
# pylint: disable=redefined-outer-name
if
self
.
cores
is
not
None
:
if
self
.
cores
is
not
None
:
enough_cores
=
(
self
.
cores
-
self
.
cores_used
)
>=
exp
.
resreq_cores
()
enough_cores
=
(
self
.
cores
-
self
.
cores_used
)
>=
exp
.
resreq_cores
()
...
...
experiments/simbricks/runtime/slurm.py
View file @
78d4c701
...
@@ -25,7 +25,7 @@ import pathlib
...
@@ -25,7 +25,7 @@ import pathlib
import
pickle
import
pickle
import
re
import
re
from
simbricks.runtime.common
import
*
from
simbricks.runtime.common
import
Run
,
Runtime
class
SlurmRuntime
(
Runtime
):
class
SlurmRuntime
(
Runtime
):
...
@@ -55,17 +55,17 @@ class SlurmRuntime(Runtime):
...
@@ -55,17 +55,17 @@ class SlurmRuntime(Runtime):
print
(
exp_script
)
print
(
exp_script
)
# write out pickled run
# write out pickled run
with
open
(
exp_path
,
'wb'
)
as
f
:
with
open
(
exp_path
,
'wb'
,
encoding
=
'utf-8'
)
as
f
:
run
.
prereq
=
None
# we don't want to pull in the prereq too
run
.
prereq
=
None
# we don't want to pull in the prereq too
pickle
.
dump
(
run
,
f
)
pickle
.
dump
(
run
,
f
)
# create slurm batch script
# create slurm batch script
with
open
(
exp_script
,
'w'
)
as
f
:
with
open
(
exp_script
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
'#!/bin/sh
\n
'
)
f
.
write
(
'#!/bin/sh
\n
'
)
f
.
write
(
'#SBATCH -o
%s -e %s
\n
'
%
(
exp_log
,
exp_log
)
)
f
.
write
(
f
'#SBATCH -o
{
exp_log
}
-e
{
exp_log
}
\n
'
)
#f.write('#SBATCH -c %d\n' % (exp.resreq_cores(),))
#f.write('#SBATCH -c %d\n' % (exp.resreq_cores(),))
f
.
write
(
'#SBATCH --mem=
%dM
\n
'
%
(
exp
.
resreq_mem
()
,)
)
f
.
write
(
f
'#SBATCH --mem=
{
exp
.
resreq_mem
()
}
M
\n
'
)
f
.
write
(
'#SBATCH --job-name="
%s"
\n
'
%
(
run
.
name
()
,)
)
f
.
write
(
f
'#SBATCH --job-name="
{
run
.
name
()
}
"
\n
'
)
f
.
write
(
'#SBATCH --exclude=spyder[01-05],spyder16
\n
'
)
f
.
write
(
'#SBATCH --exclude=spyder[01-05],spyder16
\n
'
)
f
.
write
(
'#SBATCH -c 32
\n
'
)
f
.
write
(
'#SBATCH -c 32
\n
'
)
f
.
write
(
'#SBATCH --nodes=1
\n
'
)
f
.
write
(
'#SBATCH --nodes=1
\n
'
)
...
@@ -73,16 +73,16 @@ class SlurmRuntime(Runtime):
...
@@ -73,16 +73,16 @@ class SlurmRuntime(Runtime):
h
=
int
(
exp
.
timeout
/
3600
)
h
=
int
(
exp
.
timeout
/
3600
)
m
=
int
((
exp
.
timeout
%
3600
)
/
60
)
m
=
int
((
exp
.
timeout
%
3600
)
/
60
)
s
=
int
(
exp
.
timeout
%
60
)
s
=
int
(
exp
.
timeout
%
60
)
f
.
write
(
'#SBATCH --time=
%02d:%02d:%
02d
\n
'
%
(
h
,
m
,
s
)
)
f
.
write
(
f
'#SBATCH --time=
{
h
:
02
d
}
:
{
m
:
02
d
}
:
{
s
:
02
d
}
\n
'
)
extra
=
''
extra
=
''
if
self
.
verbose
:
if
self
.
verbose
:
extra
=
'--verbose'
extra
=
'--verbose'
f
.
write
(
'python3 run.py
%s
--pickled
%s
\n
'
%
(
extra
,
exp_path
)
)
f
.
write
(
f
'python3 run.py
{
extra
}
--pickled
{
exp_path
}
\n
'
)
f
.
write
(
'status=$?
\n
'
)
f
.
write
(
'status=$?
\n
'
)
if
self
.
cleanup
:
if
self
.
cleanup
:
f
.
write
(
'rm -rf
%s
\n
'
%
(
run
.
env
.
workdir
)
)
f
.
write
(
f
'rm -rf
{
run
.
env
.
workdir
}
\n
'
)
f
.
write
(
'exit $status
\n
'
)
f
.
write
(
'exit $status
\n
'
)
return
exp_script
return
exp_script
...
@@ -100,7 +100,7 @@ class SlurmRuntime(Runtime):
...
@@ -100,7 +100,7 @@ class SlurmRuntime(Runtime):
script
=
self
.
prep_run
(
run
)
script
=
self
.
prep_run
(
run
)
stream
=
os
.
popen
(
'sbatch
%s %s'
%
(
dep_cmd
,
script
)
)
stream
=
os
.
popen
(
f
'sbatch
{
dep_cmd
}
{
script
}
'
)
output
=
stream
.
read
()
output
=
stream
.
read
()
result
=
stream
.
close
()
result
=
stream
.
close
()
...
...
experiments/simbricks/simulator_utils.py
View file @
78d4c701
...
@@ -56,12 +56,12 @@ def create_basic_hosts(
...
@@ -56,12 +56,12 @@ def create_basic_hosts(
nic
.
set_network
(
net
)
nic
.
set_network
(
net
)
host
=
host_class
()
host
=
host_class
()
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
host
.
name
=
f
'
{
name_prefix
}
.
{
i
}
'
node_config
=
nc_class
()
node_config
=
nc_class
()
node_config
.
prefix
=
ip_prefix
node_config
.
prefix
=
ip_prefix
ip
=
ip_start
+
i
ip
=
ip_start
+
i
node_config
.
ip
=
'10.0.
%d.%d'
%
(
int
(
ip
/
256
)
,
ip
%
256
)
node_config
.
ip
=
f
'10.0.
{
int
(
ip
/
256
)
}
.
{
ip
%
256
}
'
node_config
.
app
=
app_class
()
node_config
.
app
=
app_class
()
host
.
set_config
(
node_config
)
host
.
set_config
(
node_config
)
...
@@ -105,12 +105,12 @@ def create_multinic_hosts(
...
@@ -105,12 +105,12 @@ def create_multinic_hosts(
nic
.
set_network
(
net
)
nic
.
set_network
(
net
)
host
=
host_class
()
host
=
host_class
()
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
host
.
name
=
f
'
{
name_prefix
}
.
{
i
}
'
node_config
=
nc_class
()
node_config
=
nc_class
()
node_config
.
prefix
=
ip_prefix
node_config
.
prefix
=
ip_prefix
ip
=
ip_start
+
i
ip
=
ip_start
+
i
node_config
.
ip
=
'10.0.
%d.%d'
%
(
int
(
ip
/
256
)
,
ip
%
256
)
node_config
.
ip
=
f
'10.0.
{
int
(
ip
/
256
)
}
.
{
ip
%
256
}
'
node_config
.
app
=
app_class
()
node_config
.
app
=
app_class
()
host
.
set_config
(
node_config
)
host
.
set_config
(
node_config
)
...
@@ -150,12 +150,12 @@ def create_dctcp_hosts(
...
@@ -150,12 +150,12 @@ def create_dctcp_hosts(
nic
.
set_network
(
net
)
nic
.
set_network
(
net
)
host
=
host_class
()
host
=
host_class
()
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
host
.
name
=
f
'
{
name_prefix
}
.
{
i
}
'
host
.
cpu_freq
=
cpu_freq
host
.
cpu_freq
=
cpu_freq
node_config
=
nc_class
()
node_config
=
nc_class
()
node_config
.
mtu
=
mtu
node_config
.
mtu
=
mtu
node_config
.
ip
=
'192.168.64.
%d'
%
(
ip_start
+
i
)
node_config
.
ip
=
f
'192.168.64.
{
ip_start
+
i
}
'
node_config
.
app
=
app_class
()
node_config
.
app
=
app_class
()
host
.
set_config
(
node_config
)
host
.
set_config
(
node_config
)
...
...
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