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
0d56918d
Unverified
Commit
0d56918d
authored
Sep 26, 2024
by
Jakob Görgen
Browse files
fixed host pci connect bug using wrong interfaces
parent
4c2bb680
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
83 deletions
+104
-83
experiments/pyexps/netperf_sysconf.py
experiments/pyexps/netperf_sysconf.py
+29
-24
experiments/simbricks/orchestration/helpers/simulation.py
experiments/simbricks/orchestration/helpers/simulation.py
+9
-8
experiments/simbricks/orchestration/simulation/channel.py
experiments/simbricks/orchestration/simulation/channel.py
+2
-2
experiments/simbricks/orchestration/simulation/host.py
experiments/simbricks/orchestration/simulation/host.py
+57
-47
experiments/simbricks/orchestration/simulation/pcidev.py
experiments/simbricks/orchestration/simulation/pcidev.py
+1
-1
experiments/simbricks/orchestration/system/base.py
experiments/simbricks/orchestration/system/base.py
+6
-1
No files found.
experiments/pyexps/netperf_sysconf.py
View file @
0d56918d
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
simulation
as
sim
from
simbricks.orchestration
import
simulation
as
sim
from
simbricks.orchestration
import
instantiation
as
inst
from
simbricks.orchestration
import
instantiation
as
inst
from
simbricks.orchestration.helpers
import
simulation
as
sim_helpers
"""
"""
Netperf Example:
Netperf Example:
...
@@ -11,9 +11,9 @@ HOST0 -- NIC0 ------ SWITCH ------ NIC1 -- HOST1
...
@@ -11,9 +11,9 @@ HOST0 -- NIC0 ------ SWITCH ------ NIC1 -- HOST1
This scripts generates the experiments with all the combinations of different execution modes
This scripts generates the experiments with all the combinations of different execution modes
"""
"""
host_types
=
[
'
gem5
'
]
host_types
=
[
"
gem5
"
]
nic_types
=
[
'
i40e
'
]
nic_types
=
[
"
i40e
"
]
net_types
=
[
'
switch
'
]
net_types
=
[
"
switch
"
]
experiments
=
[]
experiments
=
[]
sys
=
system
.
System
()
sys
=
system
.
System
()
...
@@ -26,7 +26,7 @@ host0.add_disk(cfg_disk0)
...
@@ -26,7 +26,7 @@ host0.add_disk(cfg_disk0)
host0
.
add_if
(
pcie0
)
host0
.
add_if
(
pcie0
)
nic0
=
system
.
IntelI40eNIC
(
sys
)
nic0
=
system
.
IntelI40eNIC
(
sys
)
nic0
.
add_ipv4
(
'
10.0.0.1
'
)
nic0
.
add_ipv4
(
"
10.0.0.1
"
)
pcichannel0
=
system
.
PCIeChannel
(
pcie0
,
nic0
.
_pci_if
)
pcichannel0
=
system
.
PCIeChannel
(
pcie0
,
nic0
.
_pci_if
)
# create a host instance and a NIC instance then install the NIC on the host
# create a host instance and a NIC instance then install the NIC on the host
...
@@ -35,9 +35,9 @@ pcie1 = system.PCIeHostInterface(host1)
...
@@ -35,9 +35,9 @@ pcie1 = system.PCIeHostInterface(host1)
cfg_disk1
=
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
)
cfg_disk1
=
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
)
host1
.
add_disk
(
cfg_disk1
)
host1
.
add_disk
(
cfg_disk1
)
host1
.
add_if
(
pcie
0
)
host1
.
add_if
(
pcie
1
)
nic1
=
system
.
IntelI40eNIC
(
sys
)
nic1
=
system
.
IntelI40eNIC
(
sys
)
nic1
.
add_ipv4
(
'
10.0.0.2
'
)
nic1
.
add_ipv4
(
"
10.0.0.2
"
)
pcichannel1
=
system
.
PCIeChannel
(
pcie1
,
nic1
.
_pci_if
)
pcichannel1
=
system
.
PCIeChannel
(
pcie1
,
nic1
.
_pci_if
)
# create switch and its ports
# create switch and its ports
...
@@ -62,57 +62,62 @@ Execution Config
...
@@ -62,57 +62,62 @@ Execution Config
for
host_type
in
host_types
:
for
host_type
in
host_types
:
for
nic_type
in
nic_types
:
for
nic_type
in
nic_types
:
for
net_type
in
net_types
:
for
net_type
in
net_types
:
e
=
sim
.
Simulation
(
simulation
=
sim
.
Simulation
(
'
n-
'
+
host_type
+
'-'
+
nic_type
+
'-'
+
net_type
"
n-
"
+
host_type
+
"-"
+
nic_type
+
"-"
+
net_type
)
)
# Host
# Host
if
host_type
==
'
gem5
'
:
if
host_type
==
"
gem5
"
:
host_sim
=
sim
.
Gem5Sim
host_sim
=
sim
.
Gem5Sim
elif
host_type
==
'
qemu
'
:
elif
host_type
==
"
qemu
"
:
def
qemu_sim
(
e
):
def
qemu_sim
(
e
):
h
=
sim
.
QemuSim
(
e
)
h
=
sim
.
QemuSim
(
e
)
h
.
sync
=
False
h
.
sync
=
False
return
h
return
h
host_sim
=
qemu_sim
host_sim
=
qemu_sim
elif
host_type
==
'
qt
'
:
elif
host_type
==
"
qt
"
:
host_sim
=
sim
.
QemuSim
host_sim
=
sim
.
QemuSim
else
:
else
:
raise
NameError
(
host_type
)
raise
NameError
(
host_type
)
# NIC
# NIC
if
nic_type
==
'
i40e
'
:
if
nic_type
==
"
i40e
"
:
nic_sim
=
sim
.
I40eNicSim
nic_sim
=
sim
.
I40eNicSim
elif
nic_type
==
'
vr
'
:
elif
nic_type
==
"
vr
"
:
nic_sim
=
sim
.
CorundumVerilatorNICSim
nic_sim
=
sim
.
CorundumVerilatorNICSim
else
:
else
:
raise
NameError
(
nic_type
)
raise
NameError
(
nic_type
)
# Net
# Net
if
net_type
==
'
switch
'
:
if
net_type
==
"
switch
"
:
net_sim
=
sim
.
SwitchNet
net_sim
=
sim
.
SwitchNet
else
:
else
:
raise
NameError
(
net_type
)
raise
NameError
(
net_type
)
host_inst0
=
host_sim
(
e
)
host_inst0
=
host_sim
(
simulation
)
host_inst0
.
add
(
host0
)
host_inst0
.
add
(
host0
)
host_inst1
=
host_sim
(
e
)
host_inst1
=
host_sim
(
simulation
)
host_inst1
.
add
(
host1
)
host_inst1
.
add
(
host1
)
nic_inst0
=
nic_sim
(
e
)
nic_inst0
=
nic_sim
(
simulation
)
nic_inst0
.
add
(
nic0
)
nic_inst0
.
add
(
nic0
)
nic_inst1
=
nic_sim
(
e
)
nic_inst1
=
nic_sim
(
simulation
)
nic_inst1
.
add
(
nic1
)
nic_inst1
.
add
(
nic1
)
net_inst
=
net_sim
(
e
)
net_inst
=
net_sim
(
simulation
)
net_inst
.
add
(
switch
)
net_inst
.
add
(
switch
)
print
(
e
.
name
+
" all simulators:"
)
sim_helpers
.
enable_sync_simulation
(
sims
=
e
.
all_simulators
()
simulation
=
simulation
,
amount
=
500
,
ratio
=
sim
.
Time
.
Nanoseconds
)
print
(
simulation
.
name
+
" all simulators:"
)
sims
=
simulation
.
all_simulators
()
for
s
in
sims
:
for
s
in
sims
:
print
(
s
)
print
(
s
)
experiments
.
append
(
e
)
experiments
.
append
(
simulation
)
experiments/simbricks/orchestration/helpers/simulation.py
View file @
0d56918d
...
@@ -21,25 +21,26 @@
...
@@ -21,25 +21,26 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
simulation
from
simbricks.orchestration.simulation
import
base
as
sim_base
from
simbricks.orchestration.simulation
import
channel
as
sim_chan
from
simbricks.orchestration.utils
import
base
as
utils_base
from
simbricks.orchestration.utils
import
base
as
utils_base
def
add_specs
(
simulator
:
sim
ulation
.
Simulator
,
*
specifications
)
->
None
:
def
add_specs
(
simulator
:
sim
_base
.
Simulator
,
*
specifications
)
->
None
:
utils_base
.
has_expected_type
(
obj
=
simulator
,
expected_type
=
sim
ulation
.
Simulator
)
utils_base
.
has_expected_type
(
obj
=
simulator
,
expected_type
=
sim
_base
.
Simulator
)
for
spec
in
specifications
:
for
spec
in
specifications
:
utils_base
.
has_expected_type
(
obj
=
spec
,
expected_type
=
system
.
Component
)
utils_base
.
has_expected_type
(
obj
=
spec
,
expected_type
=
system
.
Component
)
simulator
.
add
(
comp
=
spec
)
simulator
.
add
(
comp
=
spec
)
def
enable_sync_simulation
(
def
enable_sync_simulation
(
simulation
:
sim
ulation
.
Simulation
,
amount
:
int
=
None
,
ratio
:
sim
ulatio
n
.
Time
=
None
simulation
:
sim
_base
.
Simulation
,
amount
:
int
=
None
,
ratio
:
sim
_cha
n
.
Time
=
None
)
->
None
:
)
->
None
:
utils_base
.
has_expected_type
(
obj
=
simulation
,
expected_type
=
sim
ulation
.
Simulation
)
utils_base
.
has_expected_type
(
obj
=
simulation
,
expected_type
=
sim
_base
.
Simulation
)
set_period
:
bool
=
amount
is
not
None
and
ratio
is
not
None
set_period
:
bool
=
amount
is
not
None
and
ratio
is
not
None
if
set_period
:
if
set_period
:
utils_base
.
has_expected_type
(
obj
=
amount
,
expected_type
=
int
)
utils_base
.
has_expected_type
(
obj
=
amount
,
expected_type
=
int
)
utils_base
.
has_expected_type
(
obj
=
ratio
,
expected_type
=
sim
ulatio
n
.
Time
)
utils_base
.
has_expected_type
(
obj
=
ratio
,
expected_type
=
sim
_cha
n
.
Time
)
for
chan
in
simulation
.
get_all_channels
():
for
chan
in
simulation
.
get_all_channels
():
chan
.
_synchronized
=
True
chan
.
_synchronized
=
True
...
@@ -47,8 +48,8 @@ def enable_sync_simulation(
...
@@ -47,8 +48,8 @@ def enable_sync_simulation(
chan
.
set_sync_period
(
amount
=
amount
,
ratio
=
ratio
)
chan
.
set_sync_period
(
amount
=
amount
,
ratio
=
ratio
)
def
disalbe_sync_simulation
(
simulation
:
sim
ulation
.
Simulation
)
->
None
:
def
disalbe_sync_simulation
(
simulation
:
sim
_base
.
Simulation
)
->
None
:
utils_base
.
has_expected_type
(
obj
=
simulation
,
expected_type
=
sim
ulation
.
Simulation
)
utils_base
.
has_expected_type
(
obj
=
simulation
,
expected_type
=
sim
_base
.
Simulation
)
for
chan
in
simulation
.
get_all_channels
(
lazy
=
False
):
for
chan
in
simulation
.
get_all_channels
(
lazy
=
False
):
chan
.
_synchronized
=
False
chan
.
_synchronized
=
False
experiments/simbricks/orchestration/simulation/channel.py
View file @
0d56918d
...
@@ -37,8 +37,8 @@ class Time(enum.IntEnum):
...
@@ -37,8 +37,8 @@ class Time(enum.IntEnum):
class
Channel
:
class
Channel
:
def
__init__
(
self
,
chan
:
system_base
.
Channel
):
def
__init__
(
self
,
chan
:
system_base
.
Channel
):
self
.
_synchronized
:
bool
=
Tru
e
self
.
_synchronized
:
bool
=
Fals
e
self
.
sync_period
:
int
=
500
# nano second
self
.
sync_period
:
int
=
500
# nano second
s
self
.
sys_channel
:
system_base
.
Channel
=
chan
self
.
sys_channel
:
system_base
.
Channel
=
chan
def
full_name
(
self
)
->
str
:
def
full_name
(
self
)
->
str
:
...
...
experiments/simbricks/orchestration/simulation/host.py
View file @
0d56918d
...
@@ -33,8 +33,6 @@ from simbricks.orchestration.system import host as sys_host
...
@@ -33,8 +33,6 @@ from simbricks.orchestration.system import host as sys_host
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
from
simbricks.orchestration.system
import
pcie
as
sys_pcie
from
simbricks.orchestration.system
import
mem
as
sys_mem
from
simbricks.orchestration.system
import
mem
as
sys_mem
# if tp.TYPE_CHECKING:
class
HostSim
(
sim_base
.
Simulator
):
class
HostSim
(
sim_base
.
Simulator
):
...
@@ -60,14 +58,16 @@ class HostSim(sim_base.Simulator):
...
@@ -60,14 +58,16 @@ class HostSim(sim_base.Simulator):
class
Gem5Sim
(
HostSim
):
class
Gem5Sim
(
HostSim
):
def
__init__
(
self
,
simulation
:
sim_base
.
Simulation
):
def
__init__
(
self
,
simulation
:
sim_base
.
Simulation
):
super
().
__init__
(
simulation
=
simulation
,
executable
=
"sims/external/gem5/build/X86/gem5"
)
super
().
__init__
(
self
.
name
=
f
"Gem5Sim-
{
self
.
_id
}
"
simulation
=
simulation
,
executable
=
"sims/external/gem5/build/X86/gem5"
)
self
.
name
=
f
"Gem5Sim-
{
self
.
_id
}
"
self
.
cpu_type_cp
=
"X86KvmCPU"
self
.
cpu_type_cp
=
"X86KvmCPU"
self
.
cpu_type
=
"TimingSimpleCPU"
self
.
cpu_type
=
"TimingSimpleCPU"
self
.
extra_main_args
:
list
[
str
]
=
[]
# TODO
self
.
extra_main_args
:
list
[
str
]
=
[]
# TODO
self
.
extra_config_args
:
list
[
str
]
=
[]
# TODO
self
.
extra_config_args
:
list
[
str
]
=
[]
# TODO
self
.
_variant
:
str
=
"fast"
self
.
_variant
:
str
=
"fast"
self
.
_sys_clock
:
str
=
'
1GHz
'
# TODO: move to system module
self
.
_sys_clock
:
str
=
"
1GHz
"
# TODO: move to system module
def
resreq_cores
(
self
)
->
int
:
def
resreq_cores
(
self
)
->
int
:
return
1
return
1
...
@@ -123,45 +123,53 @@ class Gem5Sim(HostSim):
...
@@ -123,45 +123,53 @@ class Gem5Sim(HostSim):
# cmd += f'--command-line-append="{self.node_config.kcmd_append}" '
# cmd += f'--command-line-append="{self.node_config.kcmd_append}" '
if
inst
.
create_cp
():
if
inst
.
create_cp
():
cmd
+=
'
--max-checkpoints=1
'
cmd
+=
"
--max-checkpoints=1
"
if
inst
.
restore_cp
():
if
inst
.
restore_cp
():
cmd
+=
'-r 1 '
cmd
+=
"-r 1 "
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
=
sys_pcie
.
PCIeSimpleDevice
)
latency
,
sync_period
,
run_sync
=
(
for
dev
in
pci_devices
:
sim_base
.
Simulator
.
get_unique_latency_period_sync
(
for
inf
in
dev
.
interfaces
():
channels
=
self
.
get_channels
()
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
if
socket
is
None
:
continue
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
cmd
+=
(
f
'--simbricks-pci=connect:
{
socket
.
_path
}
'
f
':latency=
{
latency
}
ns'
f
':sync_interval=
{
sync_period
}
ns'
)
)
if
run_sync
:
)
cmd
+=
':sync'
cmd
+=
' '
fsh_interfaces
=
full_sys_hosts
[
0
].
interfaces
()
mem_devices
=
self
.
filter_components_by_type
(
ty
=
sys_mem
.
MemSimpleDevice
)
pci_interfaces
=
system
.
Interface
.
filter_by_type
(
for
dev
in
mem_devices
:
interfaces
=
fsh_interfaces
,
ty
=
sys_pcie
.
PCIeHostInterface
for
inf
in
dev
.
interfaces
():
)
for
inf
in
pci_interfaces
:
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
socket
=
self
.
_get_socket
(
inst
=
inst
,
interface
=
inf
)
if
socket
is
None
:
if
socket
is
None
:
continue
continue
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
assert
socket
.
_type
==
inst_base
.
SockType
.
CONNECT
cmd
+=
(
cmd
+=
(
f
'--simbricks-mem=
{
dev
.
_size
}
@
{
dev
.
_addr
}
@
{
dev
.
_as_id
}
@'
# TODO: FIXME
f
"--simbricks-pci=connect:
{
socket
.
_path
}
"
f
'connect:
{
socket
.
_path
}
'
f
":latency=
{
latency
}
ns"
f
':latency=
{
latency
}
ns'
f
":sync_interval=
{
sync_period
}
ns"
f
':sync_interval=
{
sync_period
}
ns'
)
)
if
run_sync
:
if
run_sync
:
cmd
+=
':sync'
cmd
+=
":sync"
cmd
+=
' '
cmd
+=
" "
# mem_interfaces = system.Interface.filter_by_type(
# interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface
# )
# for inf in mem_interfaces:
# socket = self._get_socket(inst=inst, interface=inf)
# if socket is None:
# continue
# 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
# TODO: FIXME
# for net in self.net_directs:
# for net in self.net_directs:
...
@@ -176,7 +184,9 @@ class Gem5Sim(HostSim):
...
@@ -176,7 +184,9 @@ class Gem5Sim(HostSim):
# cmd += ':sync'
# cmd += ':sync'
# cmd += ' '
# cmd += ' '
cmd
+=
' '
.
join
(
self
.
extra_config_args
)
cmd
+=
" "
.
join
(
self
.
extra_config_args
)
print
(
f
"GEM5 COMMAND!!! =====
{
cmd
}
"
)
return
cmd
return
cmd
...
...
experiments/simbricks/orchestration/simulation/pcidev.py
View file @
0d56918d
...
@@ -80,7 +80,7 @@ class NICSim(PCIDevSim):
...
@@ -80,7 +80,7 @@ class NICSim(PCIDevSim):
cmd
+=
f
"
{
socket
.
_path
}
"
cmd
+=
f
"
{
socket
.
_path
}
"
cmd
+=
(
cmd
+=
(
f
"
{
inst
.
get_simulator_shm_pool_path
(
sim
=
self
)
}
{
run_sync
}
{
self
.
_start_tick
}
"
f
"
{
inst
.
get_simulator_shm_pool_path
(
sim
=
self
)
}
{
int
(
run_sync
)
}
{
self
.
_start_tick
}
"
f
"
{
sync_period
}
{
latency
}
{
latency
}
"
f
"
{
sync_period
}
{
latency
}
{
latency
}
"
)
)
...
...
experiments/simbricks/orchestration/system/base.py
View file @
0d56918d
...
@@ -89,6 +89,11 @@ class Interface(util_base.IdObj):
...
@@ -89,6 +89,11 @@ class Interface(util_base.IdObj):
peer_if
=
self
.
channel
.
a
peer_if
=
self
.
channel
.
a
return
peer_if
return
peer_if
T
=
tp
.
TypeVar
(
"T"
)
@
staticmethod
def
filter_by_type
(
interfaces
:
list
[
Interface
],
ty
:
type
[
T
])
->
list
[
T
]:
return
list
(
filter
(
lambda
inf
:
isinstance
(
inf
,
ty
),
interfaces
))
class
Channel
(
util_base
.
IdObj
):
class
Channel
(
util_base
.
IdObj
):
...
...
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