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
5d6992d5
Commit
5d6992d5
authored
Oct 21, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Nov 17, 2022
Browse files
improve docstrings for simulators
parent
77a9296c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
experiments/simbricks/orchestration/simulator_utils.py
experiments/simbricks/orchestration/simulator_utils.py
+2
-2
experiments/simbricks/orchestration/simulators.py
experiments/simbricks/orchestration/simulators.py
+10
-3
No files found.
experiments/simbricks/orchestration/simulator_utils.py
View file @
5d6992d5
...
...
@@ -19,7 +19,7 @@
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Provides
utility
functions for assembling host simulators."""
"""Provides
helper
functions for assembling
multiple
host simulators."""
import
typing
as
tp
...
...
@@ -47,7 +47,7 @@ def create_basic_hosts(
parameters.
Args:
`
num
`
: number of hosts to create
num: number of hosts to create
"""
hosts
:
tp
.
List
[
HostSim
]
=
[]
...
...
experiments/simbricks/orchestration/simulators.py
View file @
5d6992d5
...
...
@@ -113,8 +113,10 @@ class NICSim(PCIDevSim):
self
.
network
:
tp
.
Optional
[
NetSim
]
=
None
self
.
mac
:
tp
.
Optional
[
str
]
=
None
self
.
eth_latency
=
500
"""Ethernet latency in nanoseconds from this NIC to the network component."""
def
set_network
(
self
,
net
:
NetSim
):
"""Connect this NIC to a network simulator."""
self
.
network
=
net
net
.
nics
.
append
(
self
)
...
...
@@ -158,7 +160,9 @@ class NetSim(Simulator):
self
.
opt
=
''
self
.
sync_mode
=
0
self
.
sync_period
=
500
"""Synchronization period in nanoseconds from this network to connected components."""
self
.
eth_latency
=
500
"""Ethernet latency in nanoseconds from this network to connected components."""
self
.
nics
:
list
[
NICSim
]
=
[]
self
.
hosts_direct
:
list
[
HostSim
]
=
[]
self
.
net_listen
:
list
[
NetSim
]
=
[]
...
...
@@ -204,12 +208,12 @@ class HostSim(Simulator):
def
__init__
(
self
,
node_config
:
NodeConfig
):
super
().
__init__
()
self
.
node_config
=
node_config
"""
Config
for th
e
simulated host. """
"""
System configuration
for th
is
simulated host. """
self
.
name
=
''
self
.
wait
=
False
"""
`True` - Wait for
process of
simulator to
exit
.
`False` - Don't wait and instead s
top the process
.
`True` - Wait for
this
simulator to
finish execution
.
`False` - Don't wait and instead s
hutdown the simulator as soon as all other awaited simulators have completed execution
.
"""
self
.
sleep
=
0
self
.
cpu_freq
=
'8GHz'
...
...
@@ -229,13 +233,16 @@ class HostSim(Simulator):
return
'host.'
+
self
.
name
def
add_nic
(
self
,
dev
:
NICSim
):
"""Add a NIC to this host."""
self
.
add_pcidev
(
dev
)
def
add_pcidev
(
self
,
dev
:
PCIDevSim
):
"""Add a PCIe device to this host."""
dev
.
name
=
self
.
name
+
'.'
+
dev
.
name
self
.
pcidevs
.
append
(
dev
)
def
add_netdirect
(
self
,
net
:
NetSim
):
"""Add a direct connection to a network to this host."""
net
.
hosts_direct
.
append
(
self
)
self
.
net_directs
.
append
(
net
)
...
...
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