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
ea40270e
Commit
ea40270e
authored
Aug 11, 2023
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Sep 04, 2023
Browse files
howto.rst: pass over existing content
parent
78685ea5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
43 deletions
+32
-43
doc/user/howto.rst
doc/user/howto.rst
+32
-43
No files found.
doc/user/howto.rst
View file @
ea40270e
...
@@ -66,21 +66,20 @@ take a look at the module :mod:`simbricks.orchestration.simulator_utils` in
...
@@ -66,21 +66,20 @@ take a look at the module :mod:`simbricks.orchestration.simulator_utils` in
which we provide some helper functions to reduce the amount of code you have to
which we provide some helper functions to reduce the amount of code you have to
write.
write.
Finally, to run your experiment, invoke ``
<repository>/
experiments/run.py`` and
Finally, to run your experiment, invoke ``experiments/run.py`` and
provide the
provide the
path to your experiment module. In our docker containers, you can
path to your experiment module. In our docker containers, you can
also just use
also just use
the following command from anywhere:
the following command from anywhere:
.. code-block:: bash
.. code-block:: bash
$ simbricks-run --verbose --force <path_to_your_module.py>
$ simbricks-run --verbose --force <path_to_your_module.py>
``--verbose`` prints all simulators' output to the terminal and ``--force``
``--verbose`` prints all simulators' output to the terminal and ``--force``
forces execution even if there already exist result files for the
same
forces execution even if there already exist result files for the
experiment. If
experiment. If
``simbricks-run`` is not available, you can always do
``simbricks-run`` is not available, you can always do
.. code-block:: bash
.. code-block:: bash
# from the repository's root directory
$ cd experiments
$ cd experiments
$ python run.py --verbose --force <path_to_your_module.py>
$ python run.py --verbose --force <path_to_your_module.py>
...
@@ -105,19 +104,15 @@ basics to create and run your first experiment. Have fun.
...
@@ -105,19 +104,15 @@ basics to create and run your first experiment. Have fun.
Add a Node or Application Config
Add a Node or Application Config
********************************
********************************
The configuration for a host and the commands to run for your workload are
A host's configuration and the workload to run are defined via
defined via a :ref:`sec-node-config` and :ref:`sec-app-config`. SimBricks
:ref:`sec-node_app_config`. SimBricks already comes with a few examples in the
already offers some concrete implementations in the module
module :mod:`simbricks.orchestration.nodeconfig`. If they don't fit your
:mod:`simbricks.orchestration.nodeconfig`. If they don't fit your use-case, you
use-case, you need to add your own by overriding the pre-defined member
need to implement your own by overwriting the pre-defined member functions.
functions of :class:`~simbricks.orchestration.nodeconfig.NodeConfig` and
:class:`~simbricks.orchestration.nodeconfig.AppConfig`. The most notably is
When using one of our pre-defined node configs, you probably need to provide
your own app config to run the workload you have in mind. The easiest way is to
create a child class for that directly in your experiment module, and override
the methods of interest, most notably
:meth:`~simbricks.orchestration.nodeconfig.AppConfig.run_cmds`, which defines
:meth:`~simbricks.orchestration.nodeconfig.AppConfig.run_cmds`, which defines
the command t
hat is
execute
d to run your
application. Further information can
be
the command
s
t
o
execute
for your workload/
application. Further information can
found in the module :mod:`simbricks.orchestration.nodeconfig`.
be
found in the module :mod:`simbricks.orchestration.nodeconfig`
directly
.
.. _sec-howto-custom_image:
.. _sec-howto-custom_image:
...
@@ -131,39 +126,33 @@ Integrate a New Simulator
...
@@ -131,39 +126,33 @@ Integrate a New Simulator
The first step when integrating a new simulator into SimBricks is to implement a
The first step when integrating a new simulator into SimBricks is to implement a
SimBricks adapter for it. You can find the necessary information in the
SimBricks adapter for it. You can find the necessary information in the
:ref:`Simulator Adapters <Simulator Adapters>` section. After that, we need to
:ref:`Simulator Adapters <Simulator Adapters>` section. To then make running
add a class for the simulator in the SimBricks orchestration framework such that
experiments and setting up the communication channels with other simulators more
it can be used when defining experiments. This class basically wraps a command
convenient, add a class for the simulator to the orchestration framework that
for launching the simulator and needs to inherit from
inherits from :class:`~simbricks.orchestration.simulators.Simulator` or one of
:class:`~simbricks.orchestration.simulators.Simulator` and implement relevant
the more specialized base classes in :mod:`simbricks.orchestration.simulators`.
methods. There are several more specialized child classes in the module
In this class you define the command to execute the simulator together with
:mod:`simbricks.orchestration.simulators` for typical categories of simulators,
further parameters, for example, to connect to the communication channels with
which already offer the interfaces to collect parameters like which other
other simulators. Below is an example of what this looks like.
simulators to connect to necessary for creating the launch command. Examples are
:class:`~simbricks.orchestration.simulators.PCIDevSim`,
:class:`~simbricks.orchestration.simulators.NICSim`,
:class:`~simbricks.orchestration.simulators.NetSim`, and
:class:`~simbricks.orchestration.simulators.HostSim`. You can find an example
below of adding a class for the ``NS3`` network simulator.
.. code-block:: python
.. code-block:: python
:linenos:
:linenos:
:caption:
Class implementing the ``NS3`` network simulator in the SimBricks
:caption:
Orchestration framework class for WireNet, a simple Ethernet wire
orchestration framework
.
that attaches to the SimBricks Ethernet adapters of two simulators
.
class
NS3Bridg
eNet(NetSim):
class
Wir
eNet(NetSim):
def run_cmd(self, env):
def run_cmd(self, env):
ports = ''
connects = self.connect_sockets(env)
for (_, n) in self.connect_sockets(env):
assert len(connects) == 2
ports += '--CosimPort=' + n + ' '
cmd = (
cmd = (
f'{env.repodir}/sims/external/ns-3'
f'{env.repodir}/sims/net/wire/net_wire {connects[0][1]}'
f'/cosim-run.sh cosim cosim-bridge-example {ports} {self.opt}'
f' {connects[1][1]} {self.sync_mode} {self.sync_period}'
f' {self.eth_latency}'
)
)
print(cmd)
if env.pcap_file:
cmd += ' ' + env.pcap_file
return cmd
return cmd
...
...
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