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)
...@@ -37,11 +36,10 @@ for app_type in app_types: ...@@ -37,11 +36,10 @@ for app_type in app_types:
host_class = sim.Gem5Host host_class = sim.Gem5Host
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
host = host_class() host = host_class()
host.name = 'host.0' host.name = 'host.0'
node_config = nc_class() node_config = nc_class()
...@@ -49,22 +47,17 @@ for app_type in app_types: ...@@ -49,22 +47,17 @@ for app_type in app_types:
node_config.app = node.NoTraffic() node_config.app = node.NoTraffic()
node_config.cores = 1 node_config.cores = 1
# is busy # is busy
if app_type == 'sleep': if app_type == 'sleep':
node_config.app.is_sleep = 1 node_config.app.is_sleep = 1
else: else:
node_config.app.is_sleep = 0 node_config.app.is_sleep = 0
host.set_config(node_config) host.set_config(node_config)
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
...@@ -92,35 +96,38 @@ for host_type in host_types: ...@@ -92,35 +96,38 @@ for host_type in host_types:
""" """
servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class, servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class,
nc_class, node.NoTraffic) nc_class, node.NoTraffic)
for s in servers: for s in servers:
s.node_config.cores = num_cores s.node_config.cores = num_cores
s.node_config.app.is_sleep = 0 s.node_config.app.is_sleep = 0
s.node_config.app.is_server = 1 s.node_config.app.is_server = 1
""" """
clients = create_basic_hosts(
clients = create_basic_hosts(e, n_client, 'client', net, nic_class, host_class, e,
nc_class, node.NoTraffic, ip_start=2) 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: for c in clients:
c.node_config.cores = num_cores c.node_config.cores = num_cores
# is busy # is busy
if app_type == 'sleep': if app_type == 'sleep':
c.node_config.app.is_sleep = 1 c.node_config.app.is_sleep = 1
else: else:
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']
...@@ -33,7 +34,7 @@ num_client_configs = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12] ...@@ -33,7 +34,7 @@ num_client_configs = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12]
experiments = [] experiments = []
sync_period = 200 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 ' link_latency_opt = '--LinkLatency=500ns '
for proto_config in proto_configs: for proto_config in proto_configs:
...@@ -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:
...@@ -66,8 +66,10 @@ for internal in [True, False]: ...@@ -66,8 +66,10 @@ for internal in [True, False]:
for h in [client, server]: for h in [client, server]:
h.cpu_type = h.cpu_type_cp = 'TimingSimpleCPU' h.cpu_type = h.cpu_type_cp = 'TimingSimpleCPU'
h.variant = 'opt' # need opt gem5 variant with debug support h.variant = 'opt' # need opt gem5 variant with debug support
h.extra_main_args.append('--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,39 +51,84 @@ for n in kinds_of_net: ...@@ -51,39 +51,84 @@ 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()
e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'TCPm') e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'TCPm')
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
cl.node_config.app.server_ip = servers[0].node_config.ip cl.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_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,37 +53,83 @@ for n in kinds_of_net: ...@@ -53,37 +53,83 @@ 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()
e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'TCPs') e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'TCPs')
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,35 +53,81 @@ for n in kinds_of_net: ...@@ -53,35 +53,81 @@ 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()
e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'UDPm') e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'UDPm')
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
cl.node_config.app.server_ip = servers[0].node_config.ip cl.node_config.app.server_ip = servers[0].node_config.ip
...@@ -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,33 +55,80 @@ for n in kinds_of_net: ...@@ -55,33 +55,80 @@ 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()
e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'UDPs') e = exp.Experiment('qemu-' + c + '-' + n + '-' + 'UDPs')
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']
...@@ -32,38 +32,49 @@ num_clients = 1 ...@@ -32,38 +32,49 @@ 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(
net = sim.SwitchNet() 'qemu-ib-switch-rpc-%s-1t-1fpc-%db-0mpc' % (stack, msg_size)
e.add_network(net) )
net = sim.SwitchNet()
if stack == 'tas': e.add_network(net)
n = node.TASNode
elif stack == 'mtcp':
n = node.MtcpNode
else:
n = node.I40eLinuxNode
servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, if stack == 'tas':
n, node.RPCServer) n = node.TASNode
elif stack == 'mtcp':
n = node.MtcpNode
else:
n = node.I40eLinuxNode
clients = create_basic_hosts(e, num_clients, 'client', net, sim.I40eNIC, servers = create_basic_hosts(
sim.QemuHost, n, node.RPCClient, ip_start = 2) e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, n, node.RPCServer
)
for h in servers + clients: clients = create_basic_hosts(
h.node_config.cores = 1 if stack != 'tas' else 3 e,
h.node_config.fp_cores = 1 num_clients,
h.node_config.app.threads = 1 'client',
h.node_config.app.max_bytes = msg_size net,
sim.I40eNIC,
sim.QemuHost,
n,
node.RPCClient,
ip_start=2
)
if stack == 'linux': for h in servers + clients:
h.node_config.disk_image = 'tas' 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: servers[0].sleep = 5
c.wait = True
c.node_config.app.server_ip = servers[0].node_config.ip
experiments.append(e) for c in clients:
c.wait = True
c.node_config.app.server_ip = servers[0].node_config.ip
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, )
default=False, parser.add_argument(
help='Read exp files as pickled runs instead of exp.py files') '--list',
parser.add_argument('--runs', metavar='N', type=int, default=1, action='store_const',
help='Number of repetition for each experiment') const=True,
parser.add_argument('--firstrun', metavar='N', type=int, default=1, default=False,
help='ID for first run') help='Only list available experiment names'
parser.add_argument('--force', action='store_const', const=True, default=False, )
help='Run experiments even if output already exists') parser.add_argument(
parser.add_argument('--verbose', action='store_const', const=True, '--filter',
default=False, metavar='PATTERN',
help='Verbose output') type=str,
parser.add_argument('--pcap', action='store_const', const=True, default=False, nargs='+',
help='Dump pcap file (if supported by simulator)') 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 = 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',
default=len(os.sched_getaffinity(0)), const='parallel',
help='Number of cores to use for parallel runs') default='sequential',
g_par.add_argument('--mem', metavar='N', type=int, default=None, help='Use parallel instead of sequential runtime'
help='Memory limit for parallel runs (in MB)') )
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 = 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',
default=False, const='dist',
help='Automatically distribute non-distributed experiments') default='sequential',
g_dist.add_argument('--proxy-type', metavar='TYPE', type=str, help='Use sequential distributed runtime instead of local'
default='sockets', )
help='Proxy type to use (sockets,rdma) for auto distribution') 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() 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
...@@ -213,9 +328,9 @@ if not args.pickled: ...@@ -213,9 +328,9 @@ if not args.pickled:
# if this is an experiment with a checkpoint we might have to create it # if this is an experiment with a checkpoint we might have to create it
if e.no_simbricks: if e.no_simbricks:
no_simbricks = True no_simbricks = True
else: else:
no_simbricks = False no_simbricks = False
if e.checkpoint: if e.checkpoint:
prereq = add_exp(e, 0, None, True, False, no_simbricks) prereq = add_exp(e, 0, None, True, False, no_simbricks)
else: else:
......
...@@ -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(
self._read_stream(self.proc.stdout, self._consume_out), asyncio.wait([
self._read_stream(self.proc.stderr, self._consume_err)])) self._read_stream(self.proc.stdout, self._consume_out),
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,11 +117,12 @@ class Component(object): ...@@ -111,11 +117,12 @@ 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(
stdout=asyncio.subprocess.PIPE, *self.cmd_parts,
stderr=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stdin=stdin, stderr=asyncio.subprocess.PIPE,
) stdin=stdin,
)
self.terminate_future = asyncio.ensure_future(self._waiter()) self.terminate_future = asyncio.ensure_future(self._waiter())
await self.started() await self.started()
...@@ -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 = (
'if [ $i -ge %u ] ; then exit 1 ; fi ; ' 'i=0 ; while [ ! -e %s ] ; do '
'sleep %f ; ' 'if [ $i -ge %u ] ; then exit 1 ; fi ; '
'i=$(($i+1)) ; done; exit 0') % (path, to_its, delay) 'sleep %f ; '
'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
...@@ -59,4 +58,4 @@ class ExpOutput(object): ...@@ -59,4 +58,4 @@ class ExpOutput(object):
def loads(self, json_s): def loads(self, json_s):
for k, v in json.loads(json_s).items(): for k, v in json.loads(json_s).items():
self.__dict__[k] = v self.__dict__[k] = v
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -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