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
d5b0e45b
Commit
d5b0e45b
authored
Oct 06, 2022
by
Hejing Li
Browse files
mem_switch.py: run sysbench instead of busybox
parent
576126e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
23 deletions
+66
-23
experiments/pyexps/memswitch.py
experiments/pyexps/memswitch.py
+66
-23
No files found.
experiments/pyexps/memswitch.py
View file @
d5b0e45b
...
@@ -28,15 +28,53 @@ experiments = []
...
@@ -28,15 +28,53 @@ experiments = []
num_of_netmem
=
[
1
,
2
,
3
,
4
]
num_of_netmem
=
[
1
,
2
,
3
,
4
]
class
MemTest
(
node
.
AppConfig
):
class
MemTest
(
node
.
AppConfig
):
idx
=
0
def
__init__
(
self
):
def
__init__
(
self
.
addr
=
[]
self
,
disagg_addr
:
int
,
idx
:
int
,
disagg_size
:
int
,
disaggregated
:
bool
,
time_limit
:
int
):
self
.
disagg_addr
=
disagg_addr
self
.
idx
=
idx
self
.
disagg_size
=
disagg_size
self
.
disaggregated
=
disaggregated
self
.
time_limit
=
time_limit
def
config_files
(
self
):
m
=
{
'farmem.ko'
:
open
(
'../images/farmem/farmem.ko'
,
'rb'
)}
return
{
**
m
,
**
super
().
config_files
()}
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
commands
=
[]
commands
=
[
for
addr
in
self
.
addr
:
'mount -t proc proc /proc'
,
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64 0x
{
42
+
self
.
idx
}
'
)
'mount -t sysfs sysfs /sys'
,
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64'
)
'free -m'
,
(
f
'insmod /tmp/guest/farmem.ko base_addr=0x
{
self
.
disagg_addr
:
x
}
'
f
'size=0x
{
self
.
disagg_size
:
x
}
nnid=1 drain_node=1'
),
'free -m'
,
'numactl -H'
,
(
f
'numactl --membind=
{
1
if
self
.
disaggregated
else
0
}
'
'sysbench '
f
'--time=
{
self
.
time_limit
}
'
'--validate=on '
'--histogram=on '
'memory '
'--memory-oper=write '
'--memory-block-size=16M '
'--memory-access-mode=rnd '
'--memory-total-size=1K run'
)
]
# for addr in self.addr:
# commands.append(f'busybox devmem 0x{addr:x} 64 0x{42 + self.idx} ')
# commands.append(f'busybox devmem 0x{addr:x} 64')
return
commands
return
commands
...
@@ -55,9 +93,9 @@ sw_mem_map = [(0, 0, 1024*1024*1024, '00:00:00:00:00:04', 0),
...
@@ -55,9 +93,9 @@ sw_mem_map = [(0, 0, 1024*1024*1024, '00:00:00:00:00:04', 0),
(
2
,
0
,
512
*
1024
*
1024
,
'00:00:00:00:00:04'
,
1024
*
1024
*
1024
),
(
2
,
0
,
512
*
1024
*
1024
,
'00:00:00:00:00:04'
,
1024
*
1024
*
1024
),
(
2
,
512
*
1024
*
1024
,
1024
*
1024
*
1024
,
'00:00:00:00:00:05'
,
1024
*
1024
*
1024
)]
(
2
,
512
*
1024
*
1024
,
1024
*
1024
*
1024
,
'00:00:00:00:00:05'
,
1024
*
1024
*
1024
)]
for
h
in
[
'gk'
]:
for
h
in
[
'gk'
,
'gt'
]:
e
=
exp
.
Experiment
(
'memsw-'
+
h
)
e
=
exp
.
Experiment
(
'memsw-'
+
h
)
e
.
checkpoint
=
Fals
e
e
.
checkpoint
=
Tru
e
# Add three MemNics for each host
# Add three MemNics for each host
mem0
=
sim
.
MemNIC
()
mem0
=
sim
.
MemNIC
()
...
@@ -82,31 +120,28 @@ for h in ['gk']:
...
@@ -82,31 +120,28 @@ for h in ['gk']:
netmem0
=
sim
.
NetMem
()
netmem0
=
sim
.
NetMem
()
netmem0
.
mac
=
'00:00:00:00:00:04'
netmem0
.
mac
=
'00:00:00:00:00:04'
netmem0
.
name
=
'netmem0'
netmem0
.
name
=
'netmem0'
netmem0
.
size
=
0x
4
0000000
netmem0
.
size
=
0x
8
0000000
netmem1
=
sim
.
NetMem
()
netmem1
=
sim
.
NetMem
()
netmem1
.
mac
=
'00:00:00:00:00:05'
netmem1
.
mac
=
'00:00:00:00:00:05'
netmem1
.
name
=
'netmem1'
netmem1
.
name
=
'netmem1'
netmem1
.
size
=
0x
4
0000000
netmem1
.
size
=
0x
8
0000000
###
###
node_config0
=
node
.
NodeConfig
()
node_config0
=
node
.
NodeConfig
()
node_config0
.
nockp
=
True
node_config0
.
kcmd_append
+=
'numa=fake=2'
node_config0
.
app
=
MemTest
()
#node_config0.nockp = True
node_config0
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config0
.
app
=
MemTest
(
mem0
.
addr
,
0
,
mem0
.
size
,
True
,
5
)
node_config0
.
app
.
idx
=
0
node_config1
=
node
.
NodeConfig
()
node_config1
=
node
.
NodeConfig
()
node_config1
.
nockp
=
True
node_config1
.
kcmd_append
+=
'numa=fake=2'
node_config1
.
app
=
MemTest
()
#node_config1.nockp = True
node_config1
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config1
.
app
=
MemTest
(
mem1
.
addr
,
1
,
mem1
.
size
,
True
,
5
)
node_config1
.
app
.
idx
=
1
node_config2
=
node
.
NodeConfig
()
node_config2
=
node
.
NodeConfig
()
node_config2
.
nockp
=
True
node_config2
.
kcmd_append
+=
'numa=fake=2'
node_config2
.
app
=
MemTest
()
#node_config2.nockp = True
node_config2
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config2
.
app
=
MemTest
(
mem2
.
addr
,
2
,
mem2
.
size
,
True
,
5
)
node_config2
.
app
.
idx
=
2
net
=
sim
.
MemSwitchNet
()
net
=
sim
.
MemSwitchNet
()
for
tp
in
sw_mem_map
:
for
tp
in
sw_mem_map
:
...
@@ -122,6 +157,14 @@ for h in ['gk']:
...
@@ -122,6 +157,14 @@ for h in ['gk']:
return
h
return
h
HostClass
=
gem5_kvm
HostClass
=
gem5_kvm
if
h
==
'gt'
:
def
gem5_timing
(
node_config
:
node
.
NodeConfig
):
h
=
sim
.
Gem5Host
(
node_config
)
h
.
cpu_type
=
'TimingSimpleCPU'
h
.
variant
=
'opt'
return
h
HostClass
=
gem5_timing
elif
h
==
'qk'
:
elif
h
==
'qk'
:
HostClass
=
sim
.
QemuHost
HostClass
=
sim
.
QemuHost
...
...
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