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
32c30c3b
Commit
32c30c3b
authored
Oct 05, 2022
by
Hejing Li
Browse files
mem_switch: setup three host and two netmem
parent
02b2933e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
34 deletions
+100
-34
experiments/pyexps/memswitch.py
experiments/pyexps/memswitch.py
+100
-34
No files found.
experiments/pyexps/memswitch.py
View file @
32c30c3b
...
@@ -28,45 +28,85 @@ experiments = []
...
@@ -28,45 +28,85 @@ 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
):
self
.
addr
=
[]
self
.
addr
=
[]
def
run_cmds
(
self
,
node
):
def
run_cmds
(
self
,
node
):
commands
=
[]
commands
=
[]
for
addr
in
self
.
addr
:
for
addr
in
self
.
addr
:
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64 0x42'
)
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64 0x
{
42
+
self
.
idx
}
'
)
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64'
)
commands
.
append
(
f
'busybox devmem 0x
{
addr
:
x
}
64'
)
return
commands
return
commands
# AS_ID,VADDR_START(include),VADDR_END(not include),MEMNODE_MAC,PHYS_START
# host 0 <-> memnic 0 \ / netmem 0
sw_mem_map
=
[(
0
,
0
,
1024
*
1024
*
1024
,
'00:00:00:00:00:02'
,
0
),
# host 1 <-> memnic 1 - Switch
(
0
,
1024
*
1024
*
1024
,
1024
*
1024
*
1024
*
2
,
'00:00:00:00:00:03'
,
1024
*
1024
*
1024
)]
# host 2 <-> memnic 2 / \ netmem 1
#
# [netmem 0] and [netmem 1] each has 2 GB memory.
# each host has 1 GB of far memory.
# [host 0] only uses [netmem 0], [host 1] only uses [netmem 1]
# [host 2] has 512 MB at [netmem 0] and 512 MB at [netmem 1]
# AS_ID, VADDR_START(include),V ADDR_END(not include), MEMNODE_MAC, PHYS_START
sw_mem_map
=
[(
0
,
0
,
1024
*
1024
*
1024
,
'00:00:00:00:00:04'
,
0
),
(
1
,
0
,
1024
*
1024
*
1024
,
'00:00:00:00:00:05'
,
0
),
(
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
)]
for
h
in
[
'gk'
]:
for
h
in
[
'gk'
]:
e
=
exp
.
Experiment
(
'memsw-'
+
h
)
e
=
exp
.
Experiment
(
'memsw-'
+
h
)
e
.
checkpoint
=
False
e
.
checkpoint
=
False
mem
=
sim
.
MemNIC
()
# Add three MemNics for each host
mem
.
name
=
'mem0'
mem0
=
sim
.
MemNIC
()
mem
.
addr
=
0x2000000000
#0x2000000000000000
mem0
.
name
=
'mem0'
mem
.
mac
=
'00:00:00:00:00:01'
mem0
.
addr
=
0x2000000000
#0x2000000000000000
mem0
.
mac
=
'00:00:00:00:00:01'
mem0
.
as_id
=
0
mem1
=
sim
.
MemNIC
()
mem1
.
name
=
'mem1'
mem1
.
addr
=
0x2000000000
#0x2000000000000000
mem1
.
mac
=
'00:00:00:00:00:02'
mem1
.
as_id
=
1
mem2
=
sim
.
MemNIC
()
mem2
.
name
=
'mem2'
mem2
.
addr
=
0x2000000000
#0x2000000000000000
mem2
.
mac
=
'00:00:00:00:00:03'
mem2
.
as_id
=
2
# Add two NetMes
netmem0
=
sim
.
NetMem
()
netmem0
.
mac
=
'00:00:00:00:00:04'
netmem0
.
name
=
'netmem0'
netmem0
.
size
=
0x40000000
netmem1
=
sim
.
NetMem
()
netmem1
=
sim
.
NetMem
()
netmem1
.
mac
=
'00:00:00:00:00:02'
netmem1
.
mac
=
'00:00:00:00:00:05'
netmem1
.
name
=
'netmem0'
netmem1
.
name
=
'netmem1'
netmem1
.
size
=
0x40000000
netmem2
=
sim
.
NetMem
()
netmem2
.
mac
=
'00:00:00:00:00:03'
###
netmem2
.
name
=
'netmem1'
node_config0
=
node
.
NodeConfig
()
node_config0
.
nockp
=
True
netmem2
.
addr
=
mem
.
addr
+
netmem1
.
size
node_config0
.
app
=
MemTest
()
node_config0
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config
=
node
.
NodeConfig
()
node_config0
.
app
.
idx
=
0
node_config
.
nockp
=
True
node_config
.
app
=
MemTest
()
node_config1
=
node
.
NodeConfig
()
node_config
.
app
.
addr
.
append
(
mem
.
addr
)
node_config1
.
nockp
=
True
node_config
.
app
.
addr
.
append
(
mem
.
addr
+
netmem1
.
size
)
node_config1
.
app
=
MemTest
()
node_config1
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config1
.
app
.
idx
=
1
node_config2
=
node
.
NodeConfig
()
node_config2
.
nockp
=
True
node_config2
.
app
=
MemTest
()
node_config2
.
app
.
addr
.
append
(
mem0
.
addr
)
node_config2
.
app
.
idx
=
2
net
=
sim
.
MemSwitchNet
()
net
=
sim
.
MemSwitchNet
()
for
tp
in
sw_mem_map
:
for
tp
in
sw_mem_map
:
...
@@ -75,20 +115,46 @@ for h in ['gk']:
...
@@ -75,20 +115,46 @@ for h in ['gk']:
e
.
add_network
(
net
)
e
.
add_network
(
net
)
if
h
==
'gk'
:
if
h
==
'gk'
:
host
=
sim
.
Gem5Host
(
node_config
)
def
gem5_kvm
(
node_config
:
node
.
NodeConfig
):
host
.
cpu_type
=
'X86KvmCPU'
h
=
sim
.
Gem5Host
(
node_config
)
host
.
variant
=
'opt'
h
.
cpu_type
=
'X86KvmCPU'
elif
h
==
'qk'
:
h
.
variant
=
'opt'
host
=
sim
.
QemuHost
(
node_config
)
return
h
host
.
name
=
'host.0'
HostClass
=
gem5_kvm
e
.
add_host
(
host
)
host
.
wait
=
True
mem
.
set_network
(
net
)
elif
h
==
'qk'
:
HostClass
=
sim
.
QemuHost
# Add hosts
host_0
=
HostClass
(
node_config0
)
host_1
=
HostClass
(
node_config1
)
host_2
=
HostClass
(
node_config2
)
host_0
.
name
=
'host.0'
host_1
.
name
=
'host.1'
host_2
.
name
=
'host.2'
e
.
add_host
(
host_0
)
e
.
add_host
(
host_1
)
e
.
add_host
(
host_2
)
host_0
.
wait
=
True
host_1
.
wait
=
True
host_2
.
wait
=
True
mem0
.
set_network
(
net
)
mem1
.
set_network
(
net
)
mem2
.
set_network
(
net
)
e
.
add_memdev
(
mem0
)
e
.
add_memdev
(
mem1
)
e
.
add_memdev
(
mem2
)
host_0
.
add_memdev
(
mem0
)
host_1
.
add_memdev
(
mem1
)
host_2
.
add_memdev
(
mem2
)
netmem0
.
set_network
(
net
)
netmem1
.
set_network
(
net
)
netmem1
.
set_network
(
net
)
netmem2
.
set_network
(
net
)
e
.
add_memdev
(
mem
)
host
.
add_memdev
(
mem
)
experiments
.
append
(
e
)
experiments
.
append
(
e
)
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