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
02782735
Commit
02782735
authored
Jun 24, 2024
by
Hejing Li
Committed by
Jonas Kaufmann
Aug 20, 2024
Browse files
add simobject as base class
parent
23b52514
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
experiments/simbricks/splitsim/impl.py
experiments/simbricks/splitsim/impl.py
+1
-1
experiments/simbricks/splitsim/specification.py
experiments/simbricks/splitsim/specification.py
+36
-17
No files found.
experiments/simbricks/splitsim/impl.py
View file @
02782735
...
...
@@ -181,7 +181,7 @@ class I40eNicSim(Simulator):
cmd
=
(
f
'
{
env
.
dev_pci_path
(
self
)
}
{
env
.
nic_eth_path
(
self
)
}
'
f
'
{
env
.
dev_shm_path
(
self
)
}
{
self
.
nics
[
0
].
sync
}
{
self
.
start_tick
}
'
f
'
{
self
.
nics
[
0
].
eth_channel
.
sync_period
}
{
self
.
nics
[
0
].
pci_channel
.
latency
}
{
self
.
nics
[
0
].
eth_channel
.
latency
}
'
f
'
{
self
.
nics
[
0
].
sync_period
}
{
self
.
nics
[
0
].
pci_channel
.
latency
}
{
self
.
nics
[
0
].
eth_channel
.
latency
}
'
)
if
self
.
nics
[
0
].
mac
is
not
None
:
cmd
+=
' '
+
(
''
.
join
(
reversed
(
self
.
nics
[
0
].
mac
.
split
(
':'
))))
...
...
experiments/simbricks/splitsim/specification.py
View file @
02782735
...
...
@@ -17,10 +17,11 @@ class SimObject():
def
__init__
(
self
)
->
None
:
self
.
sync_period
=
500
#nano second
class
Channel
():
class
Channel
(
SimObject
):
def
__init__
(
self
)
->
None
:
super
().
__init__
()
self
.
latency
=
500
# nano second
self
.
sync_period
=
500
# nano second
def
install
(
self
,
end_point0
,
end_point1
)
->
None
:
return
...
...
@@ -56,20 +57,23 @@ class Eth(Channel):
netdev1
.
eth_channel
=
self
class
Host
():
class
Host
(
SimObject
):
id_iter
=
itertools
.
count
()
def
__init__
(
self
,
sys
)
->
None
:
super
().
__init__
()
self
.
id
=
next
(
self
.
id_iter
)
sys
.
hosts
.
append
(
self
)
self
.
sync
=
True
self
.
pci_channel
:
PCI
=
None
self
.
nics
:
tp
.
List
[
NIC
]
=
[]
self
.
nic_driver
=
[
'i40e'
]
self
.
sim
=
None
self
.
nic_driver
=
[
'i40e'
]
# HostSim & NodeConfig parameters
self
.
sync
=
True
"""Synchronization mode. False is running unsynchronized, True synchronized."""
self
.
cpu_freq
=
'3GHz'
"""Simulated host frequency"""
self
.
ip
=
'10.0.0.1'
"""IP address."""
self
.
prefix
=
24
...
...
@@ -90,6 +94,8 @@ class Host():
"""TCP Congestion Control algorithm to use."""
self
.
app
:
tp
.
Optional
[
AppConfig
]
=
None
"""Application to run on simulated host."""
self
.
kcmd_append
=
''
"""String to be appended to kernel command line."""
self
.
nockp
=
0
"""Do not create a checkpoint in Gem5."""
...
...
@@ -121,14 +127,14 @@ class Host():
cfg_f
.
close
()
# add additional config files
#
for (n, f) in self.config_files().items():
#
f_i = tarfile.TarInfo('guest/' + n)
#
f_i.mode = 0o777
#
f.seek(0, io.SEEK_END)
#
f_i.size = f.tell()
#
f.seek(0, io.SEEK_SET)
#
tar.addfile(tarinfo=f_i, fileobj=f)
#
f.close()
for
(
n
,
f
)
in
self
.
config_files
().
items
():
f_i
=
tarfile
.
TarInfo
(
'guest/'
+
n
)
f_i
.
mode
=
0o777
f
.
seek
(
0
,
io
.
SEEK_END
)
f_i
.
size
=
f
.
tell
()
f
.
seek
(
0
,
io
.
SEEK_SET
)
tar
.
addfile
(
tarinfo
=
f_i
,
fileobj
=
f
)
f
.
close
()
def
run_cmds
(
self
)
->
tp
.
List
[
str
]:
...
...
@@ -139,6 +145,16 @@ class Host():
"""Commands to run to cleanup node."""
return
[]
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
"""
Additional files to put inside the node, which are mounted under
`/tmp/guest/`.
Specified in the following format: `filename_inside_node`:
`IO_handle_of_file`
"""
return
self
.
app
.
config_files
()
def
prepare_pre_cp
(
self
)
->
tp
.
List
[
str
]:
"""Commands to run to prepare node before checkpointing."""
return
[
...
...
@@ -192,9 +208,10 @@ class LinuxHost(Host):
Pci device NIC
It has both pci and eth channel
"""
class
NIC
():
class
NIC
(
SimObject
):
id_iter
=
itertools
.
count
()
def
__init__
(
self
,
sys
)
->
None
:
super
().
__init__
()
self
.
id
=
next
(
self
.
id_iter
)
sys
.
nics
.
append
(
self
)
self
.
sync
=
True
...
...
@@ -217,9 +234,10 @@ class i40eNIC(NIC):
Network device
It only has eth channel
"""
class
NetDev
():
class
NetDev
(
SimObject
):
id_iter
=
itertools
.
count
()
def
__init__
(
self
)
->
None
:
super
().
__init__
()
self
.
id
=
next
(
self
.
id_iter
)
self
.
switch
:
Switch
=
None
self
.
sync
=
True
...
...
@@ -230,9 +248,10 @@ class NetDev():
self
.
sim
=
None
class
Switch
():
class
Switch
(
SimObject
):
id_iter
=
itertools
.
count
()
def
__init__
(
self
,
sys
)
->
None
:
super
().
__init__
()
self
.
id
=
next
(
self
.
id_iter
)
sys
.
switches
.
append
(
self
)
self
.
sync
=
True
...
...
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