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
7549fa9e
"vscode:/vscode.git/clone" did not exist on "c0ec4f80ffc6297601c7d640e4d1b210eb2438a6"
Commit
7549fa9e
authored
Jul 09, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Jul 12, 2022
Browse files
pre-commit run -a
parent
aac98df8
Changes
89
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
985 additions
and
422 deletions
+985
-422
experiments/pyexps/netperf.py
experiments/pyexps/netperf.py
+34
-9
experiments/pyexps/no-simbricks.py
experiments/pyexps/no-simbricks.py
+5
-12
experiments/pyexps/no_traffic.py
experiments/pyexps/no_traffic.py
+24
-17
experiments/pyexps/nopaxos.py
experiments/pyexps/nopaxos.py
+45
-13
experiments/pyexps/pci_validation.py
experiments/pyexps/pci_validation.py
+7
-5
experiments/pyexps/qemu_e1000_pair.py
experiments/pyexps/qemu_e1000_pair.py
+24
-8
experiments/pyexps/qemu_i40e_pair.py
experiments/pyexps/qemu_i40e_pair.py
+24
-8
experiments/pyexps/qemu_tcp_multi.py
experiments/pyexps/qemu_tcp_multi.py
+69
-24
experiments/pyexps/qemu_tcp_single.py
experiments/pyexps/qemu_tcp_single.py
+67
-21
experiments/pyexps/qemu_udp_multi.py
experiments/pyexps/qemu_udp_multi.py
+69
-24
experiments/pyexps/qemu_udp_single.py
experiments/pyexps/qemu_udp_single.py
+67
-21
experiments/pyexps/rpc_singlecore.py
experiments/pyexps/rpc_singlecore.py
+40
-29
experiments/pyexps/scalability.py
experiments/pyexps/scalability.py
+24
-7
experiments/run.py
experiments/run.py
+184
-69
experiments/simbricks/exectools.py
experiments/simbricks/exectools.py
+90
-46
experiments/simbricks/experiment/experiment_output.py
experiments/simbricks/experiment/experiment_output.py
+1
-2
experiments/simbricks/experiments.py
experiments/simbricks/experiments.py
+47
-33
experiments/simbricks/nodeconfig.py
experiments/simbricks/nodeconfig.py
+147
-67
experiments/simbricks/proxy.py
experiments/simbricks/proxy.py
+14
-4
experiments/simbricks/runtime/__init__.py
experiments/simbricks/runtime/__init__.py
+3
-3
No files found.
experiments/pyexps/netperf.py
View file @
7549fa9e
...
...
@@ -19,16 +19,20 @@
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Experiment, which simulates two hosts, one running a netperf server and the
"""
Experiment, which simulates two hosts, one running a netperf server and the
other a client with the goal of measuring latency and throughput between them.
The goal is to compare different simulators for host, NIC, and the network in
terms of simulated network throughput and latency."""
terms of simulated network throughput and latency.
"""
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
host_types
=
[
'qemu'
,
'gem5'
,
'qt'
]
nic_types
=
[
'i40e'
,
'cd_bm'
,
'cd_verilator'
]
net_types
=
[
'switch'
,
'ns3'
]
...
...
@@ -39,7 +43,9 @@ experiments = []
for
host_type
in
host_types
:
for
nic_type
in
nic_types
:
for
net_type
in
net_types
:
e
=
exp
.
Experiment
(
'netperf-'
+
host_type
+
'-'
+
net_type
+
'-'
+
nic_type
)
e
=
exp
.
Experiment
(
'netperf-'
+
host_type
+
'-'
+
net_type
+
'-'
+
nic_type
)
# network
if
net_type
==
'switch'
:
...
...
@@ -54,10 +60,12 @@ for host_type in host_types:
if
host_type
==
'qemu'
:
host_class
=
sim
.
QemuHost
elif
host_type
==
'qt'
:
def
qemu_timing
():
h
=
sim
.
QemuHost
()
h
.
sync
=
True
return
h
host_class
=
qemu_timing
elif
host_type
==
'gem5'
:
host_class
=
sim
.
Gem5Host
...
...
@@ -79,11 +87,28 @@ for host_type in host_types:
raise
NameError
(
nic_type
)
# create servers and clients
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NetperfServer
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NetperfServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NetperfClient
,
ip_start
=
2
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NetperfClient
,
ip_start
=
2
)
for
c
in
clients
:
c
.
wait
=
True
...
...
experiments/pyexps/no-simbricks.py
View file @
7549fa9e
...
...
@@ -20,16 +20,15 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
import
simbricks.experiments
as
exp
app_types
=
[
'sleep'
,
'busy'
]
experiments
=
[]
for
app_type
in
app_types
:
e
=
exp
.
Experiment
(
'no_simb-gt-'
+
app_type
)
...
...
@@ -37,11 +36,10 @@ for app_type in app_types:
host_class
=
sim
.
Gem5Host
e
.
checkpoint
=
True
e
.
no_simbricks
=
True
nc_class
=
node
.
I40eLinuxNode
# create servers and clients
host
=
host_class
()
host
.
name
=
'host.0'
node_config
=
nc_class
()
...
...
@@ -49,22 +47,17 @@ for app_type in app_types:
node_config
.
app
=
node
.
NoTraffic
()
node_config
.
cores
=
1
# is busy
# is busy
if
app_type
==
'sleep'
:
node_config
.
app
.
is_sleep
=
1
else
:
node_config
.
app
.
is_sleep
=
0
host
.
set_config
(
node_config
)
e
.
add_host
(
host
)
host
.
wait
=
True
print
(
e
.
name
)
# add to experiments
experiments
.
append
(
e
)
experiments/pyexps/no_traffic.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
# iperf TCP_single test
# naming convention following host-nic-net-app
...
...
@@ -34,11 +34,10 @@ from simbricks.simulator_utils import create_basic_hosts
# app: UDPs
host_types
=
[
'gt'
,
'qt'
,
'qemu'
]
nic_types
=
[
'cv'
,
'cb'
,
'ib'
]
nic_types
=
[
'cv'
,
'cb'
,
'ib'
]
net_types
=
[
'sw'
,
'br'
]
app_types
=
[
'sleep'
,
'busy'
]
num_cores
=
1
n_client
=
1
...
...
@@ -49,7 +48,10 @@ for host_type in host_types:
for
net_type
in
net_types
:
for
app_type
in
app_types
:
e
=
exp
.
Experiment
(
'noTraf-'
+
host_type
+
'-'
+
nic_type
+
'-'
+
net_type
+
'-'
+
app_type
)
e
=
exp
.
Experiment
(
'noTraf-'
+
host_type
+
'-'
+
nic_type
+
'-'
+
net_type
+
'-'
+
app_type
)
#e.no_simbricks = False
# network
if
net_type
==
'sw'
:
...
...
@@ -64,10 +66,12 @@ for host_type in host_types:
if
host_type
==
'qemu'
:
host_class
=
sim
.
QemuHost
elif
host_type
==
'qt'
:
def
qemu_timing
():
h
=
sim
.
QemuHost
()
h
.
sync
=
True
return
h
host_class
=
qemu_timing
elif
host_type
==
'gt'
:
host_class
=
sim
.
Gem5Host
...
...
@@ -92,35 +96,38 @@ for host_type in host_types:
"""
servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class,
nc_class, node.NoTraffic)
for s in servers:
s.node_config.cores = num_cores
s.node_config.app.is_sleep = 0
s.node_config.app.is_server = 1
"""
clients
=
create_basic_hosts
(
e
,
n_client
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NoTraffic
,
ip_start
=
2
)
clients
=
create_basic_hosts
(
e
,
n_client
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NoTraffic
,
ip_start
=
2
)
clients
[
n_client
-
1
].
wait
=
True
clients
[
n_client
-
1
].
wait
=
True
for
c
in
clients
:
c
.
node_config
.
cores
=
num_cores
# is busy
# is busy
if
app_type
==
'sleep'
:
c
.
node_config
.
app
.
is_sleep
=
1
else
:
c
.
node_config
.
app
.
is_sleep
=
0
#c.wait = True
print
(
e
.
name
)
# add to experiments
experiments
.
append
(
e
)
experiments/pyexps/nopaxos.py
View file @
7549fa9e
...
...
@@ -20,11 +20,12 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
host_configs
=
[
'qemu'
,
'gt'
,
'qt'
]
seq_configs
=
[
'swseq'
,
'ehseq'
,
'tofino'
]
nic_configs
=
[
'ib'
,
'cb'
,
'cv'
]
...
...
@@ -33,7 +34,7 @@ num_client_configs = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12]
experiments
=
[]
sync_period
=
200
link_rate_opt
=
'--LinkRate=100Gb/s '
# don't forget space at the end
link_rate_opt
=
'--LinkRate=100Gb/s '
# don't forget space at the end
link_latency_opt
=
'--LinkLatency=500ns '
for
proto_config
in
proto_configs
:
...
...
@@ -41,7 +42,10 @@ for proto_config in proto_configs:
for
host_config
in
host_configs
:
for
seq_config
in
seq_configs
:
for
nic_config
in
nic_configs
:
e
=
exp
.
Experiment
(
proto_config
+
'-'
+
host_config
+
'-'
+
nic_config
+
'-'
+
seq_config
+
f
'-
{
num_c
}
'
)
e
=
exp
.
Experiment
(
proto_config
+
'-'
+
host_config
+
'-'
+
nic_config
+
'-'
+
seq_config
+
f
'-
{
num_c
}
'
)
if
seq_config
==
'tofino'
:
net
=
sim
.
TofinoNet
()
else
:
...
...
@@ -58,10 +62,12 @@ for proto_config in proto_configs:
host_class
=
sim
.
Gem5Host
e
.
checkpoint
=
True
elif
host_config
==
'qt'
:
def
qemu_timing
():
h
=
sim
.
QemuHost
()
h
.
sync
=
True
return
h
host_class
=
qemu_timing
else
:
raise
NameError
(
host_config
)
...
...
@@ -79,7 +85,6 @@ for proto_config in proto_configs:
else
:
raise
NameError
(
nic_config
)
# app
if
proto_config
==
'vr'
:
replica_class
=
node
.
VRReplica
...
...
@@ -92,25 +97,53 @@ for proto_config in proto_configs:
# endhost sequencer
if
seq_config
==
'ehseq'
and
proto_config
==
'nopaxos'
:
sequencer
=
create_basic_hosts
(
e
,
1
,
'sequencer'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NOPaxosSequencer
,
ip_start
=
100
)
sequencer
=
create_basic_hosts
(
e
,
1
,
'sequencer'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
NOPaxosSequencer
,
ip_start
=
100
)
sequencer
[
0
].
node_config
.
disk_image
=
'nopaxos'
sequencer
[
0
].
pcidevs
[
0
].
sync_period
=
sync_period
sequencer
[
0
].
sync_period
=
sync_period
replicas
=
create_basic_hosts
(
e
,
3
,
'replica'
,
net
,
nic_class
,
host_class
,
nc_class
,
replica_class
)
replicas
=
create_basic_hosts
(
e
,
3
,
'replica'
,
net
,
nic_class
,
host_class
,
nc_class
,
replica_class
)
for
i
in
range
(
len
(
replicas
)):
replicas
[
i
].
node_config
.
app
.
index
=
i
replicas
[
i
].
node_config
.
disk_image
=
'nopaxos'
replicas
[
i
].
pcidevs
[
0
].
sync_period
=
sync_period
replicas
[
i
].
sync_period
=
sync_period
clients
=
create_basic_hosts
(
e
,
num_c
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
client_class
,
ip_start
=
4
)
clients
=
create_basic_hosts
(
e
,
num_c
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
client_class
,
ip_start
=
4
)
for
c
in
clients
:
c
.
node_config
.
app
.
server_ips
=
[
'10.0.0.1'
,
'10.0.0.2'
,
'10.0.0.3'
]
c
.
node_config
.
app
.
server_ips
=
[
'10.0.0.1'
,
'10.0.0.2'
,
'10.0.0.3'
]
if
seq_config
==
'ehseq'
:
c
.
node_config
.
app
.
server_ips
.
append
(
'10.0.0.100'
)
c
.
node_config
.
app
.
use_ehseq
=
True
...
...
@@ -124,4 +157,3 @@ for proto_config in proto_configs:
#print(e.name)
experiments
.
append
(
e
)
experiments/pyexps/pci_validation.py
View file @
7549fa9e
...
...
@@ -23,12 +23,12 @@
e1000 NIC, and then with the extracted gem5 e1000 NIC connected through
SimBricks."""
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
experiments
=
[]
import
simbricks.
experiments
as
exp
experiments
=
[]
for
internal
in
[
True
,
False
]:
if
internal
:
...
...
@@ -66,8 +66,10 @@ for internal in [True, False]:
for
h
in
[
client
,
server
]:
h
.
cpu_type
=
h
.
cpu_type_cp
=
'TimingSimpleCPU'
h
.
variant
=
'opt'
# need opt gem5 variant with debug support
h
.
extra_main_args
.
append
(
'--debug-flags=SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc'
)
h
.
variant
=
'opt'
# need opt gem5 variant with debug support
h
.
extra_main_args
.
append
(
'--debug-flags=SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc'
)
if
internal
:
h
.
add_netdirect
(
net
)
else
:
...
...
experiments/pyexps/qemu_e1000_pair.py
View file @
7549fa9e
...
...
@@ -20,25 +20,41 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
e
=
exp
.
Experiment
(
'qemu-e1000-pair'
)
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
E1000NIC
,
sim
.
QemuHost
,
node
.
E1000LinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
E1000NIC
,
sim
.
QemuHost
,
node
.
E1000LinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
E1000NIC
,
sim
.
QemuHost
,
node
.
E1000LinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
E1000NIC
,
sim
.
QemuHost
,
node
.
E1000LinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
experiments
=
[
e
]
experiments/pyexps/qemu_i40e_pair.py
View file @
7549fa9e
...
...
@@ -20,25 +20,41 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
e
=
exp
.
Experiment
(
'qemu-i40e-pair'
)
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
2
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
2
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
experiments
=
[
e
]
experiments/pyexps/qemu_tcp_multi.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
# iperf TCP_multi_client test
# naming convention following host-nic-net-app
...
...
@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPm
kinds_of_host
=
[
'qemu'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_net
=
[
'switch'
,
'dumbbell'
,
'bridge'
]
kinds_of_app
=
[
'TCPm'
]
num_client
=
4
...
...
@@ -51,39 +51,84 @@ for n in kinds_of_net:
if
n
==
'bridge'
:
net_class
=
sim
.
NS3BridgeNet
# set nic sim
for
c
in
kinds_of_nic
:
net
=
net_class
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPm'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPm'
)
e
.
add_network
(
net
)
if
c
==
'cv'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
if
c
==
'cb'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
if
c
==
'ib'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
for
cl
in
clients
:
cl
.
wait
=
True
cl
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
print
(
e
.
name
)
experiments
.
append
(
e
)
experiments/pyexps/qemu_tcp_single.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
# iperf TCP_single test
# naming convention following host-nic-net-app
...
...
@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPs
kinds_of_host
=
[
'qemu'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_net
=
[
'wire'
,
'switch'
,
'dumbbell'
,
'bridge'
,
'tofino'
]
kinds_of_app
=
[
'TCPs'
]
...
...
@@ -53,37 +53,83 @@ for n in kinds_of_net:
if
n
==
'tofino'
:
net_class
=
sim
.
TofinoNet
# set nic sim
for
c
in
kinds_of_nic
:
net
=
net_class
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPs'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'TCPs'
)
e
.
add_network
(
net
)
if
c
==
'cv'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
if
c
==
'cb'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
if
c
==
'ib'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
clients
[
0
].
wait
=
True
clients
[
0
].
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
print
(
e
.
name
)
experiments
.
append
(
e
)
experiments/pyexps/qemu_udp_multi.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
# iperf TCP_multi_client test
# naming convention following host-nic-net-app
...
...
@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPm
kinds_of_host
=
[
'qemu'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_net
=
[
'switch'
,
'dumbbell'
,
'bridge'
]
kinds_of_app
=
[
'UDPm'
]
...
...
@@ -53,35 +53,81 @@ for n in kinds_of_net:
if
n
==
'bridge'
:
net_class
=
sim
.
NS3BridgeNet
# set nic sim
for
c
in
kinds_of_nic
:
net
=
net_class
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPm'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPm'
)
e
.
add_network
(
net
)
if
c
==
'cv'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
if
c
==
'cb'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
if
c
==
'ib'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
num_client
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
for
cl
in
clients
:
cl
.
wait
=
True
cl
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
...
...
@@ -89,4 +135,3 @@ for n in kinds_of_net:
print
(
e
.
name
)
experiments
.
append
(
e
)
experiments/pyexps/qemu_udp_single.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
# iperf TCP_single test
# naming convention following host-nic-net-app
...
...
@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: UDPs
kinds_of_host
=
[
'qemu'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_nic
=
[
'cv'
,
'cb'
,
'ib'
]
kinds_of_net
=
[
'wire'
,
'switch'
,
'dumbbell'
,
'bridge'
,
'tofino'
]
kinds_of_app
=
[
'UDPs'
]
...
...
@@ -55,33 +55,80 @@ for n in kinds_of_net:
if
n
==
'tofino'
:
net_class
=
sim
.
TofinoNet
# set nic sim
for
c
in
kinds_of_nic
:
net
=
net_class
()
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPs'
)
e
=
exp
.
Experiment
(
'qemu-'
+
c
+
'-'
+
n
+
'-'
+
'UDPs'
)
e
.
add_network
(
net
)
if
c
==
'cv'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumVerilatorNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
if
c
==
'cb'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
CorundumBMNIC
,
sim
.
QemuHost
,
node
.
CorundumLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
if
c
==
'ib'
:
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
1
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfUDPClient
,
ip_start
=
2
)
clients
[
0
].
wait
=
True
clients
[
0
].
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
...
...
@@ -89,4 +136,3 @@ for n in kinds_of_net:
print
(
e
.
name
)
experiments
.
append
(
e
)
experiments/pyexps/rpc_singlecore.py
View file @
7549fa9e
...
...
@@ -20,11 +20,11 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
msg_sizes
=
[
64
,
1024
,
8092
]
stacks
=
[
'mtcp'
,
'tas'
,
'linux'
]
...
...
@@ -32,38 +32,49 @@ num_clients = 1
experiments
=
[]
for
msg_size
in
msg_sizes
:
for
stack
in
stacks
:
e
=
exp
.
Experiment
(
'qemu-ib-switch-rpc-%s-1t-1fpc-%db-0mpc'
%
(
stack
,
msg_size
))
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
if
stack
==
'tas'
:
n
=
node
.
TASNode
elif
stack
==
'mtcp'
:
n
=
node
.
MtcpNode
else
:
n
=
node
.
I40eLinuxNode
for
stack
in
stacks
:
e
=
exp
.
Experiment
(
'qemu-ib-switch-rpc-%s-1t-1fpc-%db-0mpc'
%
(
stack
,
msg_size
)
)
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
n
,
node
.
RPCServer
)
if
stack
==
'tas'
:
n
=
node
.
TASNode
elif
stack
==
'mtcp'
:
n
=
node
.
MtcpNode
else
:
n
=
node
.
I40eLinuxNode
clients
=
create_basic_hosts
(
e
,
num_clients
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
n
,
node
.
RPCClient
,
ip_start
=
2
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
n
,
node
.
RPCServer
)
for
h
in
servers
+
clients
:
h
.
node_config
.
cores
=
1
if
stack
!=
'tas'
else
3
h
.
node_config
.
fp_cores
=
1
h
.
node_config
.
app
.
threads
=
1
h
.
node_config
.
app
.
max_bytes
=
msg_size
clients
=
create_basic_hosts
(
e
,
num_clients
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
n
,
node
.
RPCClient
,
ip_start
=
2
)
if
stack
==
'linux'
:
h
.
node_config
.
disk_image
=
'tas'
for
h
in
servers
+
clients
:
h
.
node_config
.
cores
=
1
if
stack
!=
'tas'
else
3
h
.
node_config
.
fp_cores
=
1
h
.
node_config
.
app
.
threads
=
1
h
.
node_config
.
app
.
max_bytes
=
msg_size
servers
[
0
].
sleep
=
5
if
stack
==
'linux'
:
h
.
node_config
.
disk_image
=
'tas'
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
servers
[
0
].
sleep
=
5
experiments
.
append
(
e
)
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
experiments
.
append
(
e
)
experiments/pyexps/scalability.py
View file @
7549fa9e
...
...
@@ -20,11 +20,12 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.experiments
as
exp
import
simbricks.simulators
as
sim
import
simbricks.nodeconfig
as
node
import
simbricks.simulators
as
sim
from
simbricks.simulator_utils
import
create_basic_hosts
import
simbricks.experiments
as
exp
host_configs
=
[
'bm'
,
'cycle'
]
n_clients
=
[
1
,
2
,
4
,
8
]
target_bandwidth
=
100
...
...
@@ -50,15 +51,31 @@ for host_config in host_configs:
e
.
add_network
(
net
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
IperfUDPServer
)
servers
=
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
IperfUDPServer
)
clients
=
create_basic_hosts
(
e
,
nc
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
IperfUDPClient
)
clients
=
create_basic_hosts
(
e
,
nc
,
'client'
,
net
,
nic_class
,
host_class
,
nc_class
,
node
.
IperfUDPClient
)
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
c
.
node_config
.
app
.
rate
=
str
(
target_bandwidth
/
nc
)
+
'm'
c
.
node_config
.
app
.
rate
=
str
(
target_bandwidth
/
nc
)
+
'm'
experiments
.
append
(
e
)
experiments/run.py
View file @
7549fa9e
...
...
@@ -21,95 +21,199 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
argparse
import
sys
import
os
import
fnmatch
import
importlib
import
importlib.util
import
json
import
os
import
pickle
import
fnmatch
import
sys
import
typing
as
tp
import
simbricks.exectools
as
exectools
from
simbricks.runtime.common
import
*
from
simbricks.runtime.distributed
import
*
from
simbricks.runtime.local
import
*
from
simbricks.runtime.slurm
import
*
import
simbricks.exectools
as
exectools
import
simbricks.experiments
as
exp
def
mkdir_if_not_exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
os
.
mkdir
(
path
)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'experiments'
,
metavar
=
'EXP'
,
type
=
str
,
nargs
=
'+'
,
help
=
'An experiment file to run'
)
parser
.
add_argument
(
'--list'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Only list available experiment names'
)
parser
.
add_argument
(
'--filter'
,
metavar
=
'PATTERN'
,
type
=
str
,
nargs
=
'+'
,
help
=
'Pattern to match experiment names against'
)
parser
.
add_argument
(
'--pickled'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Read exp files as pickled runs instead of exp.py files'
)
parser
.
add_argument
(
'--runs'
,
metavar
=
'N'
,
type
=
int
,
default
=
1
,
help
=
'Number of repetition for each experiment'
)
parser
.
add_argument
(
'--firstrun'
,
metavar
=
'N'
,
type
=
int
,
default
=
1
,
help
=
'ID for first run'
)
parser
.
add_argument
(
'--force'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Run experiments even if output already exists'
)
parser
.
add_argument
(
'--verbose'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Verbose output'
)
parser
.
add_argument
(
'--pcap'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Dump pcap file (if supported by simulator)'
)
parser
.
add_argument
(
'experiments'
,
metavar
=
'EXP'
,
type
=
str
,
nargs
=
'+'
,
help
=
'An experiment file to run'
)
parser
.
add_argument
(
'--list'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Only list available experiment names'
)
parser
.
add_argument
(
'--filter'
,
metavar
=
'PATTERN'
,
type
=
str
,
nargs
=
'+'
,
help
=
'Pattern to match experiment names against'
)
parser
.
add_argument
(
'--pickled'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Read exp files as pickled runs instead of exp.py files'
)
parser
.
add_argument
(
'--runs'
,
metavar
=
'N'
,
type
=
int
,
default
=
1
,
help
=
'Number of repetition for each experiment'
)
parser
.
add_argument
(
'--firstrun'
,
metavar
=
'N'
,
type
=
int
,
default
=
1
,
help
=
'ID for first run'
)
parser
.
add_argument
(
'--force'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Run experiments even if output already exists'
)
parser
.
add_argument
(
'--verbose'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Verbose output'
)
parser
.
add_argument
(
'--pcap'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Dump pcap file (if supported by simulator)'
)
g_env
=
parser
.
add_argument_group
(
'Environment'
)
g_env
.
add_argument
(
'--repo'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'..'
,
help
=
'Repo directory'
)
g_env
.
add_argument
(
'--workdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Work directory base'
)
g_env
.
add_argument
(
'--outdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Output directory base'
)
g_env
.
add_argument
(
'--cpdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Checkpoint directory base'
)
g_env
.
add_argument
(
'--hosts'
,
metavar
=
'JSON_FILE'
,
type
=
str
,
default
=
None
,
help
=
'List of hosts to use (json)'
)
g_env
.
add_argument
(
'--shmdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
None
,
help
=
'Shared memory directory base (workdir if not set)'
)
g_env
.
add_argument
(
'--repo'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'..'
,
help
=
'Repo directory'
)
g_env
.
add_argument
(
'--workdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Work directory base'
)
g_env
.
add_argument
(
'--outdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Output directory base'
)
g_env
.
add_argument
(
'--cpdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./out/'
,
help
=
'Checkpoint directory base'
)
g_env
.
add_argument
(
'--hosts'
,
metavar
=
'JSON_FILE'
,
type
=
str
,
default
=
None
,
help
=
'List of hosts to use (json)'
)
g_env
.
add_argument
(
'--shmdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
None
,
help
=
'Shared memory directory base (workdir if not set)'
)
g_par
=
parser
.
add_argument_group
(
'Parallel Runtime'
)
g_par
.
add_argument
(
'--parallel'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'parallel'
,
default
=
'sequential'
,
help
=
'Use parallel instead of sequential runtime'
)
g_par
.
add_argument
(
'--cores'
,
metavar
=
'N'
,
type
=
int
,
default
=
len
(
os
.
sched_getaffinity
(
0
)),
help
=
'Number of cores to use for parallel runs'
)
g_par
.
add_argument
(
'--mem'
,
metavar
=
'N'
,
type
=
int
,
default
=
None
,
help
=
'Memory limit for parallel runs (in MB)'
)
g_par
.
add_argument
(
'--parallel'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'parallel'
,
default
=
'sequential'
,
help
=
'Use parallel instead of sequential runtime'
)
g_par
.
add_argument
(
'--cores'
,
metavar
=
'N'
,
type
=
int
,
default
=
len
(
os
.
sched_getaffinity
(
0
)),
help
=
'Number of cores to use for parallel runs'
)
g_par
.
add_argument
(
'--mem'
,
metavar
=
'N'
,
type
=
int
,
default
=
None
,
help
=
'Memory limit for parallel runs (in MB)'
)
g_slurm
=
parser
.
add_argument_group
(
'Slurm Runtime'
)
g_slurm
.
add_argument
(
'--slurm'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'slurm'
,
default
=
'sequential'
,
help
=
'Use slurm instead of sequential runtime'
)
g_slurm
.
add_argument
(
'--slurmdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./slurm/'
,
help
=
'Slurm communication directory'
)
g_slurm
.
add_argument
(
'--slurm'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'slurm'
,
default
=
'sequential'
,
help
=
'Use slurm instead of sequential runtime'
)
g_slurm
.
add_argument
(
'--slurmdir'
,
metavar
=
'DIR'
,
type
=
str
,
default
=
'./slurm/'
,
help
=
'Slurm communication directory'
)
g_dist
=
parser
.
add_argument_group
(
'Distributed Runtime'
)
g_dist
.
add_argument
(
'--dist'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'dist'
,
default
=
'sequential'
,
help
=
'Use sequential distributed runtime instead of local'
)
g_dist
.
add_argument
(
'--auto-dist'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Automatically distribute non-distributed experiments'
)
g_dist
.
add_argument
(
'--proxy-type'
,
metavar
=
'TYPE'
,
type
=
str
,
default
=
'sockets'
,
help
=
'Proxy type to use (sockets,rdma) for auto distribution'
)
g_dist
.
add_argument
(
'--dist'
,
dest
=
'runtime'
,
action
=
'store_const'
,
const
=
'dist'
,
default
=
'sequential'
,
help
=
'Use sequential distributed runtime instead of local'
)
g_dist
.
add_argument
(
'--auto-dist'
,
action
=
'store_const'
,
const
=
True
,
default
=
False
,
help
=
'Automatically distribute non-distributed experiments'
)
g_dist
.
add_argument
(
'--proxy-type'
,
metavar
=
'TYPE'
,
type
=
str
,
default
=
'sockets'
,
help
=
'Proxy type to use (sockets,rdma) for auto distribution'
)
args
=
parser
.
parse_args
()
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
:
hosts
=
json
.
load
(
f
)
...
...
@@ -129,21 +233,27 @@ def load_executors(path):
exs
.
append
(
ex
)
return
exs
if
args
.
hosts
is
None
:
executors
=
[
exectools
.
LocalExecutor
()]
else
:
executors
=
load_executors
(
args
.
hosts
)
def
warn_multi_exec
():
if
len
(
executors
)
>
1
:
print
(
'Warning: multiple hosts specified, only using first one for now'
,
file
=
sys
.
stderr
)
print
(
'Warning: multiple hosts specified, only using first one for now'
,
file
=
sys
.
stderr
)
# initialize runtime
if
args
.
runtime
==
'parallel'
:
warn_multi_exec
()
rt
=
LocalParallelRuntime
(
cores
=
args
.
cores
,
mem
=
args
.
mem
,
verbose
=
args
.
verbose
,
exec
=
executors
[
0
])
rt
=
LocalParallelRuntime
(
cores
=
args
.
cores
,
mem
=
args
.
mem
,
verbose
=
args
.
verbose
,
exec
=
executors
[
0
]
)
elif
args
.
runtime
==
'slurm'
:
rt
=
SlurmRuntime
(
args
.
slurmdir
,
args
,
verbose
=
args
.
verbose
)
elif
args
.
runtime
==
'dist'
:
...
...
@@ -154,8 +264,12 @@ else:
def
add_exp
(
e
:
exp
.
Experiment
,
run
:
int
,
prereq
:
tp
.
Optional
[
Run
],
create_cp
:
bool
,
restore_cp
:
bool
,
no_simbricks
:
bool
e
:
exp
.
Experiment
,
run
:
int
,
prereq
:
tp
.
Optional
[
Run
],
create_cp
:
bool
,
restore_cp
:
bool
,
no_simbricks
:
bool
):
outpath
=
'%s/%s-%d.json'
%
(
args
.
outdir
,
e
.
name
,
run
)
if
os
.
path
.
exists
(
outpath
)
and
not
args
.
force
:
...
...
@@ -170,10 +284,10 @@ def add_exp(
env
=
exp
.
ExpEnv
(
args
.
repo
,
workdir
,
cpdir
)
env
.
create_cp
=
create_cp
env
.
restore_cp
=
restore_cp
env
.
no_simbricks
=
no_simbricks
env
.
no_simbricks
=
no_simbricks
env
.
pcap_file
=
''
if
args
.
pcap
:
env
.
pcap_file
=
workdir
+
'/pcap'
env
.
pcap_file
=
workdir
+
'/pcap'
if
args
.
shmdir
is
not
None
:
env
.
shm_base
=
os
.
path
.
abspath
(
shmdir
)
...
...
@@ -181,6 +295,7 @@ def add_exp(
rt
.
add_run
(
run
)
return
run
# load experiments
if
not
args
.
pickled
:
# default: load python modules with experiments
...
...
@@ -213,9 +328,9 @@ if not args.pickled:
# if this is an experiment with a checkpoint we might have to create it
if
e
.
no_simbricks
:
no_simbricks
=
True
no_simbricks
=
True
else
:
no_simbricks
=
False
no_simbricks
=
False
if
e
.
checkpoint
:
prereq
=
add_exp
(
e
,
0
,
None
,
True
,
False
,
no_simbricks
)
else
:
...
...
experiments/simbricks/exectools.py
View file @
7549fa9e
...
...
@@ -21,15 +21,17 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
asyncio
from
asyncio.subprocess
import
Process
import
os
import
pathlib
import
re
import
shlex
import
shutil
import
signal
from
asyncio.subprocess
import
Process
class
HostConfig
(
object
):
def
__init__
(
self
,
name
,
ip
,
mac
,
sudopwd
,
other
=
{}):
self
.
name
=
name
self
.
ip
=
ip
...
...
@@ -38,6 +40,7 @@ class HostConfig(object):
self
.
sudo_pwd
=
sudopwd
self
.
other
=
other
.
copy
()
class
Component
(
object
):
proc
:
Process
terminate_future
:
asyncio
.
Task
[
int
]
...
...
@@ -92,9 +95,12 @@ class Component(object):
return
async
def
_waiter
(
self
):
out_handlers
=
asyncio
.
ensure_future
(
asyncio
.
wait
([
self
.
_read_stream
(
self
.
proc
.
stdout
,
self
.
_consume_out
),
self
.
_read_stream
(
self
.
proc
.
stderr
,
self
.
_consume_err
)]))
out_handlers
=
asyncio
.
ensure_future
(
asyncio
.
wait
([
self
.
_read_stream
(
self
.
proc
.
stdout
,
self
.
_consume_out
),
self
.
_read_stream
(
self
.
proc
.
stderr
,
self
.
_consume_err
)
])
)
rc
=
await
self
.
proc
.
wait
()
await
out_handlers
await
self
.
terminated
(
rc
)
...
...
@@ -111,11 +117,12 @@ class Component(object):
else
:
stdin
=
None
self
.
proc
=
await
asyncio
.
create_subprocess_exec
(
*
self
.
cmd_parts
,
stdout
=
asyncio
.
subprocess
.
PIPE
,
stderr
=
asyncio
.
subprocess
.
PIPE
,
stdin
=
stdin
,
)
self
.
proc
=
await
asyncio
.
create_subprocess_exec
(
*
self
.
cmd_parts
,
stdout
=
asyncio
.
subprocess
.
PIPE
,
stderr
=
asyncio
.
subprocess
.
PIPE
,
stdin
=
stdin
,
)
self
.
terminate_future
=
asyncio
.
ensure_future
(
self
.
_waiter
())
await
self
.
started
()
...
...
@@ -137,7 +144,7 @@ class Component(object):
async
def
int_term_kill
(
self
,
delay
=
5
):
await
self
.
interrupt
()
_
,
pending
=
await
asyncio
.
wait
([
self
.
terminate_future
],
timeout
=
delay
)
_
,
pending
=
await
asyncio
.
wait
([
self
.
terminate_future
],
timeout
=
delay
)
if
len
(
pending
)
!=
0
:
print
(
'terminating'
)
await
self
.
terminate
()
...
...
@@ -161,8 +168,10 @@ class Component(object):
class
SimpleComponent
(
Component
):
def
__init__
(
self
,
label
,
cmd_parts
,
verbose
=
True
,
canfail
=
False
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
label
,
cmd_parts
,
verbose
=
True
,
canfail
=
False
,
*
args
,
**
kwargs
):
self
.
label
=
label
self
.
verbose
=
verbose
self
.
canfail
=
canfail
...
...
@@ -185,10 +194,20 @@ class SimpleComponent(Component):
if
not
self
.
canfail
and
rc
!=
0
:
raise
Exception
(
'Command Failed: '
+
str
(
self
.
cmd_parts
))
class
SimpleRemoteComponent
(
SimpleComponent
):
pid_fut
:
asyncio
.
Future
def
__init__
(
self
,
host_name
,
label
,
cmd_parts
,
cwd
=
None
,
ssh_extra_args
=
[],
*
args
,
**
kwargs
):
def
__init__
(
self
,
host_name
,
label
,
cmd_parts
,
cwd
=
None
,
ssh_extra_args
=
[],
*
args
,
**
kwargs
):
self
.
host_name
=
host_name
self
.
extra_flags
=
ssh_extra_args
# add a wrapper to print the PID
...
...
@@ -209,25 +228,23 @@ class SimpleRemoteComponent(SimpleComponent):
super
().
__init__
(
label
,
parts
,
*
args
,
**
kwargs
)
def
_ssh_cmd
(
self
,
parts
):
"""
SSH invocation of command for this host.
"""
"""SSH invocation of command for this host."""
return
[
'ssh'
,
'-o'
,
'UserKnownHostsFile=/dev/null'
,
'-o'
,
'StrictHostKeyChecking=no'
]
+
self
.
extra_flags
+
[
self
.
host_name
,
'--'
]
+
parts
]
+
self
.
extra_flags
+
[
self
.
host_name
,
'--'
]
+
parts
async
def
start
(
self
):
"""
Start this command (includes waiting for its pid.
"""
"""Start this command (includes waiting for its pid."""
self
.
pid_fut
=
asyncio
.
get_running_loop
().
create_future
()
await
super
().
start
()
await
self
.
pid_fut
async
def
process_out
(
self
,
lines
,
eof
):
"""
Scans output and set PID future once PID line found.
"""
"""Scans output and set PID future once PID line found."""
if
not
self
.
pid_fut
.
done
():
newlines
=
[]
pid_re
=
re
.
compile
(
r
'^PID\s+(\d+)\s*$'
)
...
...
@@ -247,9 +264,10 @@ class SimpleRemoteComponent(SimpleComponent):
await
super
().
process_out
(
lines
,
eof
)
async
def
_kill_cmd
(
self
,
sig
):
""" Send signal to command by running ssh kill -$sig $PID. """
cmd_parts
=
self
.
_ssh_cmd
([
'kill'
,
'-'
+
sig
,
str
(
self
.
pid_fut
.
result
())])
"""Send signal to command by running ssh kill -$sig $PID."""
cmd_parts
=
self
.
_ssh_cmd
([
'kill'
,
'-'
+
sig
,
str
(
self
.
pid_fut
.
result
())
])
proc
=
await
asyncio
.
create_subprocess_exec
(
*
cmd_parts
)
await
proc
.
wait
()
...
...
@@ -262,30 +280,32 @@ class SimpleRemoteComponent(SimpleComponent):
async
def
kill
(
self
):
await
self
.
_kill_cmd
(
'KILL'
)
class
Executor
(
object
):
ip
=
None
def
create_component
(
self
,
label
,
parts
,
**
kwargs
)
->
SimpleComponent
:
raise
NotImplementedError
(
"
Please Implement this method
"
)
raise
NotImplementedError
(
'
Please Implement this method
'
)
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
):
raise
NotImplementedError
(
"
Please Implement this method
"
)
raise
NotImplementedError
(
'
Please Implement this method
'
)
async
def
send_file
(
self
,
path
,
verbose
=
False
):
raise
NotImplementedError
(
"
Please Implement this method
"
)
raise
NotImplementedError
(
'
Please Implement this method
'
)
async
def
mkdir
(
self
,
path
,
verbose
=
False
):
raise
NotImplementedError
(
"
Please Implement this method
"
)
raise
NotImplementedError
(
'
Please Implement this method
'
)
async
def
rmtree
(
self
,
path
,
verbose
=
False
):
raise
NotImplementedError
(
"
Please Implement this method
"
)
raise
NotImplementedError
(
'
Please Implement this method
'
)
# runs the list of commands as strings sequentially
async
def
run_cmdlist
(
self
,
label
,
cmds
,
verbose
=
True
,
host
=
None
):
i
=
0
for
cmd
in
cmds
:
cmdC
=
self
.
create_component
(
label
+
'.'
+
str
(
i
),
shlex
.
split
(
cmd
),
verbose
=
verbose
)
cmdC
=
self
.
create_component
(
label
+
'.'
+
str
(
i
),
shlex
.
split
(
cmd
),
verbose
=
verbose
)
await
cmdC
.
start
()
await
cmdC
.
wait
()
...
...
@@ -295,7 +315,9 @@ class Executor(object):
xs
.
append
(
self
.
await_file
(
p
,
*
args
,
**
kwargs
))
await
asyncio
.
wait
(
xs
)
class
LocalExecutor
(
Executor
):
def
create_component
(
self
,
label
,
parts
,
**
kwargs
):
return
SimpleComponent
(
label
,
parts
,
**
kwargs
)
...
...
@@ -322,7 +344,9 @@ class LocalExecutor(Executor):
elif
os
.
path
.
exists
(
path
):
os
.
unlink
(
path
)
class
RemoteExecutor
(
Executor
):
def
__init__
(
self
,
host_name
,
workdir
):
self
.
host_name
=
host_name
self
.
cwd
=
workdir
...
...
@@ -330,21 +354,33 @@ class RemoteExecutor(Executor):
self
.
scp_extra_args
=
[]
def
create_component
(
self
,
label
,
parts
,
**
kwargs
):
return
SimpleRemoteComponent
(
self
.
host_name
,
label
,
parts
,
cwd
=
self
.
cwd
,
ssh_extra_args
=
self
.
ssh_extra_args
,
**
kwargs
)
return
SimpleRemoteComponent
(
self
.
host_name
,
label
,
parts
,
cwd
=
self
.
cwd
,
ssh_extra_args
=
self
.
ssh_extra_args
,
**
kwargs
)
async
def
await_file
(
self
,
path
,
delay
=
0.05
,
verbose
=
False
,
timeout
=
30
):
if
verbose
:
print
(
'%s.await_file(%s) started'
%
(
self
.
host_name
,
path
))
to_its
=
timeout
/
delay
loop_cmd
=
(
'i=0 ; while [ ! -e %s ] ; do '
'if [ $i -ge %u ] ; then exit 1 ; fi ; '
'sleep %f ; '
'i=$(($i+1)) ; done; exit 0'
)
%
(
path
,
to_its
,
delay
)
loop_cmd
=
(
'i=0 ; while [ ! -e %s ] ; do '
'if [ $i -ge %u ] ; then exit 1 ; fi ; '
'sleep %f ; '
'i=$(($i+1)) ; done; exit 0'
)
%
(
path
,
to_its
,
delay
)
parts
=
[
'/bin/sh'
,
'-c'
,
loop_cmd
]
sc
=
self
.
create_component
(
"%s.await_file('%s')"
%
(
self
.
host_name
,
path
),
parts
,
canfail
=
False
,
verbose
=
verbose
)
sc
=
self
.
create_component
(
"%s.await_file('%s')"
%
(
self
.
host_name
,
path
),
parts
,
canfail
=
False
,
verbose
=
verbose
)
await
sc
.
start
()
await
sc
.
wait
()
...
...
@@ -357,22 +393,30 @@ class RemoteExecutor(Executor):
'UserKnownHostsFile=/dev/null'
,
'-o'
,
'StrictHostKeyChecking=no'
]
+
self
.
scp_extra_args
+
[
path
,
'%s:%s'
%
(
self
.
host_name
,
path
)]
sc
=
SimpleComponent
(
"%s.send_file('%s')"
%
(
self
.
host_name
,
path
),
parts
,
canfail
=
False
,
verbose
=
verbose
)
]
+
self
.
scp_extra_args
+
[
path
,
'%s:%s'
%
(
self
.
host_name
,
path
)]
sc
=
SimpleComponent
(
"%s.send_file('%s')"
%
(
self
.
host_name
,
path
),
parts
,
canfail
=
False
,
verbose
=
verbose
)
await
sc
.
start
()
await
sc
.
wait
()
async
def
mkdir
(
self
,
path
,
verbose
=
False
):
sc
=
self
.
create_component
(
"%s.mkdir('%s')"
%
(
self
.
host_name
,
path
),
[
'mkdir'
,
'-p'
,
path
],
canfail
=
False
,
verbose
=
verbose
)
sc
=
self
.
create_component
(
"%s.mkdir('%s')"
%
(
self
.
host_name
,
path
),
[
'mkdir'
,
'-p'
,
path
],
canfail
=
False
,
verbose
=
verbose
)
await
sc
.
start
()
await
sc
.
wait
()
async
def
rmtree
(
self
,
path
,
verbose
=
False
):
sc
=
self
.
create_component
(
"%s.rmtree('%s')"
%
(
self
.
host_name
,
path
),
[
'rm'
,
'-rf'
,
path
],
canfail
=
False
,
verbose
=
verbose
)
sc
=
self
.
create_component
(
"%s.rmtree('%s')"
%
(
self
.
host_name
,
path
),
[
'rm'
,
'-rf'
,
path
],
canfail
=
False
,
verbose
=
verbose
)
await
sc
.
start
()
await
sc
.
wait
()
experiments/simbricks/experiment/experiment_output.py
View file @
7549fa9e
...
...
@@ -20,7 +20,6 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
json
import
time
...
...
@@ -59,4 +58,4 @@ class ExpOutput(object):
def
loads
(
self
,
json_s
):
for
k
,
v
in
json
.
loads
(
json_s
).
items
():
self
.
__dict__
[
k
]
=
v
\ No newline at end of file
self
.
__dict__
[
k
]
=
v
experiments/simbricks/experiments.py
View file @
7549fa9e
...
...
@@ -21,21 +21,28 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
asyncio
import
shlex
import
itertools
import
shlex
import
traceback
import
typing
as
tp
import
simbricks.utils.graphlib
as
graphlib
from
simbricks.exectools
import
Executor
,
SimpleComponent
from
simbricks.experiment.experiment_environment
import
ExpEnv
from
simbricks.experiment.experiment_output
import
ExpOutput
from
simbricks.exectools
import
Executor
,
SimpleComponent
from
simbricks.proxy
import
NetProxyConnecter
,
NetProxyListener
,
SimProxy
from
simbricks.simulators
import
HostSim
,
I40eMultiNIC
,
NICSim
,
NetSim
,
PCIDevSim
,
Simulator
import
simbricks.utils.graphlib
as
graphlib
from
simbricks.simulators
import
(
HostSim
,
I40eMultiNIC
,
NetSim
,
NICSim
,
PCIDevSim
,
Simulator
)
class
Experiment
(
object
):
"""Describes a simulation experiment. Holds information about the simulators
to run and paramaters to configure the experiment."""
"""
Describes a simulation experiment.
Holds information about the simulators to run and paramaters to configure
the experiment.
"""
name
:
str
"""This experiment's name. Can be used to filter multiple experiments to be
run."""
...
...
@@ -43,7 +50,7 @@ class Experiment(object):
"""Timeout for experiment in seconds."""
checkpoint
=
False
"""Whether to use checkpoints in experiment.
Can for example be used to speed up booting a host simulator by first
running in a less accurate mode. Before we then start the application we are
interested in, a checkpoint is taken and the simulator shut down. Then, the
...
...
@@ -80,7 +87,7 @@ class Experiment(object):
self
.
networks
.
append
(
sim
)
def
all_simulators
(
self
):
"""
All simulators used in experiment.
"""
"""All simulators used in experiment."""
return
itertools
.
chain
(
self
.
hosts
,
self
.
pcidevs
,
self
.
networks
)
def
resreq_mem
(
self
):
...
...
@@ -98,8 +105,9 @@ class Experiment(object):
cores
+=
s
.
resreq_cores
()
return
cores
class
DistributedExperiment
(
Experiment
):
"""Describes a distributed simulation experiment.
"""
"""Describes a distributed simulation experiment."""
num_hosts
=
1
"""Number of hosts to use."""
host_mapping
:
tp
.
Dict
[
Simulator
,
int
]
...
...
@@ -121,17 +129,17 @@ class DistributedExperiment(Experiment):
self
.
proxies_connect
.
append
(
proxy
)
def
all_simulators
(
self
):
return
itertools
.
chain
(
super
().
all_simulators
(),
self
.
proxies_listen
,
self
.
proxies_connect
)
return
itertools
.
chain
(
super
().
all_simulators
(),
self
.
proxies_listen
,
self
.
proxies_connect
)
def
assign_sim_host
(
self
,
sim
:
Simulator
,
host
:
int
):
"""
Assign host ID (< self.num_hosts) for a simulator.
"""
assert
(
host
>=
0
and
host
<
self
.
num_hosts
)
"""Assign host ID (< self.num_hosts) for a simulator."""
assert
(
host
>=
0
and
host
<
self
.
num_hosts
)
self
.
host_mapping
[
sim
]
=
host
def
all_sims_assigned
(
self
):
"""
Check if all simulators are assigned to a host.
"""
"""Check if all simulators are assigned to a host."""
for
s
in
self
.
all_simulators
():
if
s
not
in
self
.
host_mapping
:
return
False
...
...
@@ -140,7 +148,9 @@ class DistributedExperiment(Experiment):
T
=
tp
.
TypeVar
(
'T'
,
bound
=
Experiment
)
class
ExperimentBaseRunner
(
tp
.
Generic
[
T
]):
def
__init__
(
self
,
exp
:
T
,
env
:
ExpEnv
,
verbose
:
bool
):
self
.
exp
=
exp
self
.
env
=
env
...
...
@@ -151,7 +161,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
self
.
wait_sims
=
[]
def
sim_executor
(
self
,
sim
:
Simulator
)
->
Executor
:
raise
NotImplementedError
(
"
Please implement this method
"
)
raise
NotImplementedError
(
'
Please implement this method
'
)
def
sim_graph
(
self
):
sims
=
self
.
exp
.
all_simulators
()
...
...
@@ -164,7 +174,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
return
graph
async
def
start_sim
(
self
,
sim
:
Simulator
):
"""
Start a simulator and wait for it to be ready.
"""
"""Start a simulator and wait for it to be ready."""
name
=
sim
.
full_name
()
if
self
.
verbose
:
...
...
@@ -178,9 +188,9 @@ class ExperimentBaseRunner(tp.Generic[T]):
# run simulator
exec
=
self
.
sim_executor
(
sim
)
sc
=
exec
.
create_component
(
name
,
shlex
.
split
(
run_cmd
),
verbose
=
self
.
verbose
,
canfail
=
True
)
sc
=
exec
.
create_component
(
name
,
shlex
.
split
(
run_cmd
),
verbose
=
self
.
verbose
,
canfail
=
True
)
await
sc
.
start
()
self
.
running
.
append
((
sim
,
sc
))
...
...
@@ -216,7 +226,6 @@ class ExperimentBaseRunner(tp.Generic[T]):
async
def
after_cleanup
(
self
):
pass
async
def
prepare
(
self
):
# generate config tars
copies
=
[]
...
...
@@ -233,12 +242,15 @@ class ExperimentBaseRunner(tp.Generic[T]):
for
sim
in
self
.
exp
.
all_simulators
():
prep_cmds
=
[
pc
for
pc
in
sim
.
prep_cmds
(
self
.
env
)]
exec
=
self
.
sim_executor
(
sim
)
sims
.
append
(
exec
.
run_cmdlist
(
'prepare_'
+
self
.
exp
.
name
,
prep_cmds
,
verbose
=
self
.
verbose
))
sims
.
append
(
exec
.
run_cmdlist
(
'prepare_'
+
self
.
exp
.
name
,
prep_cmds
,
verbose
=
self
.
verbose
)
)
await
asyncio
.
wait
(
sims
)
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
:
print
(
'%s: waiting for hosts to terminate'
%
self
.
exp
.
name
)
for
sc
in
self
.
wait_sims
:
...
...
@@ -282,24 +294,23 @@ class ExperimentBaseRunner(tp.Generic[T]):
# "interrupt, terminate, kill" all processes
scs
=
[]
for
_
,
sc
in
self
.
running
:
for
_
,
sc
in
self
.
running
:
scs
.
append
(
sc
.
int_term_kill
())
await
asyncio
.
wait
(
scs
)
# wait for all processes to terminate
for
_
,
sc
in
self
.
running
:
for
_
,
sc
in
self
.
running
:
await
sc
.
wait
()
# remove all sockets
scs
=
[]
for
(
exec
,
sock
)
in
self
.
sockets
:
for
(
exec
,
sock
)
in
self
.
sockets
:
scs
.
append
(
exec
.
rmtree
(
sock
))
if
len
(
scs
):
await
asyncio
.
wait
(
scs
)
# add all simulator components to the output
for
sim
,
sc
in
self
.
running
:
for
sim
,
sc
in
self
.
running
:
self
.
out
.
add_sim
(
sim
,
sc
)
await
self
.
after_cleanup
()
...
...
@@ -307,7 +318,8 @@ class ExperimentBaseRunner(tp.Generic[T]):
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
):
self
.
exec
=
exec
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -317,7 +329,8 @@ class ExperimentSimpleRunner(ExperimentBaseRunner[Experiment]):
class
ExperimentDistributedRunner
(
ExperimentBaseRunner
[
DistributedExperiment
]):
""" Simple experiment runner with just one executor. """
"""Simple experiment runner with just one executor."""
def
__init__
(
self
,
execs
,
*
args
,
**
kwargs
):
self
.
execs
=
execs
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -329,11 +342,12 @@ class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]):
async
def
prepare
(
self
):
# 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
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
)
p
.
ip
=
exec
.
ip
...
...
experiments/simbricks/nodeconfig.py
View file @
7549fa9e
...
...
@@ -20,8 +20,8 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
tarfile
import
io
import
tarfile
class
AppConfig
(
object
):
...
...
@@ -145,19 +145,26 @@ class LinuxNode(NodeConfig):
else
:
l
.
append
(
'modprobe '
+
d
)
if
self
.
force_mac_addr
:
l
.
append
(
'ip link set dev '
+
self
.
ifname
+
' address '
+
self
.
force_mac_addr
)
l
.
append
(
'ip link set dev '
+
self
.
ifname
+
' address '
+
self
.
force_mac_addr
)
l
.
append
(
'ip link set dev '
+
self
.
ifname
+
' up'
)
l
.
append
(
'ip addr add %s/%d dev %s'
%
(
self
.
ip
,
self
.
prefix
,
self
.
ifname
))
l
.
append
(
'ip addr add %s/%d dev %s'
%
(
self
.
ip
,
self
.
prefix
,
self
.
ifname
)
)
return
super
().
prepare_post_cp
()
+
l
class
I40eLinuxNode
(
LinuxNode
):
def
__init__
(
self
):
super
().
__init__
()
self
.
drivers
.
append
(
'i40e'
)
class
CorundumLinuxNode
(
LinuxNode
):
def
__init__
(
self
):
super
().
__init__
()
self
.
drivers
.
append
(
'/tmp/guest/mqnic.ko'
)
...
...
@@ -166,7 +173,9 @@ class CorundumLinuxNode(LinuxNode):
m
=
{
'mqnic.ko'
:
open
(
'../images/mqnic/mqnic.ko'
,
'rb'
)}
return
{
**
m
,
**
super
().
config_files
()}
class
E1000LinuxNode
(
LinuxNode
):
def
__init__
(
self
):
super
().
__init__
()
self
.
drivers
.
append
(
'e1000'
)
...
...
@@ -194,7 +203,7 @@ class MtcpNode(NodeConfig):
return
super
().
prepare_post_cp
()
+
[
'insmod /root/mtcp/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko'
,
'/root/mtcp/dpdk/usertools/dpdk-devbind.py -b igb_uio '
+
self
.
pci_dev
,
self
.
pci_dev
,
'insmod /root/mtcp/dpdk-iface-kmod/dpdk_iface.ko'
,
'/root/mtcp/dpdk-iface-kmod/dpdk_iface_main'
,
'ip link set dev dpdk0 up'
,
...
...
@@ -202,20 +211,26 @@ class MtcpNode(NodeConfig):
]
def
config_files
(
self
):
m
=
{
'mtcp.conf'
:
self
.
strfile
(
"io = dpdk
\n
"
"num_cores = "
+
str
(
self
.
cores
)
+
"
\n
"
"num_mem_ch = 4
\n
"
"port = dpdk0
\n
"
"max_concurrency = 4096
\n
"
"max_num_buffers = 4096
\n
"
"rcvbuf = 8192
\n
"
"sndbuf = 8192
\n
"
"tcp_timeout = 10
\n
"
"tcp_timewait = 0
\n
"
"#stat_print = dpdk0
\n
"
)}
m
=
{
'mtcp.conf'
:
self
.
strfile
(
'io = dpdk
\n
'
'num_cores = '
+
str
(
self
.
cores
)
+
'
\n
'
'num_mem_ch = 4
\n
'
'port = dpdk0
\n
'
'max_concurrency = 4096
\n
'
'max_num_buffers = 4096
\n
'
'rcvbuf = 8192
\n
'
'sndbuf = 8192
\n
'
'tcp_timeout = 10
\n
'
'tcp_timewait = 0
\n
'
'#stat_print = dpdk0
\n
'
)
}
return
{
**
m
,
**
super
().
config_files
()}
class
TASNode
(
NodeConfig
):
disk_image
=
'tas'
pci_dev
=
'0000:00:02.0'
...
...
@@ -241,18 +256,18 @@ class TASNode(NodeConfig):
'insmod /root/dpdk/lib/modules/5.4.46/extra/dpdk/igb_uio.ko'
,
'/root/dpdk/sbin/dpdk-devbind -b igb_uio '
+
self
.
pci_dev
,
'cd /root/tas'
,
'tas/tas --ip-addr=%s/%d --fp-cores-max=%d --fp-no-ints &'
%
(
self
.
ip
,
self
.
prefix
,
self
.
fp_cores
),
'tas/tas --ip-addr=%s/%d --fp-cores-max=%d --fp-no-ints &'
%
(
self
.
ip
,
self
.
prefix
,
self
.
fp_cores
),
'sleep 1'
]
if
self
.
preload
:
cmds
+=
[
'export LD_PRELOAD=/root/tas/lib/libtas_interpose.so'
]
cmds
+=
[
'export LD_PRELOAD=/root/tas/lib/libtas_interpose.so'
]
return
cmds
class
I40eDCTCPNode
(
NodeConfig
):
def
prepare_pre_cp
(
self
):
return
super
().
prepare_pre_cp
()
+
[
'mount -t proc proc /proc'
,
...
...
@@ -269,7 +284,6 @@ class I40eDCTCPNode(NodeConfig):
'sysctl -w net.ipv4.tcp_ecn=1'
]
def
prepare_post_cp
(
self
):
return
super
().
prepare_post_cp
()
+
[
'modprobe i40e'
,
...
...
@@ -280,7 +294,9 @@ class I40eDCTCPNode(NodeConfig):
f
'ip addr add
{
self
.
ip
}
/
{
self
.
prefix
}
dev eth0'
,
]
class
CorundumDCTCPNode
(
NodeConfig
):
def
prepare_pre_cp
(
self
):
return
super
().
prepare_pre_cp
()
+
[
'mount -t proc proc /proc'
,
...
...
@@ -297,7 +313,6 @@ class CorundumDCTCPNode(NodeConfig):
'sysctl -w net.ipv4.tcp_ecn=1'
]
def
prepare_post_cp
(
self
):
return
super
().
prepare_post_cp
()
+
[
'insmod mqnic.ko'
,
...
...
@@ -307,6 +322,7 @@ class CorundumDCTCPNode(NodeConfig):
class
LinuxFEMUNode
(
NodeConfig
):
def
__init__
(
self
):
self
.
drivers
=
[
'nvme'
]
...
...
@@ -319,31 +335,42 @@ class LinuxFEMUNode(NodeConfig):
l
.
append
(
'modprobe '
+
d
)
return
super
().
prepare_post_cp
()
+
l
class
NVMEFsTest
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'mount -t proc proc /proc'
,
'mkfs.ext3 /dev/nvme0n1'
,
'mount /dev/nvme0n1 /mnt'
,
'dd if=/dev/urandom of=/mnt/foo bs=1024 count=1024'
]
return
[
'mount -t proc proc /proc'
,
'mkfs.ext3 /dev/nvme0n1'
,
'mount /dev/nvme0n1 /mnt'
,
'dd if=/dev/urandom of=/mnt/foo bs=1024 count=1024'
]
class
DctcpServer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'iperf -s -w 1M -Z dctcp'
]
class
DctcpClient
(
AppConfig
):
server_ip
=
'192.168.64.1'
is_last
=
False
def
run_cmds
(
self
,
node
):
if
(
self
.
is_last
):
return
[
'sleep 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
'sleep 2'
]
return
[
'sleep 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
'sleep 2'
]
else
:
return
[
'sleep 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
'sleep 20'
]
return
[
'sleep 1'
,
f
'iperf -w 1M -c
{
self
.
server_ip
}
-Z dctcp -i 1'
,
'sleep 20'
]
class
PingClient
(
AppConfig
):
server_ip
=
'192.168.64.1'
...
...
@@ -351,14 +378,19 @@ class PingClient(AppConfig):
def
run_cmds
(
self
,
node
):
return
[
f
'ping
{
self
.
server_ip
}
-c 100'
]
class
IperfTCPServer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'iperf -s -l 32M -w 32M'
]
class
IperfUDPServer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'iperf -s -u'
]
class
IperfTCPClient
(
AppConfig
):
server_ip
=
'10.0.0.1'
procs
=
1
...
...
@@ -366,23 +398,28 @@ class IperfTCPClient(AppConfig):
def
run_cmds
(
self
,
node
):
cmds
=
[
'sleep 1'
,
'iperf -l 32M -w 32M -c '
+
self
.
server_ip
+
' -i 1 -P '
+
str
(
self
.
procs
)]
cmds
=
[
'sleep 1'
,
'iperf -l 32M -w 32M -c '
+
self
.
server_ip
+
' -i 1 -P '
+
str
(
self
.
procs
)
]
if
self
.
is_last
:
cmds
.
append
(
'sleep 0.5'
)
else
:
cmds
.
append
(
'sleep 10'
)
return
cmds
class
IperfUDPClient
(
AppConfig
):
server_ip
=
'10.0.0.1'
rate
=
'150m'
is_last
=
False
def
run_cmds
(
self
,
node
):
cmds
=
[
'sleep 1'
,
'iperf -c '
+
self
.
server_ip
+
' -i 1 -u -b '
+
self
.
rate
]
cmds
=
[
'sleep 1'
,
'iperf -c '
+
self
.
server_ip
+
' -i 1 -u -b '
+
self
.
rate
]
if
self
.
is_last
:
cmds
.
append
(
'sleep 0.5'
)
...
...
@@ -391,31 +428,30 @@ class IperfUDPClient(AppConfig):
return
cmds
class
IperfUDPShortClient
(
AppConfig
):
server_ip
=
'10.0.0.1'
rate
=
'150m'
is_last
=
False
def
run_cmds
(
self
,
node
):
cmds
=
[
'sleep 1'
,
'iperf -c '
+
self
.
server_ip
+
' -u -n 1 '
]
cmds
=
[
'sleep 1'
,
'iperf -c '
+
self
.
server_ip
+
' -u -n 1 '
]
return
cmds
class
IperfUDPClientSleep
(
AppConfig
):
server_ip
=
'10.0.0.1'
rate
=
'150m'
def
run_cmds
(
self
,
node
):
return
[
'sleep 1'
,
'sleep 10'
]
return
[
'sleep 1'
,
'sleep 10'
]
class
NoTraffic
(
AppConfig
):
is_sleep
=
1
is_server
=
0
def
run_cmds
(
self
,
node
):
cmds
=
[]
if
(
self
.
is_server
):
...
...
@@ -429,42 +465,58 @@ class NoTraffic(AppConfig):
return
cmds
class
NetperfServer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'netserver'
,
'sleep infinity'
]
return
[
'netserver'
,
'sleep infinity'
]
class
NetperfClient
(
AppConfig
):
server_ip
=
'10.0.0.1'
duration_tp
=
10
duration_lat
=
10
def
run_cmds
(
self
,
node
):
return
[
'netserver'
,
'sleep 0.5'
,
'netperf -H '
+
self
.
server_ip
+
' -l '
+
str
(
self
.
duration_tp
),
'netperf -H '
+
self
.
server_ip
+
' -l '
+
str
(
self
.
duration_lat
)
+
\
' -t TCP_RR -- -o mean_latency,p50_latency,p90_latency,p99_latency'
]
class
VRReplica
(
AppConfig
):
index
=
0
def
run_cmds
(
self
,
node
):
return
[
'/root/nopaxos/bench/replica -c /root/nopaxos.config -i '
+
str
(
self
.
index
)
+
' -m vr'
]
return
[
'/root/nopaxos/bench/replica -c /root/nopaxos.config -i '
+
str
(
self
.
index
)
+
' -m vr'
]
class
VRClient
(
AppConfig
):
server_ips
=
[]
def
run_cmds
(
self
,
node
):
cmds
=
[]
for
ip
in
self
.
server_ips
:
cmds
.
append
(
'ping -c 2 '
+
ip
)
cmds
.
append
(
'/root/nopaxos/bench/client -c /root/nopaxos.config '
+
'-m vr -u 2 -h '
+
node
.
ip
)
cmds
.
append
(
'/root/nopaxos/bench/client -c /root/nopaxos.config '
+
'-m vr -u 2 -h '
+
node
.
ip
)
return
cmds
class
NOPaxosReplica
(
AppConfig
):
index
=
0
def
run_cmds
(
self
,
node
):
return
[
'/root/nopaxos/bench/replica -c /root/nopaxos.config -i '
+
str
(
self
.
index
)
+
' -m nopaxos'
]
return
[
'/root/nopaxos/bench/replica -c /root/nopaxos.config -i '
+
str
(
self
.
index
)
+
' -m nopaxos'
]
class
NOPaxosClient
(
AppConfig
):
server_ips
=
[]
...
...
@@ -486,9 +538,13 @@ class NOPaxosClient(AppConfig):
cmds
.
append
(
'sleep infinity'
)
return
cmds
class
NOPaxosSequencer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'/root/nopaxos/sequencer/sequencer -c /root/nopaxos.config -m nopaxos'
]
return
[
'/root/nopaxos/sequencer/sequencer -c /root/nopaxos.config -m nopaxos'
]
class
RPCServer
(
AppConfig
):
...
...
@@ -500,9 +556,12 @@ class RPCServer(AppConfig):
def
run_cmds
(
self
,
node
):
exe
=
'echoserver_linux'
if
not
isinstance
(
node
,
MtcpNode
)
else
\
'echoserver_mtcp'
return
[
'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
)]
return
[
'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
)
]
class
RPCClient
(
AppConfig
):
server_ip
=
'10.0.0.1'
...
...
@@ -519,21 +578,32 @@ class RPCClient(AppConfig):
def
run_cmds
(
self
,
node
):
exe
=
'testclient_linux'
if
not
isinstance
(
node
,
MtcpNode
)
else
\
'testclient_mtcp'
return
[
'cd /root/tasbench/micro_rpc'
,
'./%s %s %d %d /tmp/guest/mtcp.conf %d %d %d %d %d %d &'
%
(
exe
,
self
.
server_ip
,
self
.
port
,
self
.
threads
,
self
.
max_bytes
,
self
.
max_pending
,
self
.
max_flows
,
self
.
openall_delay
,
self
.
max_msgs_conn
,
self
.
max_pend_conns
),
'sleep %d'
%
(
self
.
time
)]
return
[
'cd /root/tasbench/micro_rpc'
,
'./%s %s %d %d /tmp/guest/mtcp.conf %d %d %d %d %d %d &'
%
(
exe
,
self
.
server_ip
,
self
.
port
,
self
.
threads
,
self
.
max_bytes
,
self
.
max_pending
,
self
.
max_flows
,
self
.
openall_delay
,
self
.
max_msgs_conn
,
self
.
max_pend_conns
),
'sleep %d'
%
(
self
.
time
)
]
################################################################################
class
HTTPD
(
AppConfig
):
threads
=
1
file_size
=
64
mtcp_config
=
'lighttpd.conf'
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
):
return
[
'mkdir -p /srv/www/htdocs/ /tmp/lighttpd/'
,
...
...
@@ -545,12 +615,15 @@ class HTTPD(AppConfig):
'./lighttpd -D -f ../doc/config/%s -n %d -m ./.libs/'
%
\
(
self
.
mtcp_config
,
self
.
threads
)]
class
HTTPDLinux
(
HTTPD
):
httpd_dir
=
'/root/mtcp/apps/lighttpd-mtlinux'
class
HTTPDLinuxRPO
(
HTTPD
):
httpd_dir
=
'/root/mtcp/apps/lighttpd-mtlinux-rop'
class
HTTPDMtcp
(
HTTPD
):
httpd_dir
=
'/root/mtcp/apps/lighttpd-mtcp'
mtcp_config
=
'm-lighttpd.conf'
...
...
@@ -570,7 +643,7 @@ class HTTPC(AppConfig):
requests
=
10000
threads
=
1
url
=
'/file'
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
):
return
[
'cd %s/support/'
%
(
self
.
ab_dir
),
...
...
@@ -578,9 +651,11 @@ class HTTPC(AppConfig):
(
self
.
threads
,
self
.
conns
,
self
.
requests
,
self
.
server_ip
,
self
.
url
)]
class
HTTPCLinux
(
HTTPC
):
ab_dir
=
'/root/mtcp/apps/ab-linux'
class
HTTPCMtcp
(
HTTPC
):
ab_dir
=
'/root/mtcp/apps/ab-mtcp'
...
...
@@ -593,15 +668,20 @@ class HTTPCMtcp(HTTPC):
class
MemcachedServer
(
AppConfig
):
def
run_cmds
(
self
,
node
):
return
[
'memcached -u root -t 1 -c 4096'
]
class
MemcachedClient
(
AppConfig
):
server_ips
=
[
'10.0.0.1'
]
threads
=
1
concurrency
=
1
throughput
=
'1k'
def
run_cmds
(
self
,
node
):
servers
=
[
ip
+
':11211'
for
ip
in
self
.
server_ips
]
servers
=
','
.
join
(
servers
)
return
[
f
'memaslap --binary --time 10s --server=
{
servers
}
--thread=
{
self
.
threads
}
--concurrency=
{
self
.
concurrency
}
--tps=
{
self
.
throughput
}
--verbose'
]
return
[
f
'memaslap --binary --time 10s --server=
{
servers
}
--thread=
{
self
.
threads
}
--concurrency=
{
self
.
concurrency
}
--tps=
{
self
.
throughput
}
--verbose'
]
experiments/simbricks/proxy.py
View file @
7549fa9e
...
...
@@ -22,6 +22,7 @@
from
simbricks.simulators
import
Simulator
class
SimProxy
(
Simulator
):
name
=
''
# set by the experiment runner
...
...
@@ -34,8 +35,9 @@ class SimProxy(Simulator):
def
full_name
(
self
):
return
'proxy.'
+
self
.
name
class
NetProxy
(
SimProxy
):
"""
Proxy for connections between NICs and networks.
"""
"""Proxy for connections between NICs and networks."""
# List of tuples (nic, with_listener)
nics
=
None
...
...
@@ -51,6 +53,7 @@ class NetProxy(SimProxy):
def
start_delay
(
self
):
return
10
class
NetProxyListener
(
NetProxy
):
port
=
12345
connecter
=
None
...
...
@@ -108,7 +111,7 @@ class NetProxyListener(NetProxy):
def
run_cmd_base
(
self
,
env
):
cmd
=
(
f
'-s
{
env
.
proxy_shm_path
(
self
)
}
'
f
'-S
{
self
.
shm_size
}
'
)
f
'-S
{
self
.
shm_size
}
'
)
for
(
nic
,
local
)
in
self
.
nics
:
cmd
+=
'-C '
if
local
else
'-L '
cmd
+=
env
.
nic_eth_path
(
nic
)
+
' '
...
...
@@ -120,6 +123,7 @@ class NetProxyListener(NetProxy):
cmd
+=
f
' 0.0.0.0
{
self
.
port
}
'
return
cmd
class
NetProxyConnecter
(
NetProxy
):
listener
=
None
...
...
@@ -175,7 +179,7 @@ class NetProxyConnecter(NetProxy):
def
run_cmd_base
(
self
,
env
):
cmd
=
(
f
'-s
{
env
.
proxy_shm_path
(
self
)
}
'
f
'-S
{
self
.
shm_size
}
'
)
f
'-S
{
self
.
shm_size
}
'
)
for
(
nic
,
local
)
in
self
.
nics
:
cmd
+=
'-L '
if
local
else
'-C '
cmd
+=
env
.
nic_eth_path
(
nic
)
+
' '
...
...
@@ -189,6 +193,7 @@ class NetProxyConnecter(NetProxy):
class
RDMANetProxyListener
(
NetProxyListener
):
def
__init__
(
self
):
super
().
__init__
()
...
...
@@ -197,7 +202,9 @@ class RDMANetProxyListener(NetProxyListener):
cmd
+=
super
().
run_cmd_base
(
env
)
return
cmd
class
RDMANetProxyConnecter
(
NetProxyConnecter
):
def
__init__
(
self
,
listener
):
super
().
__init__
(
listener
)
...
...
@@ -208,6 +215,7 @@ class RDMANetProxyConnecter(NetProxyConnecter):
class
SocketsNetProxyListener
(
NetProxyListener
):
def
__init__
(
self
):
super
().
__init__
()
...
...
@@ -216,11 +224,13 @@ class SocketsNetProxyListener(NetProxyListener):
cmd
+=
super
().
run_cmd_base
(
env
)
return
cmd
class
SocketsNetProxyConnecter
(
NetProxyConnecter
):
def
__init__
(
self
,
listener
):
super
().
__init__
(
listener
)
def
run_cmd
(
self
,
env
):
cmd
=
f
'
{
env
.
repodir
}
/dist/sockets/net_sockets '
cmd
+=
super
().
run_cmd_base
(
env
)
return
cmd
\ No newline at end of file
return
cmd
experiments/simbricks/runtime/__init__.py
View file @
7549fa9e
...
...
@@ -20,7 +20,7 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from
simbricks.runtime.common
import
(
Run
,
Runtime
)
from
simbricks.runtime.local
import
(
LocalSimpleRuntime
,
LocalParallelRuntime
)
from
simbricks.runtime.common
import
Run
,
Runtime
from
simbricks.runtime.distributed
import
DistributedSimpleRuntime
,
auto_dist
from
simbricks.runtime.local
import
LocalParallelRuntime
,
LocalSimpleRuntime
from
simbricks.runtime.slurm
import
SlurmRuntime
from
simbricks.runtime.distributed
import
(
DistributedSimpleRuntime
,
auto_dist
)
Prev
1
2
3
4
5
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