Commit 7549fa9e authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

pre-commit run -a

parent aac98df8
...@@ -19,16 +19,20 @@ ...@@ -19,16 +19,20 @@
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# 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.
"""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. 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 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.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
host_types = ['qemu', 'gem5', 'qt'] host_types = ['qemu', 'gem5', 'qt']
nic_types = ['i40e', 'cd_bm', 'cd_verilator'] nic_types = ['i40e', 'cd_bm', 'cd_verilator']
net_types = ['switch', 'ns3'] net_types = ['switch', 'ns3']
...@@ -39,7 +43,9 @@ experiments = [] ...@@ -39,7 +43,9 @@ experiments = []
for host_type in host_types: for host_type in host_types:
for nic_type in nic_types: for nic_type in nic_types:
for net_type in net_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 # network
if net_type == 'switch': if net_type == 'switch':
...@@ -54,10 +60,12 @@ for host_type in host_types: ...@@ -54,10 +60,12 @@ for host_type in host_types:
if host_type == 'qemu': if host_type == 'qemu':
host_class = sim.QemuHost host_class = sim.QemuHost
elif host_type == 'qt': elif host_type == 'qt':
def qemu_timing(): def qemu_timing():
h = sim.QemuHost() h = sim.QemuHost()
h.sync = True h.sync = True
return h return h
host_class = qemu_timing host_class = qemu_timing
elif host_type == 'gem5': elif host_type == 'gem5':
host_class = sim.Gem5Host host_class = sim.Gem5Host
...@@ -79,11 +87,28 @@ for host_type in host_types: ...@@ -79,11 +87,28 @@ for host_type in host_types:
raise NameError(nic_type) raise NameError(nic_type)
# create servers and clients # create servers and clients
servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class, servers = create_basic_hosts(
nc_class, node.NetperfServer) e,
1,
'server',
net,
nic_class,
host_class,
nc_class,
node.NetperfServer
)
clients = create_basic_hosts(e, 1, 'client', net, nic_class, host_class, clients = create_basic_hosts(
nc_class, node.NetperfClient, ip_start = 2) e,
1,
'client',
net,
nic_class,
host_class,
nc_class,
node.NetperfClient,
ip_start=2
)
for c in clients: for c in clients:
c.wait = True c.wait = True
......
...@@ -20,16 +20,15 @@ ...@@ -20,16 +20,15 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
import simbricks.experiments as exp
app_types = ['sleep', 'busy'] app_types = ['sleep', 'busy']
experiments = [] experiments = []
for app_type in app_types: for app_type in app_types:
e = exp.Experiment('no_simb-gt-' + app_type) e = exp.Experiment('no_simb-gt-' + app_type)
...@@ -38,7 +37,6 @@ for app_type in app_types: ...@@ -38,7 +37,6 @@ for app_type in app_types:
e.checkpoint = True e.checkpoint = True
e.no_simbricks = True e.no_simbricks = True
nc_class = node.I40eLinuxNode nc_class = node.I40eLinuxNode
# create servers and clients # create servers and clients
...@@ -59,12 +57,7 @@ for app_type in app_types: ...@@ -59,12 +57,7 @@ for app_type in app_types:
e.add_host(host) e.add_host(host)
host.wait = True host.wait = True
print(e.name) print(e.name)
# add to experiments # add to experiments
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
# iperf TCP_single test # iperf TCP_single test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
...@@ -34,11 +34,10 @@ from simbricks.simulator_utils import create_basic_hosts ...@@ -34,11 +34,10 @@ from simbricks.simulator_utils import create_basic_hosts
# app: UDPs # app: UDPs
host_types = ['gt', 'qt', 'qemu'] host_types = ['gt', 'qt', 'qemu']
nic_types = ['cv','cb','ib'] nic_types = ['cv', 'cb', 'ib']
net_types = ['sw', 'br'] net_types = ['sw', 'br']
app_types = ['sleep', 'busy'] app_types = ['sleep', 'busy']
num_cores = 1 num_cores = 1
n_client = 1 n_client = 1
...@@ -49,7 +48,10 @@ for host_type in host_types: ...@@ -49,7 +48,10 @@ for host_type in host_types:
for net_type in net_types: for net_type in net_types:
for app_type in app_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 #e.no_simbricks = False
# network # network
if net_type == 'sw': if net_type == 'sw':
...@@ -64,10 +66,12 @@ for host_type in host_types: ...@@ -64,10 +66,12 @@ for host_type in host_types:
if host_type == 'qemu': if host_type == 'qemu':
host_class = sim.QemuHost host_class = sim.QemuHost
elif host_type == 'qt': elif host_type == 'qt':
def qemu_timing(): def qemu_timing():
h = sim.QemuHost() h = sim.QemuHost()
h.sync = True h.sync = True
return h return h
host_class = qemu_timing host_class = qemu_timing
elif host_type == 'gt': elif host_type == 'gt':
host_class = sim.Gem5Host host_class = sim.Gem5Host
...@@ -99,11 +103,19 @@ for host_type in host_types: ...@@ -99,11 +103,19 @@ for host_type in host_types:
s.node_config.app.is_server = 1 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, clients[n_client - 1].wait = True
nc_class, node.NoTraffic, ip_start=2)
clients[n_client-1].wait = True
for c in clients: for c in clients:
...@@ -115,12 +127,7 @@ for host_type in host_types: ...@@ -115,12 +127,7 @@ for host_type in host_types:
c.node_config.app.is_sleep = 0 c.node_config.app.is_sleep = 0
#c.wait = True #c.wait = True
print(e.name) print(e.name)
# add to experiments # add to experiments
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
host_configs = ['qemu', 'gt', 'qt'] host_configs = ['qemu', 'gt', 'qt']
seq_configs = ['swseq', 'ehseq', 'tofino'] seq_configs = ['swseq', 'ehseq', 'tofino']
nic_configs = ['ib', 'cb', 'cv'] nic_configs = ['ib', 'cb', 'cv']
...@@ -41,7 +42,10 @@ for proto_config in proto_configs: ...@@ -41,7 +42,10 @@ for proto_config in proto_configs:
for host_config in host_configs: for host_config in host_configs:
for seq_config in seq_configs: for seq_config in seq_configs:
for nic_config in nic_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': if seq_config == 'tofino':
net = sim.TofinoNet() net = sim.TofinoNet()
else: else:
...@@ -58,10 +62,12 @@ for proto_config in proto_configs: ...@@ -58,10 +62,12 @@ for proto_config in proto_configs:
host_class = sim.Gem5Host host_class = sim.Gem5Host
e.checkpoint = True e.checkpoint = True
elif host_config == 'qt': elif host_config == 'qt':
def qemu_timing(): def qemu_timing():
h = sim.QemuHost() h = sim.QemuHost()
h.sync = True h.sync = True
return h return h
host_class = qemu_timing host_class = qemu_timing
else: else:
raise NameError(host_config) raise NameError(host_config)
...@@ -79,7 +85,6 @@ for proto_config in proto_configs: ...@@ -79,7 +85,6 @@ for proto_config in proto_configs:
else: else:
raise NameError(nic_config) raise NameError(nic_config)
# app # app
if proto_config == 'vr': if proto_config == 'vr':
replica_class = node.VRReplica replica_class = node.VRReplica
...@@ -92,25 +97,53 @@ for proto_config in proto_configs: ...@@ -92,25 +97,53 @@ for proto_config in proto_configs:
# endhost sequencer # endhost sequencer
if seq_config == 'ehseq' and proto_config == 'nopaxos': if seq_config == 'ehseq' and proto_config == 'nopaxos':
sequencer = create_basic_hosts(e, 1, 'sequencer', net, nic_class, sequencer = create_basic_hosts(
host_class, nc_class, node.NOPaxosSequencer, ip_start = 100) e,
1,
'sequencer',
net,
nic_class,
host_class,
nc_class,
node.NOPaxosSequencer,
ip_start=100
)
sequencer[0].node_config.disk_image = 'nopaxos' sequencer[0].node_config.disk_image = 'nopaxos'
sequencer[0].pcidevs[0].sync_period = sync_period sequencer[0].pcidevs[0].sync_period = sync_period
sequencer[0].sync_period = sync_period sequencer[0].sync_period = sync_period
replicas = create_basic_hosts(e, 3, 'replica', net, nic_class, replicas = create_basic_hosts(
host_class, nc_class, replica_class) e,
3,
'replica',
net,
nic_class,
host_class,
nc_class,
replica_class
)
for i in range(len(replicas)): for i in range(len(replicas)):
replicas[i].node_config.app.index = i replicas[i].node_config.app.index = i
replicas[i].node_config.disk_image = 'nopaxos' replicas[i].node_config.disk_image = 'nopaxos'
replicas[i].pcidevs[0].sync_period = sync_period replicas[i].pcidevs[0].sync_period = sync_period
replicas[i].sync_period = sync_period replicas[i].sync_period = sync_period
clients = create_basic_hosts(e, num_c, 'client', net, nic_class, clients = create_basic_hosts(
host_class, nc_class, client_class, ip_start = 4) e,
num_c,
'client',
net,
nic_class,
host_class,
nc_class,
client_class,
ip_start=4
)
for c in clients: 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': if seq_config == 'ehseq':
c.node_config.app.server_ips.append('10.0.0.100') c.node_config.app.server_ips.append('10.0.0.100')
c.node_config.app.use_ehseq = True c.node_config.app.use_ehseq = True
...@@ -124,4 +157,3 @@ for proto_config in proto_configs: ...@@ -124,4 +157,3 @@ for proto_config in proto_configs:
#print(e.name) #print(e.name)
experiments.append(e) experiments.append(e)
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
e1000 NIC, and then with the extracted gem5 e1000 NIC connected through e1000 NIC, and then with the extracted gem5 e1000 NIC connected through
SimBricks.""" SimBricks."""
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
experiments = [] import simbricks.experiments as exp
experiments = []
for internal in [True, False]: for internal in [True, False]:
if internal: if internal:
...@@ -67,7 +67,9 @@ for internal in [True, False]: ...@@ -67,7 +67,9 @@ 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('--debug-flags=SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc') h.extra_main_args.append(
'--debug-flags=SimBricksEthernet,SimBricksPci,EthernetAll,EthernetDesc'
)
if internal: if internal:
h.add_netdirect(net) h.add_netdirect(net)
else: else:
......
...@@ -20,25 +20,41 @@ ...@@ -20,25 +20,41 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
e = exp.Experiment('qemu-e1000-pair') e = exp.Experiment('qemu-e1000-pair')
net = sim.SwitchNet() net = sim.SwitchNet()
e.add_network(net) e.add_network(net)
servers = create_basic_hosts(e, 1, 'server', net, sim.E1000NIC, sim.QemuHost, servers = create_basic_hosts(
node.E1000LinuxNode, node.IperfTCPServer) e,
1,
clients = create_basic_hosts(e, 1, 'client', net, sim.E1000NIC, sim.QemuHost, 'server',
node.E1000LinuxNode, node.IperfTCPClient, ip_start = 2) 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: for c in clients:
c.wait = True c.wait = True
c.node_config.app.server_ip = servers[0].node_config.ip c.node_config.app.server_ip = servers[0].node_config.ip
experiments = [e] experiments = [e]
...@@ -20,25 +20,41 @@ ...@@ -20,25 +20,41 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
e = exp.Experiment('qemu-i40e-pair') e = exp.Experiment('qemu-i40e-pair')
net = sim.SwitchNet() net = sim.SwitchNet()
e.add_network(net) e.add_network(net)
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
node.I40eLinuxNode, node.IperfTCPServer) e,
1,
clients = create_basic_hosts(e, 2, 'client', net, sim.I40eNIC, sim.QemuHost, 'server',
node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2) 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: for c in clients:
c.wait = True c.wait = True
c.node_config.app.server_ip = servers[0].node_config.ip c.node_config.app.server_ip = servers[0].node_config.ip
experiments = [e] experiments = [e]
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
# iperf TCP_multi_client test # iperf TCP_multi_client test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts ...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPm # app: TCPm
kinds_of_host = ['qemu'] kinds_of_host = ['qemu']
kinds_of_nic = ['cv','cb','ib'] kinds_of_nic = ['cv', 'cb', 'ib']
kinds_of_net = ['switch', 'dumbbell', 'bridge'] kinds_of_net = ['switch', 'dumbbell', 'bridge']
kinds_of_app = ['TCPm'] kinds_of_app = ['TCPm']
num_client = 4 num_client = 4
...@@ -51,7 +51,6 @@ for n in kinds_of_net: ...@@ -51,7 +51,6 @@ for n in kinds_of_net:
if n == 'bridge': if n == 'bridge':
net_class = sim.NS3BridgeNet net_class = sim.NS3BridgeNet
# set nic sim # set nic sim
for c in kinds_of_nic: for c in kinds_of_nic:
net = net_class() net = net_class()
...@@ -59,26 +58,73 @@ for n in kinds_of_net: ...@@ -59,26 +58,73 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) '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': if c == 'cb':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) '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': if c == 'ib':
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
node.I40eLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost, 1,
node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2) '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: for cl in clients:
cl.wait = True cl.wait = True
...@@ -86,4 +132,3 @@ for n in kinds_of_net: ...@@ -86,4 +132,3 @@ for n in kinds_of_net:
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
# iperf TCP_single test # iperf TCP_single test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts ...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPs # app: TCPs
kinds_of_host = ['qemu'] 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_net = ['wire', 'switch', 'dumbbell', 'bridge', 'tofino']
kinds_of_app = ['TCPs'] kinds_of_app = ['TCPs']
...@@ -53,7 +53,6 @@ for n in kinds_of_net: ...@@ -53,7 +53,6 @@ for n in kinds_of_net:
if n == 'tofino': if n == 'tofino':
net_class = sim.TofinoNet net_class = sim.TofinoNet
# set nic sim # set nic sim
for c in kinds_of_nic: for c in kinds_of_nic:
net = net_class() net = net_class()
...@@ -61,29 +60,76 @@ for n in kinds_of_net: ...@@ -61,29 +60,76 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) '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': if c == 'cb':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) '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': if c == 'ib':
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
node.I40eLinuxNode, node.IperfTCPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost, 1,
node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2) '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].wait = True
clients[0].node_config.app.server_ip = servers[0].node_config.ip clients[0].node_config.app.server_ip = servers[0].node_config.ip
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
# iperf TCP_multi_client test # iperf TCP_multi_client test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts ...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: TCPm # app: TCPm
kinds_of_host = ['qemu'] kinds_of_host = ['qemu']
kinds_of_nic = ['cv','cb','ib'] kinds_of_nic = ['cv', 'cb', 'ib']
kinds_of_net = ['switch', 'dumbbell', 'bridge'] kinds_of_net = ['switch', 'dumbbell', 'bridge']
kinds_of_app = ['UDPm'] kinds_of_app = ['UDPm']
...@@ -53,7 +53,6 @@ for n in kinds_of_net: ...@@ -53,7 +53,6 @@ for n in kinds_of_net:
if n == 'bridge': if n == 'bridge':
net_class = sim.NS3BridgeNet net_class = sim.NS3BridgeNet
# set nic sim # set nic sim
for c in kinds_of_nic: for c in kinds_of_nic:
net = net_class() net = net_class()
...@@ -61,26 +60,73 @@ for n in kinds_of_net: ...@@ -61,26 +60,73 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) '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': if c == 'cb':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) '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': if c == 'ib':
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
node.I40eLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost, 1,
node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2) '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: for cl in clients:
cl.wait = True cl.wait = True
...@@ -89,4 +135,3 @@ for n in kinds_of_net: ...@@ -89,4 +135,3 @@ for n in kinds_of_net:
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
# iperf TCP_single test # iperf TCP_single test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts ...@@ -34,7 +34,7 @@ from simbricks.simulator_utils import create_basic_hosts
# app: UDPs # app: UDPs
kinds_of_host = ['qemu'] 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_net = ['wire', 'switch', 'dumbbell', 'bridge', 'tofino']
kinds_of_app = ['UDPs'] kinds_of_app = ['UDPs']
...@@ -55,7 +55,6 @@ for n in kinds_of_net: ...@@ -55,7 +55,6 @@ for n in kinds_of_net:
if n == 'tofino': if n == 'tofino':
net_class = sim.TofinoNet net_class = sim.TofinoNet
# set nic sim # set nic sim
for c in kinds_of_nic: for c in kinds_of_nic:
net = net_class() net = net_class()
...@@ -63,25 +62,73 @@ for n in kinds_of_net: ...@@ -63,25 +62,73 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) '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': if c == 'cb':
servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(
node.CorundumLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost, 1,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) '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': if c == 'ib':
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
node.I40eLinuxNode, node.IperfUDPServer) e,
clients = create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost, 1,
node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2) '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].wait = True
clients[0].node_config.app.server_ip = servers[0].node_config.ip clients[0].node_config.app.server_ip = servers[0].node_config.ip
...@@ -89,4 +136,3 @@ for n in kinds_of_net: ...@@ -89,4 +136,3 @@ for n in kinds_of_net:
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
msg_sizes = [64, 1024, 8092] msg_sizes = [64, 1024, 8092]
stacks = ['mtcp', 'tas', 'linux'] stacks = ['mtcp', 'tas', 'linux']
...@@ -33,7 +33,9 @@ num_clients = 1 ...@@ -33,7 +33,9 @@ num_clients = 1
experiments = [] experiments = []
for msg_size in msg_sizes: for msg_size in msg_sizes:
for stack in stacks: for stack in stacks:
e = exp.Experiment('qemu-ib-switch-rpc-%s-1t-1fpc-%db-0mpc' % (stack,msg_size)) e = exp.Experiment(
'qemu-ib-switch-rpc-%s-1t-1fpc-%db-0mpc' % (stack, msg_size)
)
net = sim.SwitchNet() net = sim.SwitchNet()
e.add_network(net) e.add_network(net)
...@@ -44,11 +46,21 @@ for msg_size in msg_sizes: ...@@ -44,11 +46,21 @@ for msg_size in msg_sizes:
else: else:
n = node.I40eLinuxNode n = node.I40eLinuxNode
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(
n, node.RPCServer) e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, n, node.RPCServer
)
clients = create_basic_hosts(e, num_clients, 'client', net, sim.I40eNIC, clients = create_basic_hosts(
sim.QemuHost, n, node.RPCClient, ip_start = 2) e,
num_clients,
'client',
net,
sim.I40eNIC,
sim.QemuHost,
n,
node.RPCClient,
ip_start=2
)
for h in servers + clients: for h in servers + clients:
h.node_config.cores = 1 if stack != 'tas' else 3 h.node_config.cores = 1 if stack != 'tas' else 3
...@@ -66,4 +78,3 @@ for msg_size in msg_sizes: ...@@ -66,4 +78,3 @@ for msg_size in msg_sizes:
c.node_config.app.server_ip = servers[0].node_config.ip c.node_config.app.server_ip = servers[0].node_config.ip
experiments.append(e) experiments.append(e)
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
# 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.
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
import simbricks.simulators as sim
from simbricks.simulator_utils import create_basic_hosts from simbricks.simulator_utils import create_basic_hosts
import simbricks.experiments as exp
host_configs = ['bm', 'cycle'] host_configs = ['bm', 'cycle']
n_clients = [1, 2, 4, 8] n_clients = [1, 2, 4, 8]
target_bandwidth = 100 target_bandwidth = 100
...@@ -50,15 +51,31 @@ for host_config in host_configs: ...@@ -50,15 +51,31 @@ for host_config in host_configs:
e.add_network(net) e.add_network(net)
servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class, servers = create_basic_hosts(
nc_class, node.IperfUDPServer) e,
1,
'server',
net,
nic_class,
host_class,
nc_class,
node.IperfUDPServer
)
clients = create_basic_hosts(e, nc, 'client', net, nic_class, host_class, clients = create_basic_hosts(
nc_class, node.IperfUDPClient) e,
nc,
'client',
net,
nic_class,
host_class,
nc_class,
node.IperfUDPClient
)
for c in clients: for c in clients:
c.wait = True c.wait = True
c.node_config.app.server_ip = servers[0].node_config.ip 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.append(e)
...@@ -21,95 +21,199 @@ ...@@ -21,95 +21,199 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import argparse import argparse
import sys import fnmatch
import os
import importlib import importlib
import importlib.util import importlib.util
import json import json
import os
import pickle import pickle
import fnmatch import sys
import typing as tp import typing as tp
import simbricks.exectools as exectools
from simbricks.runtime.common import * from simbricks.runtime.common import *
from simbricks.runtime.distributed import * from simbricks.runtime.distributed import *
from simbricks.runtime.local import * from simbricks.runtime.local import *
from simbricks.runtime.slurm import * from simbricks.runtime.slurm import *
import simbricks.exectools as exectools
import simbricks.experiments as exp import simbricks.experiments as exp
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)
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('experiments', metavar='EXP', type=str, nargs='+', parser.add_argument(
help='An experiment file to run') 'experiments',
parser.add_argument('--list', action='store_const', const=True, default=False, metavar='EXP',
help='Only list available experiment names') type=str,
parser.add_argument('--filter', metavar='PATTERN', type=str, nargs='+', nargs='+',
help='Pattern to match experiment names against') help='An experiment file to run'
parser.add_argument('--pickled', action='store_const', const=True, )
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, default=False,
help='Read exp files as pickled runs instead of exp.py files') help='Verbose output'
parser.add_argument('--runs', metavar='N', type=int, default=1, )
help='Number of repetition for each experiment') parser.add_argument(
parser.add_argument('--firstrun', metavar='N', type=int, default=1, '--pcap',
help='ID for first run') action='store_const',
parser.add_argument('--force', action='store_const', const=True, default=False, const=True,
help='Run experiments even if output already exists')
parser.add_argument('--verbose', action='store_const', const=True,
default=False, default=False,
help='Verbose output') help='Dump pcap file (if supported by simulator)'
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 = parser.add_argument_group('Environment')
g_env.add_argument('--repo', metavar='DIR', type=str, g_env.add_argument(
default='..', help='Repo directory') '--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(
g_env.add_argument('--outdir', metavar='DIR', type=str, '--workdir',
default='./out/', help='Output directory base') metavar='DIR',
g_env.add_argument('--cpdir', metavar='DIR', type=str, type=str,
default='./out/', help='Checkpoint directory base') default='./out/',
g_env.add_argument('--hosts', metavar='JSON_FILE', type=str, help='Work directory base'
default=None, help='List of hosts to use (json)') )
g_env.add_argument('--shmdir', metavar='DIR', type=str, g_env.add_argument(
default=None, help='Shared memory directory base (workdir if not set)') '--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 = parser.add_argument_group('Parallel Runtime')
g_par.add_argument('--parallel', dest='runtime', action='store_const', g_par.add_argument(
const='parallel', default='sequential', '--parallel',
help='Use parallel instead of sequential runtime') dest='runtime',
g_par.add_argument('--cores', metavar='N', type=int, 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)), default=len(os.sched_getaffinity(0)),
help='Number of cores to use for parallel runs') 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(
'--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 = parser.add_argument_group('Slurm Runtime')
g_slurm.add_argument('--slurm', dest='runtime', action='store_const', g_slurm.add_argument(
const='slurm', default='sequential', '--slurm',
help='Use slurm instead of sequential runtime') dest='runtime',
g_slurm.add_argument('--slurmdir', metavar='DIR', type=str, action='store_const',
default='./slurm/', help='Slurm communication directory') 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 = parser.add_argument_group('Distributed Runtime')
g_dist.add_argument('--dist', dest='runtime', action='store_const', g_dist.add_argument(
const='dist', default='sequential', '--dist',
help='Use sequential distributed runtime instead of local') dest='runtime',
g_dist.add_argument('--auto-dist', action='store_const', const=True, 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, default=False,
help='Automatically distribute non-distributed experiments') help='Automatically distribute non-distributed experiments'
g_dist.add_argument('--proxy-type', metavar='TYPE', type=str, )
g_dist.add_argument(
'--proxy-type',
metavar='TYPE',
type=str,
default='sockets', default='sockets',
help='Proxy type to use (sockets,rdma) for auto distribution') help='Proxy type to use (sockets,rdma) for auto distribution'
)
args = parser.parse_args() args = parser.parse_args()
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') as f:
hosts = json.load(f) hosts = json.load(f)
...@@ -129,21 +233,27 @@ def load_executors(path): ...@@ -129,21 +233,27 @@ def load_executors(path):
exs.append(ex) exs.append(ex)
return exs return exs
if args.hosts is None: if args.hosts is None:
executors = [exectools.LocalExecutor()] executors = [exectools.LocalExecutor()]
else: else:
executors = load_executors(args.hosts) executors = load_executors(args.hosts)
def warn_multi_exec(): def warn_multi_exec():
if len(executors) > 1: if len(executors) > 1:
print('Warning: multiple hosts specified, only using first one for now', print(
file=sys.stderr) 'Warning: multiple hosts specified, only using first one for now',
file=sys.stderr
)
# initialize runtime # initialize runtime
if args.runtime == 'parallel': if args.runtime == 'parallel':
warn_multi_exec() warn_multi_exec()
rt = LocalParallelRuntime(cores=args.cores, mem=args.mem, rt = LocalParallelRuntime(
verbose=args.verbose, exec=executors[0]) cores=args.cores, mem=args.mem, verbose=args.verbose, exec=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)
elif args.runtime == 'dist': elif args.runtime == 'dist':
...@@ -154,8 +264,12 @@ else: ...@@ -154,8 +264,12 @@ else:
def add_exp( def add_exp(
e: exp.Experiment, run: int, prereq: tp.Optional[Run], e: exp.Experiment,
create_cp: bool, restore_cp: bool, no_simbricks: bool 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) outpath = '%s/%s-%d.json' % (args.outdir, e.name, run)
if os.path.exists(outpath) and not args.force: if os.path.exists(outpath) and not args.force:
...@@ -170,10 +284,10 @@ def add_exp( ...@@ -170,10 +284,10 @@ def add_exp(
env = exp.ExpEnv(args.repo, workdir, cpdir) env = exp.ExpEnv(args.repo, workdir, cpdir)
env.create_cp = create_cp env.create_cp = create_cp
env.restore_cp = restore_cp env.restore_cp = restore_cp
env.no_simbricks=no_simbricks env.no_simbricks = no_simbricks
env.pcap_file = '' env.pcap_file = ''
if args.pcap: if args.pcap:
env.pcap_file = workdir+'/pcap' env.pcap_file = workdir + '/pcap'
if args.shmdir is not None: if args.shmdir is not None:
env.shm_base = os.path.abspath(shmdir) env.shm_base = os.path.abspath(shmdir)
...@@ -181,6 +295,7 @@ def add_exp( ...@@ -181,6 +295,7 @@ def add_exp(
rt.add_run(run) rt.add_run(run)
return run return run
# load experiments # load experiments
if not args.pickled: if not args.pickled:
# default: load python modules with experiments # default: load python modules with experiments
......
...@@ -21,15 +21,17 @@ ...@@ -21,15 +21,17 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import asyncio import asyncio
from asyncio.subprocess import Process
import os import os
import pathlib import pathlib
import re import re
import shlex import shlex
import shutil import shutil
import signal import signal
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={}):
self.name = name self.name = name
self.ip = ip self.ip = ip
...@@ -38,6 +40,7 @@ class HostConfig(object): ...@@ -38,6 +40,7 @@ class HostConfig(object):
self.sudo_pwd = sudopwd self.sudo_pwd = sudopwd
self.other = other.copy() self.other = other.copy()
class Component(object): class Component(object):
proc: Process proc: Process
terminate_future: asyncio.Task[int] terminate_future: asyncio.Task[int]
...@@ -92,9 +95,12 @@ class Component(object): ...@@ -92,9 +95,12 @@ class Component(object):
return return
async def _waiter(self): async def _waiter(self):
out_handlers = asyncio.ensure_future(asyncio.wait([ out_handlers = asyncio.ensure_future(
asyncio.wait([
self._read_stream(self.proc.stdout, self._consume_out), self._read_stream(self.proc.stdout, self._consume_out),
self._read_stream(self.proc.stderr, self._consume_err)])) self._read_stream(self.proc.stderr, self._consume_err)
])
)
rc = await self.proc.wait() rc = await self.proc.wait()
await out_handlers await out_handlers
await self.terminated(rc) await self.terminated(rc)
...@@ -111,7 +117,8 @@ class Component(object): ...@@ -111,7 +117,8 @@ class Component(object):
else: else:
stdin = None stdin = None
self.proc = await asyncio.create_subprocess_exec(*self.cmd_parts, self.proc = await asyncio.create_subprocess_exec(
*self.cmd_parts,
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
stdin=stdin, stdin=stdin,
...@@ -137,7 +144,7 @@ class Component(object): ...@@ -137,7 +144,7 @@ class Component(object):
async def int_term_kill(self, delay=5): async def int_term_kill(self, delay=5):
await self.interrupt() 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: if len(pending) != 0:
print('terminating') print('terminating')
await self.terminate() await self.terminate()
...@@ -161,8 +168,10 @@ class Component(object): ...@@ -161,8 +168,10 @@ class Component(object):
class SimpleComponent(Component): 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.label = label
self.verbose = verbose self.verbose = verbose
self.canfail = canfail self.canfail = canfail
...@@ -185,10 +194,20 @@ class SimpleComponent(Component): ...@@ -185,10 +194,20 @@ class SimpleComponent(Component):
if not self.canfail and rc != 0: if not self.canfail and rc != 0:
raise Exception('Command Failed: ' + str(self.cmd_parts)) raise Exception('Command Failed: ' + str(self.cmd_parts))
class SimpleRemoteComponent(SimpleComponent): class SimpleRemoteComponent(SimpleComponent):
pid_fut: asyncio.Future 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.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
...@@ -209,25 +228,23 @@ class SimpleRemoteComponent(SimpleComponent): ...@@ -209,25 +228,23 @@ class SimpleRemoteComponent(SimpleComponent):
super().__init__(label, parts, *args, **kwargs) super().__init__(label, parts, *args, **kwargs)
def _ssh_cmd(self, parts): def _ssh_cmd(self, parts):
""" SSH invocation of command for this host. """ """SSH invocation of command for this host."""
return [ return [
'ssh', 'ssh',
'-o', '-o',
'UserKnownHostsFile=/dev/null', 'UserKnownHostsFile=/dev/null',
'-o', '-o',
'StrictHostKeyChecking=no' 'StrictHostKeyChecking=no'
] + self.extra_flags + [ ] + self.extra_flags + [self.host_name, '--'] + parts
self.host_name,
'--'] + parts
async def start(self): 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() self.pid_fut = asyncio.get_running_loop().create_future()
await super().start() await super().start()
await self.pid_fut await self.pid_fut
async def process_out(self, lines, eof): 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(): if not self.pid_fut.done():
newlines = [] newlines = []
pid_re = re.compile(r'^PID\s+(\d+)\s*$') pid_re = re.compile(r'^PID\s+(\d+)\s*$')
...@@ -247,9 +264,10 @@ class SimpleRemoteComponent(SimpleComponent): ...@@ -247,9 +264,10 @@ class SimpleRemoteComponent(SimpleComponent):
await super().process_out(lines, eof) await super().process_out(lines, eof)
async def _kill_cmd(self, sig): async def _kill_cmd(self, sig):
""" Send signal to command by running ssh kill -$sig $PID. """ """Send signal to command by running ssh kill -$sig $PID."""
cmd_parts = self._ssh_cmd(['kill', '-' + sig, cmd_parts = self._ssh_cmd([
str(self.pid_fut.result())]) 'kill', '-' + sig, str(self.pid_fut.result())
])
proc = await asyncio.create_subprocess_exec(*cmd_parts) proc = await asyncio.create_subprocess_exec(*cmd_parts)
await proc.wait() await proc.wait()
...@@ -262,30 +280,32 @@ class SimpleRemoteComponent(SimpleComponent): ...@@ -262,30 +280,32 @@ class SimpleRemoteComponent(SimpleComponent):
async def kill(self): async def kill(self):
await self._kill_cmd('KILL') await self._kill_cmd('KILL')
class Executor(object): class Executor(object):
ip = None ip = None
def create_component(self, label, parts, **kwargs) -> SimpleComponent: 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): 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): 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): 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): 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 # 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, host=None):
i = 0 i = 0
for cmd in cmds: for cmd in cmds:
cmdC = self.create_component(label + '.' + str(i), shlex.split(cmd), cmdC = self.create_component(
verbose=verbose) label + '.' + str(i), shlex.split(cmd), verbose=verbose
)
await cmdC.start() await cmdC.start()
await cmdC.wait() await cmdC.wait()
...@@ -295,7 +315,9 @@ class Executor(object): ...@@ -295,7 +315,9 @@ class Executor(object):
xs.append(self.await_file(p, *args, **kwargs)) xs.append(self.await_file(p, *args, **kwargs))
await asyncio.wait(xs) await asyncio.wait(xs)
class LocalExecutor(Executor): class LocalExecutor(Executor):
def create_component(self, label, parts, **kwargs): def create_component(self, label, parts, **kwargs):
return SimpleComponent(label, parts, **kwargs) return SimpleComponent(label, parts, **kwargs)
...@@ -322,7 +344,9 @@ class LocalExecutor(Executor): ...@@ -322,7 +344,9 @@ class LocalExecutor(Executor):
elif os.path.exists(path): elif os.path.exists(path):
os.unlink(path) os.unlink(path)
class RemoteExecutor(Executor): class RemoteExecutor(Executor):
def __init__(self, host_name, workdir): def __init__(self, host_name, workdir):
self.host_name = host_name self.host_name = host_name
self.cwd = workdir self.cwd = workdir
...@@ -330,21 +354,33 @@ class RemoteExecutor(Executor): ...@@ -330,21 +354,33 @@ class RemoteExecutor(Executor):
self.scp_extra_args = [] self.scp_extra_args = []
def create_component(self, label, parts, **kwargs): def create_component(self, label, parts, **kwargs):
return SimpleRemoteComponent(self.host_name, label, parts, return SimpleRemoteComponent(
cwd=self.cwd, ssh_extra_args=self.ssh_extra_args, **kwargs) 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): 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('%s.await_file(%s) started' % (self.host_name, path))
to_its = timeout / delay to_its = timeout / delay
loop_cmd = ('i=0 ; while [ ! -e %s ] ; do ' loop_cmd = (
'i=0 ; while [ ! -e %s ] ; do '
'if [ $i -ge %u ] ; then exit 1 ; fi ; ' 'if [ $i -ge %u ] ; then exit 1 ; fi ; '
'sleep %f ; ' 'sleep %f ; '
'i=$(($i+1)) ; done; exit 0') % (path, to_its, delay) 'i=$(($i+1)) ; done; exit 0'
) % (path, to_its, delay)
parts = ['/bin/sh', '-c', loop_cmd] parts = ['/bin/sh', '-c', loop_cmd]
sc = self.create_component("%s.await_file('%s')" % (self.host_name, sc = self.create_component(
path), parts, canfail=False, verbose=verbose) "%s.await_file('%s')" % (self.host_name, path),
parts,
canfail=False,
verbose=verbose
)
await sc.start() await sc.start()
await sc.wait() await sc.wait()
...@@ -357,22 +393,30 @@ class RemoteExecutor(Executor): ...@@ -357,22 +393,30 @@ class RemoteExecutor(Executor):
'UserKnownHostsFile=/dev/null', 'UserKnownHostsFile=/dev/null',
'-o', '-o',
'StrictHostKeyChecking=no' 'StrictHostKeyChecking=no'
] + self.scp_extra_args + [ ] + self.scp_extra_args + [path, '%s:%s' % (self.host_name, path)]
path, sc = SimpleComponent(
'%s:%s' % (self.host_name, path)] "%s.send_file('%s')" % (self.host_name, path),
sc = SimpleComponent("%s.send_file('%s')" % ( parts,
self.host_name, path), parts, canfail=False, verbose=verbose) canfail=False,
verbose=verbose
)
await sc.start() await sc.start()
await sc.wait() await sc.wait()
async def mkdir(self, path, verbose=False): async def mkdir(self, path, verbose=False):
sc = self.create_component("%s.mkdir('%s')" % (self.host_name, path), sc = self.create_component(
['mkdir', '-p', path], canfail=False, verbose=verbose) "%s.mkdir('%s')" % (self.host_name, path), ['mkdir', '-p', path],
canfail=False,
verbose=verbose
)
await sc.start() await sc.start()
await sc.wait() await sc.wait()
async def rmtree(self, path, verbose=False): async def rmtree(self, path, verbose=False):
sc = self.create_component("%s.rmtree('%s')" % (self.host_name, path), sc = self.create_component(
['rm', '-rf', path], canfail=False, verbose=verbose) "%s.rmtree('%s')" % (self.host_name, path), ['rm', '-rf', path],
canfail=False,
verbose=verbose
)
await sc.start() await sc.start()
await sc.wait() await sc.wait()
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
# 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.
import json import json
import time import time
......
...@@ -21,21 +21,28 @@ ...@@ -21,21 +21,28 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import asyncio import asyncio
import shlex
import itertools import itertools
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.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.exectools import Executor, SimpleComponent
from simbricks.proxy import NetProxyConnecter, NetProxyListener, SimProxy from simbricks.proxy import NetProxyConnecter, NetProxyListener, SimProxy
from simbricks.simulators import HostSim, I40eMultiNIC, NICSim, NetSim, PCIDevSim, Simulator from simbricks.simulators import (
import simbricks.utils.graphlib as graphlib HostSim, I40eMultiNIC, NetSim, NICSim, PCIDevSim, Simulator
)
class Experiment(object): 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 name: str
"""This experiment's name. Can be used to filter multiple experiments to be """This experiment's name. Can be used to filter multiple experiments to be
run.""" run."""
...@@ -80,7 +87,7 @@ class Experiment(object): ...@@ -80,7 +87,7 @@ class Experiment(object):
self.networks.append(sim) self.networks.append(sim)
def all_simulators(self): def all_simulators(self):
""" All simulators used in experiment. """ """All simulators used in experiment."""
return itertools.chain(self.hosts, self.pcidevs, self.networks) return itertools.chain(self.hosts, self.pcidevs, self.networks)
def resreq_mem(self): def resreq_mem(self):
...@@ -98,8 +105,9 @@ class Experiment(object): ...@@ -98,8 +105,9 @@ class Experiment(object):
cores += s.resreq_cores() cores += s.resreq_cores()
return cores return cores
class DistributedExperiment(Experiment): class DistributedExperiment(Experiment):
"""Describes a distributed simulation experiment. """ """Describes a distributed simulation experiment."""
num_hosts = 1 num_hosts = 1
"""Number of hosts to use.""" """Number of hosts to use."""
host_mapping: tp.Dict[Simulator, int] host_mapping: tp.Dict[Simulator, int]
...@@ -121,17 +129,17 @@ class DistributedExperiment(Experiment): ...@@ -121,17 +129,17 @@ class DistributedExperiment(Experiment):
self.proxies_connect.append(proxy) self.proxies_connect.append(proxy)
def all_simulators(self): def all_simulators(self):
return itertools.chain(super().all_simulators(), return itertools.chain(
self.proxies_listen, self.proxies_connect) super().all_simulators(), self.proxies_listen, self.proxies_connect
)
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 (host >= 0 and host < self.num_hosts)
self.host_mapping[sim] = host self.host_mapping[sim] = host
def all_sims_assigned(self): 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(): for s in self.all_simulators():
if s not in self.host_mapping: if s not in self.host_mapping:
return False return False
...@@ -140,7 +148,9 @@ class DistributedExperiment(Experiment): ...@@ -140,7 +148,9 @@ class DistributedExperiment(Experiment):
T = tp.TypeVar('T', bound=Experiment) T = tp.TypeVar('T', bound=Experiment)
class ExperimentBaseRunner(tp.Generic[T]): class ExperimentBaseRunner(tp.Generic[T]):
def __init__(self, exp: T, env: ExpEnv, verbose: bool): def __init__(self, exp: T, env: ExpEnv, verbose: bool):
self.exp = exp self.exp = exp
self.env = env self.env = env
...@@ -151,7 +161,7 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -151,7 +161,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
self.wait_sims = [] self.wait_sims = []
def sim_executor(self, sim: Simulator) -> Executor: def sim_executor(self, sim: Simulator) -> Executor:
raise NotImplementedError("Please implement this method") raise NotImplementedError('Please implement this method')
def sim_graph(self): def sim_graph(self):
sims = self.exp.all_simulators() sims = self.exp.all_simulators()
...@@ -164,7 +174,7 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -164,7 +174,7 @@ class ExperimentBaseRunner(tp.Generic[T]):
return graph return graph
async def start_sim(self, sim: Simulator): 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() name = sim.full_name()
if self.verbose: if self.verbose:
...@@ -178,9 +188,9 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -178,9 +188,9 @@ class ExperimentBaseRunner(tp.Generic[T]):
# run simulator # run simulator
exec = self.sim_executor(sim) exec = self.sim_executor(sim)
sc = exec.create_component(name, sc = exec.create_component(
shlex.split(run_cmd), verbose=self.verbose, name, shlex.split(run_cmd), verbose=self.verbose, canfail=True
canfail=True) )
await sc.start() await sc.start()
self.running.append((sim, sc)) self.running.append((sim, sc))
...@@ -216,7 +226,6 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -216,7 +226,6 @@ class ExperimentBaseRunner(tp.Generic[T]):
async def after_cleanup(self): async def after_cleanup(self):
pass pass
async def prepare(self): async def prepare(self):
# generate config tars # generate config tars
copies = [] copies = []
...@@ -233,12 +242,15 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -233,12 +242,15 @@ class ExperimentBaseRunner(tp.Generic[T]):
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 = [pc for pc in sim.prep_cmds(self.env)]
exec = self.sim_executor(sim) exec = self.sim_executor(sim)
sims.append(exec.run_cmdlist('prepare_' + self.exp.name, prep_cmds, sims.append(
verbose=self.verbose)) exec.run_cmdlist(
'prepare_' + self.exp.name, prep_cmds, verbose=self.verbose
)
)
await asyncio.wait(sims) await asyncio.wait(sims)
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('%s: waiting for hosts to terminate' % self.exp.name)
for sc in self.wait_sims: for sc in self.wait_sims:
...@@ -282,24 +294,23 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -282,24 +294,23 @@ class ExperimentBaseRunner(tp.Generic[T]):
# "interrupt, terminate, kill" all processes # "interrupt, terminate, kill" all processes
scs = [] scs = []
for _,sc in self.running: for _, sc in self.running:
scs.append(sc.int_term_kill()) scs.append(sc.int_term_kill())
await asyncio.wait(scs) await asyncio.wait(scs)
# wait for all processes to terminate # wait for all processes to terminate
for _,sc in self.running: for _, sc in self.running:
await sc.wait() await sc.wait()
# remove all sockets # remove all sockets
scs = [] scs = []
for (exec,sock) in self.sockets: for (exec, sock) in self.sockets:
scs.append(exec.rmtree(sock)) scs.append(exec.rmtree(sock))
if len(scs): if len(scs):
await asyncio.wait(scs) await asyncio.wait(scs)
# add all simulator components to the output # 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) self.out.add_sim(sim, sc)
await self.after_cleanup() await self.after_cleanup()
...@@ -307,7 +318,8 @@ class ExperimentBaseRunner(tp.Generic[T]): ...@@ -307,7 +318,8 @@ 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: Executor, *args, **kwargs):
self.exec = exec self.exec = exec
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
...@@ -317,7 +329,8 @@ class ExperimentSimpleRunner(ExperimentBaseRunner[Experiment]): ...@@ -317,7 +329,8 @@ class ExperimentSimpleRunner(ExperimentBaseRunner[Experiment]):
class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]): class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]):
""" Simple experiment runner with just one executor. """ """Simple experiment runner with just one executor."""
def __init__(self, execs, *args, **kwargs): def __init__(self, execs, *args, **kwargs):
self.execs = execs self.execs = execs
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
...@@ -329,11 +342,12 @@ class ExperimentDistributedRunner(ExperimentBaseRunner[DistributedExperiment]): ...@@ -329,11 +342,12 @@ 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 = self.sim_executor(p)
p.ip = exec.ip p.ip = exec.ip
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +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.
import tarfile
import io import io
import tarfile
class AppConfig(object): class AppConfig(object):
...@@ -145,19 +145,26 @@ class LinuxNode(NodeConfig): ...@@ -145,19 +145,26 @@ class LinuxNode(NodeConfig):
else: else:
l.append('modprobe ' + d) l.append('modprobe ' + d)
if self.force_mac_addr: if self.force_mac_addr:
l.append('ip link set dev ' + self.ifname + ' address ' + l.append(
self.force_mac_addr) 'ip link set dev ' + self.ifname + ' address ' +
self.force_mac_addr
)
l.append('ip link set dev ' + self.ifname + ' up') l.append('ip link set dev ' + self.ifname + ' up')
l.append('ip addr add %s/%d dev %s' % l.append(
(self.ip, self.prefix, 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
class I40eLinuxNode(LinuxNode): class I40eLinuxNode(LinuxNode):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.drivers.append('i40e') self.drivers.append('i40e')
class CorundumLinuxNode(LinuxNode): class CorundumLinuxNode(LinuxNode):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.drivers.append('/tmp/guest/mqnic.ko') self.drivers.append('/tmp/guest/mqnic.ko')
...@@ -166,7 +173,9 @@ class CorundumLinuxNode(LinuxNode): ...@@ -166,7 +173,9 @@ class CorundumLinuxNode(LinuxNode):
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()}
class E1000LinuxNode(LinuxNode): class E1000LinuxNode(LinuxNode):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.drivers.append('e1000') self.drivers.append('e1000')
...@@ -202,20 +211,26 @@ class MtcpNode(NodeConfig): ...@@ -202,20 +211,26 @@ class MtcpNode(NodeConfig):
] ]
def config_files(self): def config_files(self):
m = {'mtcp.conf': self.strfile("io = dpdk\n" m = {
"num_cores = " + str(self.cores) + "\n" 'mtcp.conf':
"num_mem_ch = 4\n" self.strfile(
"port = dpdk0\n" 'io = dpdk\n'
"max_concurrency = 4096\n" 'num_cores = ' + str(self.cores) + '\n'
"max_num_buffers = 4096\n" 'num_mem_ch = 4\n'
"rcvbuf = 8192\n" 'port = dpdk0\n'
"sndbuf = 8192\n" 'max_concurrency = 4096\n'
"tcp_timeout = 10\n" 'max_num_buffers = 4096\n'
"tcp_timewait = 0\n" 'rcvbuf = 8192\n'
"#stat_print = dpdk0\n")} 'sndbuf = 8192\n'
'tcp_timeout = 10\n'
'tcp_timewait = 0\n'
'#stat_print = dpdk0\n'
)
}
return {**m, **super().config_files()} return {**m, **super().config_files()}
class TASNode(NodeConfig): class TASNode(NodeConfig):
disk_image = 'tas' disk_image = 'tas'
pci_dev = '0000:00:02.0' pci_dev = '0000:00:02.0'
...@@ -241,8 +256,8 @@ class TASNode(NodeConfig): ...@@ -241,8 +256,8 @@ 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 &' % ( 'tas/tas --ip-addr=%s/%d --fp-cores-max=%d --fp-no-ints &' %
self.ip, self.prefix, self.fp_cores), (self.ip, self.prefix, self.fp_cores),
'sleep 1' 'sleep 1'
] ]
...@@ -251,8 +266,8 @@ class TASNode(NodeConfig): ...@@ -251,8 +266,8 @@ class TASNode(NodeConfig):
return cmds return cmds
class I40eDCTCPNode(NodeConfig): class I40eDCTCPNode(NodeConfig):
def prepare_pre_cp(self): def prepare_pre_cp(self):
return super().prepare_pre_cp() + [ return super().prepare_pre_cp() + [
'mount -t proc proc /proc', 'mount -t proc proc /proc',
...@@ -269,7 +284,6 @@ class I40eDCTCPNode(NodeConfig): ...@@ -269,7 +284,6 @@ class I40eDCTCPNode(NodeConfig):
'sysctl -w net.ipv4.tcp_ecn=1' 'sysctl -w net.ipv4.tcp_ecn=1'
] ]
def prepare_post_cp(self): def prepare_post_cp(self):
return super().prepare_post_cp() + [ return super().prepare_post_cp() + [
'modprobe i40e', 'modprobe i40e',
...@@ -280,7 +294,9 @@ class I40eDCTCPNode(NodeConfig): ...@@ -280,7 +294,9 @@ class I40eDCTCPNode(NodeConfig):
f'ip addr add {self.ip}/{self.prefix} dev eth0', f'ip addr add {self.ip}/{self.prefix} dev eth0',
] ]
class CorundumDCTCPNode(NodeConfig): class CorundumDCTCPNode(NodeConfig):
def prepare_pre_cp(self): def prepare_pre_cp(self):
return super().prepare_pre_cp() + [ return super().prepare_pre_cp() + [
'mount -t proc proc /proc', 'mount -t proc proc /proc',
...@@ -297,7 +313,6 @@ class CorundumDCTCPNode(NodeConfig): ...@@ -297,7 +313,6 @@ class CorundumDCTCPNode(NodeConfig):
'sysctl -w net.ipv4.tcp_ecn=1' 'sysctl -w net.ipv4.tcp_ecn=1'
] ]
def prepare_post_cp(self): def prepare_post_cp(self):
return super().prepare_post_cp() + [ return super().prepare_post_cp() + [
'insmod mqnic.ko', 'insmod mqnic.ko',
...@@ -307,6 +322,7 @@ class CorundumDCTCPNode(NodeConfig): ...@@ -307,6 +322,7 @@ class CorundumDCTCPNode(NodeConfig):
class LinuxFEMUNode(NodeConfig): class LinuxFEMUNode(NodeConfig):
def __init__(self): def __init__(self):
self.drivers = ['nvme'] self.drivers = ['nvme']
...@@ -319,46 +335,62 @@ class LinuxFEMUNode(NodeConfig): ...@@ -319,46 +335,62 @@ class LinuxFEMUNode(NodeConfig):
l.append('modprobe ' + d) l.append('modprobe ' + d)
return super().prepare_post_cp() + l return super().prepare_post_cp() + l
class NVMEFsTest(AppConfig): class NVMEFsTest(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['mount -t proc proc /proc', return [
'mount -t proc proc /proc',
'mkfs.ext3 /dev/nvme0n1', 'mkfs.ext3 /dev/nvme0n1',
'mount /dev/nvme0n1 /mnt', 'mount /dev/nvme0n1 /mnt',
'dd if=/dev/urandom of=/mnt/foo bs=1024 count=1024'] 'dd if=/dev/urandom of=/mnt/foo bs=1024 count=1024'
]
class DctcpServer(AppConfig): class DctcpServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['iperf -s -w 1M -Z dctcp'] return ['iperf -s -w 1M -Z dctcp']
class DctcpClient(AppConfig): class DctcpClient(AppConfig):
server_ip = '192.168.64.1' server_ip = '192.168.64.1'
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 ['sleep 1', return [
'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',
'sleep 2' 'sleep 2'
] ]
else: else:
return ['sleep 1', return [
'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',
'sleep 20' 'sleep 20'
] ]
class PingClient(AppConfig): class PingClient(AppConfig):
server_ip = '192.168.64.1' server_ip = '192.168.64.1'
def run_cmds(self, node): def run_cmds(self, node):
return [f'ping {self.server_ip} -c 100'] return [f'ping {self.server_ip} -c 100']
class IperfTCPServer(AppConfig): class IperfTCPServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['iperf -s -l 32M -w 32M'] return ['iperf -s -l 32M -w 32M']
class IperfUDPServer(AppConfig): class IperfUDPServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['iperf -s -u'] return ['iperf -s -u']
class IperfTCPClient(AppConfig): class IperfTCPClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
procs = 1 procs = 1
...@@ -366,23 +398,28 @@ class IperfTCPClient(AppConfig): ...@@ -366,23 +398,28 @@ class IperfTCPClient(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
cmds = ['sleep 1', cmds = [
'sleep 1',
'iperf -l 32M -w 32M -c ' + self.server_ip + ' -i 1 -P ' + 'iperf -l 32M -w 32M -c ' + self.server_ip + ' -i 1 -P ' +
str(self.procs)] str(self.procs)
]
if self.is_last: if self.is_last:
cmds.append('sleep 0.5') cmds.append('sleep 0.5')
else: else:
cmds.append('sleep 10') cmds.append('sleep 10')
return cmds return cmds
class IperfUDPClient(AppConfig): class IperfUDPClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
rate = '150m' rate = '150m'
is_last = False is_last = False
def run_cmds(self, node): def run_cmds(self, node):
cmds = ['sleep 1', cmds = [
'iperf -c ' + self.server_ip + ' -i 1 -u -b ' + self.rate] 'sleep 1',
'iperf -c ' + self.server_ip + ' -i 1 -u -b ' + self.rate
]
if self.is_last: if self.is_last:
cmds.append('sleep 0.5') cmds.append('sleep 0.5')
...@@ -391,31 +428,30 @@ class IperfUDPClient(AppConfig): ...@@ -391,31 +428,30 @@ class IperfUDPClient(AppConfig):
return cmds return cmds
class IperfUDPShortClient(AppConfig): class IperfUDPShortClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
rate = '150m' rate = '150m'
is_last = False is_last = False
def run_cmds(self, node): def run_cmds(self, node):
cmds = ['sleep 1', cmds = ['sleep 1', 'iperf -c ' + self.server_ip + ' -u -n 1 ']
'iperf -c ' + self.server_ip + ' -u -n 1 ']
return cmds return cmds
class IperfUDPClientSleep(AppConfig): class IperfUDPClientSleep(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
rate = '150m' rate = '150m'
def run_cmds(self, node): def run_cmds(self, node):
return ['sleep 1', return ['sleep 1', 'sleep 10']
'sleep 10'
]
class NoTraffic(AppConfig): class NoTraffic(AppConfig):
is_sleep = 1 is_sleep = 1
is_server = 0 is_server = 0
def run_cmds(self, node): def run_cmds(self, node):
cmds = [] cmds = []
if (self.is_server): if (self.is_server):
...@@ -429,42 +465,58 @@ class NoTraffic(AppConfig): ...@@ -429,42 +465,58 @@ class NoTraffic(AppConfig):
return cmds return cmds
class NetperfServer(AppConfig): class NetperfServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['netserver', return ['netserver', 'sleep infinity']
'sleep infinity']
class NetperfClient(AppConfig): class NetperfClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
duration_tp = 10 duration_tp = 10
duration_lat = 10 duration_lat = 10
def run_cmds(self, node): def run_cmds(self, node):
return ['netserver', 'sleep 0.5', return ['netserver', 'sleep 0.5',
'netperf -H ' + self.server_ip + ' -l ' + str(self.duration_tp), 'netperf -H ' + self.server_ip + ' -l ' + str(self.duration_tp),
'netperf -H ' + self.server_ip + ' -l ' + str(self.duration_lat) + \ 'netperf -H ' + self.server_ip + ' -l ' + str(self.duration_lat) + \
' -t TCP_RR -- -o mean_latency,p50_latency,p90_latency,p99_latency'] ' -t TCP_RR -- -o mean_latency,p50_latency,p90_latency,p99_latency']
class VRReplica(AppConfig): class VRReplica(AppConfig):
index = 0 index = 0
def run_cmds(self, node): def run_cmds(self, node):
return ['/root/nopaxos/bench/replica -c /root/nopaxos.config -i ' + return [
str(self.index) + ' -m vr'] '/root/nopaxos/bench/replica -c /root/nopaxos.config -i ' +
str(self.index) + ' -m vr'
]
class VRClient(AppConfig): class VRClient(AppConfig):
server_ips = [] server_ips = []
def run_cmds(self, node): def run_cmds(self, node):
cmds = [] cmds = []
for ip in self.server_ips: for ip in self.server_ips:
cmds.append('ping -c 2 ' + ip) cmds.append('ping -c 2 ' + ip)
cmds.append('/root/nopaxos/bench/client -c /root/nopaxos.config ' + cmds.append(
'-m vr -u 2 -h ' + node.ip) '/root/nopaxos/bench/client -c /root/nopaxos.config ' +
'-m vr -u 2 -h ' + node.ip
)
return cmds return cmds
class NOPaxosReplica(AppConfig): class NOPaxosReplica(AppConfig):
index = 0 index = 0
def run_cmds(self, node): def run_cmds(self, node):
return ['/root/nopaxos/bench/replica -c /root/nopaxos.config -i ' + return [
str(self.index) + ' -m nopaxos'] '/root/nopaxos/bench/replica -c /root/nopaxos.config -i ' +
str(self.index) + ' -m nopaxos'
]
class NOPaxosClient(AppConfig): class NOPaxosClient(AppConfig):
server_ips = [] server_ips = []
...@@ -486,9 +538,13 @@ class NOPaxosClient(AppConfig): ...@@ -486,9 +538,13 @@ class NOPaxosClient(AppConfig):
cmds.append('sleep infinity') cmds.append('sleep infinity')
return cmds return cmds
class NOPaxosSequencer(AppConfig): class NOPaxosSequencer(AppConfig):
def run_cmds(self, node): 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): class RPCServer(AppConfig):
...@@ -500,9 +556,12 @@ class RPCServer(AppConfig): ...@@ -500,9 +556,12 @@ class RPCServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
exe = 'echoserver_linux' if not isinstance(node, MtcpNode) else \ exe = 'echoserver_linux' if not isinstance(node, MtcpNode) else \
'echoserver_mtcp' 'echoserver_mtcp'
return ['cd /root/tasbench/micro_rpc', return [
'./%s %d %d /tmp/guest/mtcp.conf %d %d' % (exe, self.port, 'cd /root/tasbench/micro_rpc',
self.threads, self.max_flows, self.max_bytes)] './%s %d %d /tmp/guest/mtcp.conf %d %d' %
(exe, self.port, self.threads, self.max_flows, self.max_bytes)
]
class RPCClient(AppConfig): class RPCClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
...@@ -519,16 +578,27 @@ class RPCClient(AppConfig): ...@@ -519,16 +578,27 @@ class RPCClient(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
exe = 'testclient_linux' if not isinstance(node, MtcpNode) else \ exe = 'testclient_linux' if not isinstance(node, MtcpNode) else \
'testclient_mtcp' 'testclient_mtcp'
return ['cd /root/tasbench/micro_rpc', return [
'./%s %s %d %d /tmp/guest/mtcp.conf %d %d %d %d %d %d &' % (exe, 'cd /root/tasbench/micro_rpc',
self.server_ip, self.port, self.threads, self.max_bytes, './%s %s %d %d /tmp/guest/mtcp.conf %d %d %d %d %d %d &' % (
self.max_pending, self.max_flows, self.openall_delay, exe,
self.max_msgs_conn, self.max_pend_conns), self.server_ip,
'sleep %d' % (self.time)] 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): class HTTPD(AppConfig):
threads = 1 threads = 1
file_size = 64 file_size = 64
...@@ -545,12 +615,15 @@ class HTTPD(AppConfig): ...@@ -545,12 +615,15 @@ class HTTPD(AppConfig):
'./lighttpd -D -f ../doc/config/%s -n %d -m ./.libs/' % \ './lighttpd -D -f ../doc/config/%s -n %d -m ./.libs/' % \
(self.mtcp_config, self.threads)] (self.mtcp_config, self.threads)]
class HTTPDLinux(HTTPD): class HTTPDLinux(HTTPD):
httpd_dir = '/root/mtcp/apps/lighttpd-mtlinux' httpd_dir = '/root/mtcp/apps/lighttpd-mtlinux'
class HTTPDLinuxRPO(HTTPD): class HTTPDLinuxRPO(HTTPD):
httpd_dir = '/root/mtcp/apps/lighttpd-mtlinux-rop' httpd_dir = '/root/mtcp/apps/lighttpd-mtlinux-rop'
class HTTPDMtcp(HTTPD): class HTTPDMtcp(HTTPD):
httpd_dir = '/root/mtcp/apps/lighttpd-mtcp' httpd_dir = '/root/mtcp/apps/lighttpd-mtcp'
mtcp_config = 'm-lighttpd.conf' mtcp_config = 'm-lighttpd.conf'
...@@ -578,9 +651,11 @@ class HTTPC(AppConfig): ...@@ -578,9 +651,11 @@ class HTTPC(AppConfig):
(self.threads, self.conns, self.requests, self.server_ip, (self.threads, self.conns, self.requests, self.server_ip,
self.url)] self.url)]
class HTTPCLinux(HTTPC): class HTTPCLinux(HTTPC):
ab_dir = '/root/mtcp/apps/ab-linux' ab_dir = '/root/mtcp/apps/ab-linux'
class HTTPCMtcp(HTTPC): class HTTPCMtcp(HTTPC):
ab_dir = '/root/mtcp/apps/ab-mtcp' ab_dir = '/root/mtcp/apps/ab-mtcp'
...@@ -593,15 +668,20 @@ class HTTPCMtcp(HTTPC): ...@@ -593,15 +668,20 @@ class HTTPCMtcp(HTTPC):
class MemcachedServer(AppConfig): class MemcachedServer(AppConfig):
def run_cmds(self, node): def run_cmds(self, node):
return ['memcached -u root -t 1 -c 4096'] return ['memcached -u root -t 1 -c 4096']
class MemcachedClient(AppConfig): class MemcachedClient(AppConfig):
server_ips = ['10.0.0.1'] server_ips = ['10.0.0.1']
threads = 1 threads = 1
concurrency = 1 concurrency = 1
throughput = '1k' throughput = '1k'
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 [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'
]
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
from simbricks.simulators import Simulator from simbricks.simulators import Simulator
class SimProxy(Simulator): class SimProxy(Simulator):
name = '' name = ''
# set by the experiment runner # set by the experiment runner
...@@ -34,8 +35,9 @@ class SimProxy(Simulator): ...@@ -34,8 +35,9 @@ class SimProxy(Simulator):
def full_name(self): def full_name(self):
return 'proxy.' + self.name return 'proxy.' + self.name
class NetProxy(SimProxy): class NetProxy(SimProxy):
""" Proxy for connections between NICs and networks. """ """Proxy for connections between NICs and networks."""
# List of tuples (nic, with_listener) # List of tuples (nic, with_listener)
nics = None nics = None
...@@ -51,6 +53,7 @@ class NetProxy(SimProxy): ...@@ -51,6 +53,7 @@ class NetProxy(SimProxy):
def start_delay(self): def start_delay(self):
return 10 return 10
class NetProxyListener(NetProxy): class NetProxyListener(NetProxy):
port = 12345 port = 12345
connecter = None connecter = None
...@@ -120,6 +123,7 @@ class NetProxyListener(NetProxy): ...@@ -120,6 +123,7 @@ class NetProxyListener(NetProxy):
cmd += f' 0.0.0.0 {self.port}' cmd += f' 0.0.0.0 {self.port}'
return cmd return cmd
class NetProxyConnecter(NetProxy): class NetProxyConnecter(NetProxy):
listener = None listener = None
...@@ -189,6 +193,7 @@ class NetProxyConnecter(NetProxy): ...@@ -189,6 +193,7 @@ class NetProxyConnecter(NetProxy):
class RDMANetProxyListener(NetProxyListener): class RDMANetProxyListener(NetProxyListener):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
...@@ -197,7 +202,9 @@ class RDMANetProxyListener(NetProxyListener): ...@@ -197,7 +202,9 @@ class RDMANetProxyListener(NetProxyListener):
cmd += super().run_cmd_base(env) cmd += super().run_cmd_base(env)
return cmd return cmd
class RDMANetProxyConnecter(NetProxyConnecter): class RDMANetProxyConnecter(NetProxyConnecter):
def __init__(self, listener): def __init__(self, listener):
super().__init__(listener) super().__init__(listener)
...@@ -208,6 +215,7 @@ class RDMANetProxyConnecter(NetProxyConnecter): ...@@ -208,6 +215,7 @@ class RDMANetProxyConnecter(NetProxyConnecter):
class SocketsNetProxyListener(NetProxyListener): class SocketsNetProxyListener(NetProxyListener):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
...@@ -216,7 +224,9 @@ class SocketsNetProxyListener(NetProxyListener): ...@@ -216,7 +224,9 @@ class SocketsNetProxyListener(NetProxyListener):
cmd += super().run_cmd_base(env) cmd += super().run_cmd_base(env)
return cmd return cmd
class SocketsNetProxyConnecter(NetProxyConnecter): class SocketsNetProxyConnecter(NetProxyConnecter):
def __init__(self, listener): def __init__(self, listener):
super().__init__(listener) super().__init__(listener)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
# 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 simbricks.runtime.common import (Run, Runtime) from simbricks.runtime.common import Run, Runtime
from simbricks.runtime.local import (LocalSimpleRuntime, LocalParallelRuntime) from simbricks.runtime.distributed import DistributedSimpleRuntime, auto_dist
from simbricks.runtime.local import LocalParallelRuntime, LocalSimpleRuntime
from simbricks.runtime.slurm import SlurmRuntime from simbricks.runtime.slurm import SlurmRuntime
from simbricks.runtime.distributed import (DistributedSimpleRuntime, auto_dist)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment