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
0d2f3aab
Unverified
Commit
0d2f3aab
authored
Sep 25, 2024
by
Jakob Görgen
Browse files
rem5 run_cmds method
parent
d8a9599a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
26 deletions
+43
-26
experiments/simbricks/orchestration/instantiation/base.py
experiments/simbricks/orchestration/instantiation/base.py
+1
-0
experiments/simbricks/orchestration/simulation/base.py
experiments/simbricks/orchestration/simulation/base.py
+6
-1
experiments/simbricks/orchestration/simulation/host.py
experiments/simbricks/orchestration/simulation/host.py
+35
-24
experiments/simbricks/orchestration/system/mem.py
experiments/simbricks/orchestration/system/mem.py
+1
-1
No files found.
experiments/simbricks/orchestration/instantiation/base.py
View file @
0d2f3aab
...
@@ -311,6 +311,7 @@ class Instantiation(util_base.IdObj):
...
@@ -311,6 +311,7 @@ class Instantiation(util_base.IdObj):
# both support both we just pick an order
# both support both we just pick an order
insert_dependency
(
sim_a
,
depends_on
=
sim_b
)
insert_dependency
(
sim_a
,
depends_on
=
sim_b
)
# TODO: pre-calculate the socket paths and whether they are listening or connecting sockets in here!
for
sim
in
self
.
_simulation
.
all_simulators
():
for
sim
in
self
.
_simulation
.
all_simulators
():
for
comp
in
sim
.
_components
:
for
comp
in
sim
.
_components
:
for
sim_inf
in
comp
.
interfaces
():
for
sim_inf
in
comp
.
interfaces
():
...
...
experiments/simbricks/orchestration/simulation/base.py
View file @
0d2f3aab
...
@@ -98,8 +98,13 @@ class Simulator(utils_base.IdObj):
...
@@ -98,8 +98,13 @@ class Simulator(utils_base.IdObj):
raise
Exception
(
"could not determine eth_latency and sync_period"
)
raise
Exception
(
"could not determine eth_latency and sync_period"
)
return
latency
,
sync_period
,
run_sync
return
latency
,
sync_period
,
run_sync
def
filter_components_by_pred
(
self
,
pred
:
tp
.
Callable
[[
sys_conf
.
Component
],
bool
]
)
->
list
[
sys_conf
.
Component
]:
return
list
(
filter
(
pred
,
self
.
_components
))
def
filter_components_by_type
(
self
,
ty
)
->
list
[
sys_conf
.
Component
]:
def
filter_components_by_type
(
self
,
ty
)
->
list
[
sys_conf
.
Component
]:
return
list
(
filter
(
lambda
comp
:
isinstance
(
comp
,
ty
)
,
self
.
_components
)
)
return
self
.
filter
_components_by_pred
(
lambda
comp
:
isinstance
(
comp
,
ty
))
def
components
(
self
)
->
set
[
sys_conf
.
Component
]:
def
components
(
self
)
->
set
[
sys_conf
.
Component
]:
return
self
.
_components
return
self
.
_components
...
...
experiments/simbricks/orchestration/simulation/host.py
View file @
0d2f3aab
...
@@ -32,6 +32,8 @@ from simbricks.orchestration.experiment.experiment_environment_new import ExpEnv
...
@@ -32,6 +32,8 @@ from simbricks.orchestration.experiment.experiment_environment_new import ExpEnv
if
tp
.
TYPE_CHECKING
:
if
tp
.
TYPE_CHECKING
:
from
simbricks.orchestration.system
import
host
as
sys_host
from
simbricks.orchestration.system
import
host
as
sys_host
from
simbricks.orchestration.system
import
mem
as
sys_mem
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
class
HostSim
(
sim_base
.
Simulator
):
class
HostSim
(
sim_base
.
Simulator
):
...
@@ -122,33 +124,42 @@ class Gem5Sim(HostSim):
...
@@ -122,33 +124,42 @@ class Gem5Sim(HostSim):
if
inst
.
restore_cp
():
if
inst
.
restore_cp
():
cmd
+=
'-r 1 '
cmd
+=
'-r 1 '
sockets
=
self
.
_get_sockets
(
inst
=
inst
)
# TODO: FIXME lost info whether this was from a pci device, a mem device or whatever
latency
,
sync_period
,
run_sync
=
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
channels
=
self
.
get_channels
())
latency
,
sync_period
,
run_sync
=
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
channels
=
self
.
get_channels
())
pci_devices
=
self
.
filter_components_by_type
(
ty
=
)
pci_devices
=
self
.
filter_components_by_type
(
ty
=
sys_pcie
.
PCIeSimpleDevice
)
# TODO: FIXME get socket by interface!
for
dev
in
pci_devices
:
for
dev
in
self
.
pcidevs
:
for
inf
in
dev
.
interfaces
():
cmd
+=
(
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
f
'--simbricks-pci=connect:
{
env
.
dev_pci_path
(
dev
)
}
'
if
socket
is
None
:
f
':latency=
{
self
.
pci_latency
}
ns'
continue
f
':sync_interval=
{
self
.
sync_period
}
ns'
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
)
cmd
+=
(
if
cpu_type
==
'TimingSimpleCPU'
:
f
'--simbricks-pci=connect:
{
socket
.
_path
}
'
cmd
+=
':sync'
f
':latency=
{
latency
}
ns'
cmd
+=
' '
f
':sync_interval=
{
sync_period
}
ns'
)
# TODO: FIXME get socket by interface!
if
run_sync
:
for
dev
in
self
.
memdevs
:
cmd
+=
':sync'
cmd
+=
(
cmd
+=
' '
f
'--simbricks-mem=
{
dev
.
size
}
@
{
dev
.
addr
}
@
{
dev
.
as_id
}
@'
f
'connect:
{
env
.
dev_mem_path
(
dev
)
}
'
mem_devices
=
self
.
filter_components_by_type
(
ty
=
sys_mem
.
MemSimpleDevice
)
f
':latency=
{
self
.
mem_latency
}
ns'
for
dev
in
mem_devices
:
f
':sync_interval=
{
self
.
sync_period
}
ns'
for
inf
in
dev
.
interfaces
():
)
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
if
cpu_type
==
'TimingSimpleCPU'
:
if
socket
is
None
:
cmd
+=
':sync'
continue
cmd
+=
' '
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
cmd
+=
(
f
'--simbricks-mem=
{
dev
.
size
}
@
{
dev
.
addr
}
@
{
dev
.
as_id
}
@'
# TODO: FIXME
f
'connect:
{
socket
.
_path
}
'
f
':latency=
{
latency
}
ns'
f
':sync_interval=
{
sync_period
}
ns'
)
if
run_sync
:
cmd
+=
':sync'
cmd
+=
' '
# TODO: FIXME
# for net in self.net_directs:
# for net in self.net_directs:
# cmd += (
# cmd += (
# '--simbricks-eth-e1000=listen'
# '--simbricks-eth-e1000=listen'
...
...
experiments/simbricks/orchestration/system/mem.py
View file @
0d2f3aab
...
@@ -56,7 +56,7 @@ class MemChannel(base.Channel):
...
@@ -56,7 +56,7 @@ class MemChannel(base.Channel):
class
MemSimpleDevice
(
base
.
Component
):
class
MemSimpleDevice
(
base
.
Component
):
def
__init__
(
self
,
s
:
base
.
System
):
def
__init__
(
self
,
s
:
base
.
System
):
super
().
__init__
(
s
)
super
().
__init__
(
s
)
self
.
_mem_if
:
MemDeviceInterface
|
None
=
None
self
.
_mem_if
:
MemDeviceInterface
=
MemDeviceInterface
(
c
=
self
)
def
interfaces
(
self
)
->
list
[
base
.
Interface
]:
def
interfaces
(
self
)
->
list
[
base
.
Interface
]:
return
[
self
.
_mem_if
]
return
[
self
.
_mem_if
]
...
...
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