Commit d6f58633 authored by Hejing Li's avatar Hejing Li
Browse files

homa_simple_ping.py: add host sim & workload choice

parent 3e8e34aa
...@@ -28,55 +28,77 @@ The client pings the server. ...@@ -28,55 +28,77 @@ The client pings the server.
from simbricks.orchestration.experiments import Experiment from simbricks.orchestration.experiments import Experiment
from simbricks.orchestration.nodeconfig import ( from simbricks.orchestration.nodeconfig import (
HomaClientNode, HomaServerNode, I40eLinuxNode, IdleHost, PingClient HomaClientNode, HomaServerNode, I40eLinuxNode, IdleHost, PingClient, NodeConfig
) )
from simbricks.orchestration.simulators import QemuHost, Gem5Host, I40eNIC, SwitchNet from simbricks.orchestration.simulators import QemuHost, Gem5Host, I40eNIC, SwitchNet
e = Experiment(name='simple_homa') experiments = []
e.checkpoint = False # use checkpoint and restore to speed up simulation workload = [1,2,3,4,5]
host_types = ['qemu', 'gem5', 'qt']
for w in workload:
for host_type in host_types:
# create client e = Experiment(f'single_homa_w{w}_' + host_type)
client_config = I40eLinuxNode() # boot Linux with i40e NIC driver e.checkpoint = False # use checkpoint and restore to speed up simulation
client_config.disk_image = 'homa' # host
client_config.ip = '10.0.0.1' if host_type == 'qemu':
client_config.app = HomaClientNode() HostClass = QemuHost
client = QemuHost(client_config) elif host_type == 'qt':
client.sync = True
client.name = 'client'
client.wait = True # wait for client simulator to finish execution
e.add_host(client)
# attach client's NIC def qemu_timing(node_config: NodeConfig):
client_nic = I40eNIC() h = QemuHost(node_config)
e.add_nic(client_nic) h.sync = True
client.add_nic(client_nic) return h
# create server HostClass = qemu_timing
server_config = I40eLinuxNode() # boot Linux with i40e NIC driver elif host_type == 'gem5':
server_config.disk_image = 'homa' HostClass = Gem5Host
server_config.ip = '10.0.0.2' e.checkpoint = True
server_config.app = HomaServerNode() else:
server = QemuHost(server_config) raise NameError(host_type)
server.sync = True
server.name = 'server'
# server.wait = True
e.add_host(server)
# attach server's NIC # create client
server_nic = I40eNIC() client_config = I40eLinuxNode() # boot Linux with i40e NIC driver
e.add_nic(server_nic) client_config.disk_image = 'homa'
server.add_nic(server_nic) client_config.ip = '10.0.0.1'
client_config.app = HomaClientNode()
client = HostClass(client_config)
# client.sync = False
client.name = 'client'
client.wait = True # wait for client simulator to finish execution
e.add_host(client)
# connect NICs over network # attach client's NIC
network = SwitchNet() client_nic = I40eNIC()
e.add_network(network) e.add_nic(client_nic)
client_nic.set_network(network) client.add_nic(client_nic)
server_nic.set_network(network)
# set more interesting link latencies than default # create server
eth_latency = 500 * 10**3 # 500 us server_config = I40eLinuxNode() # boot Linux with i40e NIC driver
network.eth_latency = eth_latency server_config.disk_image = 'homa'
client_nic.eth_latency = eth_latency server_config.ip = '10.0.0.2'
server_nic.eth_latency = eth_latency server_config.app = HomaServerNode()
server = HostClass(server_config)
# server.sync = False
server.name = 'server'
# server.wait = True
e.add_host(server)
experiments = [e] # attach server's NIC
server_nic = I40eNIC()
e.add_nic(server_nic)
server.add_nic(server_nic)
# connect NICs over network
network = SwitchNet()
e.add_network(network)
client_nic.set_network(network)
server_nic.set_network(network)
# set more interesting link latencies than default
eth_latency = 500 # 500 us
network.eth_latency = eth_latency
client_nic.eth_latency = eth_latency
server_nic.eth_latency = eth_latency
experiments.append(e)
...@@ -417,7 +417,7 @@ class HomaCluster(AppConfig): ...@@ -417,7 +417,7 @@ class HomaCluster(AppConfig):
cmd.append(f'/root/homa/util/cp_node server --protocol homa & ') cmd.append(f'/root/homa/util/cp_node server --protocol homa & ')
cmd.append('sleep 5') cmd.append('sleep 5')
cmd.append(f'/root/homa/util/cp_node client --protocol homa --workload w4 --first-server 0 --server-nodes {self.cluster_size} --id {self.id} &') cmd.append(f'/root/homa/util/cp_node client --protocol homa --workload w2 --client-max 50 --first-server 0 --server-nodes {self.cluster_size} --id {self.id} &')
cmd.append('sleep 10') cmd.append('sleep 10')
cmd.append('pkill cp_node') cmd.append('pkill cp_node')
...@@ -449,6 +449,7 @@ class HomaClientNode(AppConfig): ...@@ -449,6 +449,7 @@ class HomaClientNode(AppConfig):
super().__init__() super().__init__()
self.id = 0 self.id = 0
self.cluster_size = 2 self.cluster_size = 2
self.workload = 2
def prepare_post_cp(self) -> tp.List[str]: def prepare_post_cp(self) -> tp.List[str]:
return super().prepare_post_cp() + [ return super().prepare_post_cp() + [
...@@ -460,15 +461,16 @@ class HomaClientNode(AppConfig): ...@@ -460,15 +461,16 @@ class HomaClientNode(AppConfig):
return {**m, **super().config_files()} return {**m, **super().config_files()}
def run_cmds(self, node: NodeConfig) -> tp.List[str]: def run_cmds(self, node: NodeConfig) -> tp.List[str]:
return [ cmd = []
'mount -t sysfs sysfs /sys', cmd.append('mount -t sysfs sysfs /sys')
'mount -t proc proc /proc', cmd.append('mount -t proc proc /proc')
'/root/homa/util/cp_node client --protocol homa', cmd.append('sleep 1')
# 'touch /root/homa/util/client.tt', cmd.append(f'/root/homa/util/cp_node client --protocol homa --workload w{self.workload} &')
# 'sleep 1', cmd.append('sleep 10')
# '/root/homa/util/ttprint.py > /root/homa/util/client.tt', cmd.append('pkill cp_node')
# 'pkill cp_node', return cmd
] # 'touch /root/homa/util/client.tt'
# '/root/homa/util/ttprint.py > /root/homa/util/client.tt'
class HomaServerNode(AppConfig): class HomaServerNode(AppConfig):
...@@ -482,18 +484,18 @@ class HomaServerNode(AppConfig): ...@@ -482,18 +484,18 @@ class HomaServerNode(AppConfig):
return {**m, **super().config_files()} return {**m, **super().config_files()}
def run_cmds(self, node: NodeConfig) -> tp.List[str]: def run_cmds(self, node: NodeConfig) -> tp.List[str]:
return [ cmd = []
'mount -t proc proc /proc', cmd.append('mount -t sysfs sysfs /sys')
'mount -t sysfs sysfs /sys', cmd.append('mount -t proc proc /proc')
# 'sysctl -w .net.homa.poll_usecs=300000', cmd.append('/root/homa/util/cp_node server --protocol homa &')
'/root/homa/util/cp_node server --protocol homa', cmd.append('sleep 10')
# 'sleep 1', cmd.append('pkill cp_node')
# 'touch /root/homa/util/server.tt', return cmd
# 'sleep 1', # 'sysctl -w .net.homa.poll_usecs=300000'
# '/root/homa/util/ttprint.py > /root/homa/util/server.tt', # 'sleep 1'
# 'pkill cp_node', # 'touch /root/homa/util/server.tt'
# 'cat /root/homa/util/server.tt' # '/root/homa/util/ttprint.py > /root/homa/util/server.tt'
] # 'cat /root/homa/util/server.tt'
class IdleHost(AppConfig): class IdleHost(AppConfig):
......
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