"driver/src/conv_driver.cpp" did not exist on "00089cd6e579d159bf452334e54510a521327cf8"
Commit 5d6992d5 authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

improve docstrings for simulators

parent 77a9296c
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # 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 import typing as tp
...@@ -47,7 +47,7 @@ def create_basic_hosts( ...@@ -47,7 +47,7 @@ def create_basic_hosts(
parameters. parameters.
Args: Args:
`num`: number of hosts to create num: number of hosts to create
""" """
hosts: tp.List[HostSim] = [] hosts: tp.List[HostSim] = []
......
...@@ -113,8 +113,10 @@ class NICSim(PCIDevSim): ...@@ -113,8 +113,10 @@ class NICSim(PCIDevSim):
self.network: tp.Optional[NetSim] = None self.network: tp.Optional[NetSim] = None
self.mac: tp.Optional[str] = None self.mac: tp.Optional[str] = None
self.eth_latency = 500 self.eth_latency = 500
"""Ethernet latency in nanoseconds from this NIC to the network component."""
def set_network(self, net: NetSim): def set_network(self, net: NetSim):
"""Connect this NIC to a network simulator."""
self.network = net self.network = net
net.nics.append(self) net.nics.append(self)
...@@ -158,7 +160,9 @@ class NetSim(Simulator): ...@@ -158,7 +160,9 @@ class NetSim(Simulator):
self.opt = '' self.opt = ''
self.sync_mode = 0 self.sync_mode = 0
self.sync_period = 500 self.sync_period = 500
"""Synchronization period in nanoseconds from this network to connected components."""
self.eth_latency = 500 self.eth_latency = 500
"""Ethernet latency in nanoseconds from this network to connected components."""
self.nics: list[NICSim] = [] self.nics: list[NICSim] = []
self.hosts_direct: list[HostSim] = [] self.hosts_direct: list[HostSim] = []
self.net_listen: list[NetSim] = [] self.net_listen: list[NetSim] = []
...@@ -204,12 +208,12 @@ class HostSim(Simulator): ...@@ -204,12 +208,12 @@ class HostSim(Simulator):
def __init__(self, node_config: NodeConfig): def __init__(self, node_config: NodeConfig):
super().__init__() super().__init__()
self.node_config = node_config self.node_config = node_config
"""Config for the simulated host. """ """System configuration for this simulated host. """
self.name = '' self.name = ''
self.wait = False self.wait = False
""" """
`True` - Wait for process of simulator to exit. `True` - Wait for this simulator to finish execution.
`False` - Don't wait and instead stop the process. `False` - Don't wait and instead shutdown the simulator as soon as all other awaited simulators have completed execution.
""" """
self.sleep = 0 self.sleep = 0
self.cpu_freq = '8GHz' self.cpu_freq = '8GHz'
...@@ -229,13 +233,16 @@ class HostSim(Simulator): ...@@ -229,13 +233,16 @@ class HostSim(Simulator):
return 'host.' + self.name return 'host.' + self.name
def add_nic(self, dev: NICSim): def add_nic(self, dev: NICSim):
"""Add a NIC to this host."""
self.add_pcidev(dev) self.add_pcidev(dev)
def add_pcidev(self, dev: PCIDevSim): def add_pcidev(self, dev: PCIDevSim):
"""Add a PCIe device to this host."""
dev.name = self.name + '.' + dev.name dev.name = self.name + '.' + dev.name
self.pcidevs.append(dev) self.pcidevs.append(dev)
def add_netdirect(self, net: NetSim): def add_netdirect(self, net: NetSim):
"""Add a direct connection to a network to this host."""
net.hosts_direct.append(self) net.hosts_direct.append(self)
self.net_directs.append(net) self.net_directs.append(net)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment