Commit 85320d12 authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

run pre-commit hooks and fix linter errors

parent d6a8c2d1
......@@ -19,12 +19,18 @@
# 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.
"""Simple example experiment, which sets up a client and a server host connected
through a switch. The client pings the server."""
"""
Simple example experiment, which sets up a client and a server host connected
through a switch.
The client pings the server.
"""
from simbricks.orchestration.simulators import Gem5Host, I40eNIC, SwitchNet
from simbricks.orchestration.nodeconfig import I40eLinuxNode, IdleHost, PingClient
from simbricks.orchestration.experiments import Experiment
from simbricks.orchestration.nodeconfig import (
I40eLinuxNode, IdleHost, PingClient
)
from simbricks.orchestration.simulators import Gem5Host, I40eNIC, SwitchNet
e = Experiment(name='simple_ping')
e.checkpoint = True # use checkpoint and restore to speed up simulation
......
......@@ -30,7 +30,11 @@ from simbricks.orchestration.simulators import (
class Experiment(object):
"""Base class for all simulation experiments. Contains the simulators to be run and experiment-wide parameters."""
"""
Base class for all simulation experiments.
Contains the simulators to be run and experiment-wide parameters.
"""
def __init__(self, name: str):
self.name = name
......@@ -43,7 +47,9 @@ class Experiment(object):
self.checkpoint = False
"""Whether to use checkpoint and restore for simulators.
The most common use-case for this is accelerating host simulator startup by first running in a less accurate mode, then checkpointing the system state after boot and running simulations from there."""
The most common use-case for this is accelerating host simulator startup
by first running in a less accurate mode, then checkpointing the system
state after boot and running simulations from there."""
self.no_simbricks = False
"""If `true`, no simbricks adapters are used in any of the
simulators."""
......@@ -96,8 +102,7 @@ class Experiment(object):
return mem
def resreq_cores(self):
"""Number of Cores required to run all simulators in this
experiment."""
"""Number of Cores required to run all simulators in this experiment."""
cores = 0
for s in self.all_simulators():
cores += s.resreq_cores()
......
......@@ -45,11 +45,13 @@ class AppConfig():
return []
def config_files(self) -> tp.Dict[str, tp.IO]:
"""Additional files to put inside the node, for example, necessary
config files or kernel modules.
"""
Additional files to put inside the node, for example, necessary config
files or kernel modules.
Specified in the following format: `filename_inside_node`: `IO_handle_to
read_file`"""
read_file`
"""
return {}
def strfile(self, s: str):
......@@ -142,11 +144,13 @@ class NodeConfig():
return []
def config_files(self) -> tp.Dict[str, tp.IO]:
"""Additional files to put inside the node, for example, necessary
config files or kernel modules.
"""
Additional files to put inside the node, for example, necessary config
files or kernel modules.
Specified in the following format: `filename_inside_node`: `IO_handle_to
read_file`"""
read_file`
"""
return self.app.config_files()
def strfile(self, s: str):
......
......@@ -113,7 +113,8 @@ 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."""
"""Ethernet latency in nanoseconds from this NIC to the network
component."""
def set_network(self, net: NetSim):
"""Connect this NIC to a network simulator."""
......@@ -159,9 +160,11 @@ class NetSim(Simulator):
self.opt = ''
self.sync_mode = 0
self.sync_period = 500
"""Synchronization period in nanoseconds from this network to connected components."""
"""Synchronization period in nanoseconds from this network to connected
components."""
self.eth_latency = 500
"""Ethernet latency in nanoseconds from this network to connected components."""
"""Ethernet latency in nanoseconds from this network to connected
components."""
self.nics: list[NICSim] = []
self.hosts_direct: list[HostSim] = []
self.net_listen: list[NetSim] = []
......@@ -210,8 +213,9 @@ class HostSim(Simulator):
"""System configuration for this simulated host. """
self.wait = False
"""
`True` - Wait for this simulator to finish execution.
`False` - Don't wait and instead shutdown the simulator as soon as all other awaited simulators have completed execution.
`True` - Wait for this simulator to finish execution. `False` - Don't
wait and instead shutdown the simulator as soon as all other awaited
simulators have completed execution.
"""
self.sleep = 0
self.cpu_freq = '8GHz'
......
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