Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
d6f58633
Commit
d6f58633
authored
Jan 25, 2024
by
Hejing Li
Browse files
homa_simple_ping.py: add host sim & workload choice
parent
3e8e34aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
64 deletions
+88
-64
experiments/pyexps/homa_simple_ping.py
experiments/pyexps/homa_simple_ping.py
+64
-42
experiments/simbricks/orchestration/nodeconfig.py
experiments/simbricks/orchestration/nodeconfig.py
+24
-22
No files found.
experiments/pyexps/homa_simple_ping.py
View file @
d6f58633
...
...
@@ -28,55 +28,77 @@ The client pings the server.
from
simbricks.orchestration.experiments
import
Experiment
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
e
=
Experiment
(
name
=
'simple_homa'
)
e
.
checkpoint
=
False
# use checkpoint and restore to speed up simulation
experiments
=
[]
workload
=
[
1
,
2
,
3
,
4
,
5
]
host_types
=
[
'qemu'
,
'gem5'
,
'qt'
]
for
w
in
workload
:
for
host_type
in
host_types
:
# create client
client_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
client_config
.
disk_image
=
'homa'
client_config
.
ip
=
'10.0.0.1'
client_config
.
app
=
HomaClientNode
()
client
=
QemuHost
(
client_config
)
client
.
sync
=
True
client
.
name
=
'client'
client
.
wait
=
True
# wait for client simulator to finish execution
e
.
add_host
(
client
)
e
=
Experiment
(
f
'single_homa_w
{
w
}
_'
+
host_type
)
e
.
checkpoint
=
False
# use checkpoint and restore to speed up simulation
# host
if
host_type
==
'qemu'
:
HostClass
=
QemuHost
elif
host_type
==
'qt'
:
# attach client's NIC
client_nic
=
I40eNIC
(
)
e
.
add_nic
(
client_nic
)
client
.
add_nic
(
client_nic
)
def
qemu_timing
(
node_config
:
NodeConfig
):
h
=
QemuHost
(
node_config
)
h
.
sync
=
True
return
h
# create server
server_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
server_config
.
disk_image
=
'homa'
server_config
.
ip
=
'10.0.0.2'
server_config
.
app
=
HomaServerNode
()
server
=
QemuHost
(
server_config
)
server
.
sync
=
True
server
.
name
=
'server'
# server.wait = True
e
.
add_host
(
server
)
HostClass
=
qemu_timing
elif
host_type
==
'gem5'
:
HostClass
=
Gem5Host
e
.
checkpoint
=
True
else
:
raise
NameError
(
host_type
)
# attach server's NIC
server_nic
=
I40eNIC
()
e
.
add_nic
(
server_nic
)
server
.
add_nic
(
server_nic
)
# create client
client_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
client_config
.
disk_image
=
'homa'
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
network
=
SwitchNet
()
e
.
add_network
(
network
)
client_nic
.
set_network
(
network
)
server_nic
.
set_network
(
network
)
# attach client's NIC
client_nic
=
I40eNIC
()
e
.
add_nic
(
client_nic
)
client
.
add_nic
(
client_nic
)
# set more interesting link latencies than default
eth_latency
=
500
*
10
**
3
# 500 us
network
.
eth_latency
=
eth_latency
client_nic
.
eth_latency
=
eth_latency
server_nic
.
eth_latency
=
eth_latency
# create server
server_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
server_config
.
disk_image
=
'homa'
server_config
.
ip
=
'10.0.0.2'
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
)
experiments/simbricks/orchestration/nodeconfig.py
View file @
d6f58633
...
...
@@ -417,7 +417,7 @@ class HomaCluster(AppConfig):
cmd
.
append
(
f
'/root/homa/util/cp_node server --protocol homa & '
)
cmd
.
append
(
'sleep 5'
)
cmd
.
append
(
f
'/root/homa/util/cp_node client --protocol homa --workload w
4
--first-server 0 --server-nodes
{
self
.
cluster_size
}
--id
{
self
.
id
}
&'
)
cmd
.
append
(
f
'/root/homa/util/cp_node client --protocol homa --workload w
2 --client-max 50
--first-server 0 --server-nodes
{
self
.
cluster_size
}
--id
{
self
.
id
}
&'
)
cmd
.
append
(
'sleep 10'
)
cmd
.
append
(
'pkill cp_node'
)
...
...
@@ -449,6 +449,7 @@ class HomaClientNode(AppConfig):
super
().
__init__
()
self
.
id
=
0
self
.
cluster_size
=
2
self
.
workload
=
2
def
prepare_post_cp
(
self
)
->
tp
.
List
[
str
]:
return
super
().
prepare_post_cp
()
+
[
...
...
@@ -460,15 +461,16 @@ class HomaClientNode(AppConfig):
return
{
**
m
,
**
super
().
config_files
()}
def
run_cmds
(
self
,
node
:
NodeConfig
)
->
tp
.
List
[
str
]:
return
[
'mount -t sysfs sysfs /sys'
,
'mount -t proc proc /proc'
,
'/root/homa/util/cp_node client --protocol homa'
,
# 'touch /root/homa/util/client.tt',
# 'sleep 1',
# '/root/homa/util/ttprint.py > /root/homa/util/client.tt',
# 'pkill cp_node',
]
cmd
=
[]
cmd
.
append
(
'mount -t sysfs sysfs /sys'
)
cmd
.
append
(
'mount -t proc proc /proc'
)
cmd
.
append
(
'sleep 1'
)
cmd
.
append
(
f
'/root/homa/util/cp_node client --protocol homa --workload w
{
self
.
workload
}
&'
)
cmd
.
append
(
'sleep 10'
)
cmd
.
append
(
'pkill cp_node'
)
return
cmd
# 'touch /root/homa/util/client.tt'
# '/root/homa/util/ttprint.py > /root/homa/util/client.tt'
class
HomaServerNode
(
AppConfig
):
...
...
@@ -482,18 +484,18 @@ class HomaServerNode(AppConfig):
return
{
**
m
,
**
super
().
config_files
()}
def
run_cmds
(
self
,
node
:
NodeConfig
)
->
tp
.
List
[
str
]:
return
[
'mount -t proc proc /proc'
,
'mount -t sysfs sysfs /sys'
,
# 'sysctl -w .net.homa.poll_usecs=300000',
'/root/homa/util/cp_node server --protocol homa'
,
# 'sleep 1',
# 'touch /root/homa/util/server.tt',
# 'sleep 1',
# '/root/homa/util/ttprint.py > /root/homa/util/server.tt',
# 'pkill cp_node',
# 'cat
/root/homa/util/server.tt'
]
cmd
=
[
]
cmd
.
append
(
'mount -t sysfs sysfs /sys'
)
cmd
.
append
(
'mount -t proc proc /proc'
)
cmd
.
append
(
'/root/homa/util/cp_node server --protocol homa &'
)
cmd
.
append
(
'sleep 10'
)
cmd
.
append
(
'pkill cp_node'
)
return
cmd
# 'sysctl -w .net.homa.poll_usecs=300000'
# 'sleep 1'
# 'touch /root/homa/util/server.tt'
# '/root/homa/util/ttprint.py >
/root/homa/util/server.tt'
# 'cat /root/homa/util/server.tt'
class
IdleHost
(
AppConfig
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment