orchestration.rst 9.22 KB
Newer Older
Antoine Kaufmann's avatar
Antoine Kaufmann committed
1
..
Antoine Kaufmann's avatar
Antoine Kaufmann committed
2
  Copyright 2022 Max Planck Institute for Software Systems, and
Antoine Kaufmann's avatar
Antoine Kaufmann committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  National University of Singapore
..
  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
  "Software"), to deal in the Software without restriction, including
  without limitation the rights to use, copy, modify, merge, publish,
  distribute, sublicense, and/or sell copies of the Software, and to
  permit persons to whom the Software is furnished to do so, subject to
  the following conditions:
..
  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.
..
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  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.

24
25
.. _sec-orchestration:

26
###################################
Antoine Kaufmann's avatar
Antoine Kaufmann committed
27
SimBricks Orchestration
28
29
###################################

30
31
32
33
34
35
36
Our orchestration framework replaces hand-crafted scripts for setting up and
running experiments. Instead, they are described in a declarative fashion. The
orchestration framework then takes care of the details managing launching the
respective component simulators, setting up the SimBricks communication channels
between them, and monitoring their execution. All output is collected in a JSON
file, which allows post-processing afterwards. 

Antoine Kaufmann's avatar
Antoine Kaufmann committed
37
38
39
40
******************************
Concepts
******************************

41
42
43
To declare experiments, we use multiple important concepts and terminology,
which we now introduce.

Antoine Kaufmann's avatar
Antoine Kaufmann committed
44
45
46
Experiments
===========

47
48
49
50
51
52
53
54
55
An *experiment* defines which component simulators to run, how they are
connected, and which workload is executed. To define an experiment, instantiate
the class :class:`~simbricks.orchestration.experiments.Experiment` in your own
Python module, which has member functions to further define the component
simulators to run. SimBricks comes with many pre-defined experiments, which can serve as starting guides and are located in the repository under ``experiments/pyexps``.

.. autoclass:: simbricks.orchestration.experiments.Experiment
  :members: add_host, add_pcidev, add_nic, add_network

Antoine Kaufmann's avatar
Antoine Kaufmann committed
56
57
58
Runs
====

59
60
61
62
63
64
65
66
67
68
69
Experiments can be executed multiple times, for example, to gain statistical
insights when including a random or non-deterministic component. We call each
execution one *run* of the experiment. Each run produces its own output JSON
file. The file name includes the number of the run.

The number of runs can be specified when invoking the orchestration framework,
see :ref:`sec-command-line`. When using simulator checkpointing, we use one run
to boot the simulator and take the checkpoint, and a second one to execute the
actual experiment. This is the reason for two output JSON files being produced.
For more information, see :ref:`sec-checkpointing`.

Antoine Kaufmann's avatar
Antoine Kaufmann committed
70
71
72
Component Simulators
====================

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
SimBricks provides multiple already implemented component simulators, which
can be used in experiments. This selection includes host, NIC, network, and PCI
device simulators. Each simulator is implemented in a class deriving from
:class:`~simbricks.orchestration.simulators.Simulator`, which provides the
necessary commands and arguments for its execution and for specifying the
SimBricks communication channel to connect to. We also offer more specialized
base classes for the different component types, which implement common member
functions, for example, add connected NICs or network component simulators to a
host component simulator. Every already implemented component simulator can be
found in the module. :mod:`simbricks.orchestration.simulators`.

.. automodule:: simbricks.orchestration.simulators

  .. autoclass:: simbricks.orchestration.simulators.Simulator
    :members: resreq_cores, resreq_mem, prep_cmds, run_cmd, dependencies

  .. autoclass:: simbricks.orchestration.simulators.HostSim
    :members: add_pcidev, add_nic, add_netdirect

  .. autoclass:: simbricks.orchestration.simulators.NICSim
    :members: set_network

  .. autoclass:: simbricks.orchestration.simulators.NetSim
    :members: connect_network

  .. autoclass:: simbricks.orchestration.simulators.PCIDevSim


.. _sec-node_configuration:

Antoine Kaufmann's avatar
Antoine Kaufmann committed
103
104
105
Node Configuration
==================

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
The configuration and workload to run on individual host simulators or, more
generally, nodes that should run in the experiment, are defined using the
classes :class:`~simbricks.orchestration.nodeconfig.NodeConfig` and
:class:`~simbricks.orchestration.nodeconfig.AppConfig`, respectively.

:class:`~simbricks.orchestration.nodeconfig.NodeConfig` defines, for example,
the networking configuration like IP address and subnet mask, how much system
memory the node has, and which disk image to run. The latter can be used, for
example, to run a specific version of the Linux kernel on a node. You can find
more information on this in the :ref:`next section <sec-howto-custom_image>`.
:class:`~simbricks.orchestration.nodeconfig.NodeConfig` contains an attribute
for a :class:`~simbricks.orchestration.nodeconfig.AppConfig`.

.. automodule:: simbricks.orchestration.nodeconfig

  .. autoclass:: simbricks.orchestration.nodeconfig.NodeConfig
    :members: ip, prefix, mtu, cores, memory, disk_image, app, run_cmds, cleanup_cmds, config_files 


.. _sec-app_configuration:

Antoine Kaufmann's avatar
Antoine Kaufmann committed
127
128
129
Application Configuration
-------------------------

130
131
132
133
134
135
136
137
138
139
140
141
The class :class:`~simbricks.orchestration.nodeconfig.AppConfig` offers member
functions to define the concrete commands to run on the node. It also provides a
member function
:meth:`~simbricks.orchestration.nodeconfig.AppConfig.config_files` to specify
additional files to be made available on the host, which are specified as key
value pairs, where the key represents the filename inside the simulated guest
system and the value is an IO handle to the file on the host running the
simulators.

  .. autoclass:: simbricks.orchestration.nodeconfig.AppConfig
    :members: run_cmds, config_files

Antoine Kaufmann's avatar
Antoine Kaufmann committed
142
143
144
145
146

******************************
Running Experiments
******************************

147
148
149

.. _sec-command-line:

Antoine Kaufmann's avatar
Antoine Kaufmann committed
150
151
152
Command Line
====================

153
154
155
156
To run experiments using our orchestration framework, use the
``experiments/run.py`` script. For your convenience, you can also use
``simbricks-run`` in the Docker images from anywhere to run experiments. In
practice, running experiments will look similar to this:
157

158
.. code-block:: bash
Antoine Kaufmann's avatar
Antoine Kaufmann committed
159

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
  $ python3.10 run.py --verbose --force pyexps/qemu_i40e_pair.py
  # only available inside docker images
  $ simbricks-run --verbose --force qemu_i40e_pair.py

Here are all the command line arguments for the ``experiments/run.py`` script:

.. code-block:: text

  usage: run.py [-h] [--list] [--filter PATTERN [PATTERN ...]] [--pickled] [--runs N]
                [--firstrun N] [--force] [--verbose] [--pcap] [--repo DIR] [--workdir DIR]
                [--outdir DIR] [--cpdir DIR] [--hosts JSON_FILE] [--shmdir DIR]
                [--parallel] [--cores N] [--mem N] [--slurm] [--slurmdir DIR] [--dist]
                [--auto-dist] [--proxy-type TYPE]
                EXP [EXP ...]

  positional arguments:
    EXP                   Python modules to load the experiments from

  options:
    -h, --help            show this help message and exit
    --list                List available experiment names
    --filter PATTERN [PATTERN ...]
                          Only run experiments matching the given Unix shell style patterns
    --pickled             Interpret experiment modules as pickled runs instead of .py files
    --runs N              Number of repetition of each experiment
    --firstrun N          ID for first run
    --force               Run experiments even if output already exists (overwrites output)
    --verbose             Verbose output, for example, print component simulators\' output
    --pcap                Dump pcap file (if supported by component simulator)

  Environment:
    --repo DIR            SimBricks repository directory
    --workdir DIR         Work directory base
    --outdir DIR          Output directory base
    --cpdir DIR           Checkpoint directory base
    --hosts JSON_FILE     List of hosts to use (json)
    --shmdir DIR          Shared memory directory base (workdir if not set)

  Parallel Runtime:
    --parallel            Use parallel instead of sequential runtime
    --cores N             Number of cores to use for parallel runs
    --mem N               Memory limit for parallel runs (in MB)

  Slurm Runtime:
    --slurm               Use slurm instead of sequential runtime
    --slurmdir DIR        Slurm communication directory

  Distributed Runtime:
    --dist                Use sequential distributed runtime instead of local
    --auto-dist           Automatically distribute non-distributed experiments
    --proxy-type TYPE     Proxy type to use (sockets,rdma) for auto distribution
211
212

******************************
Antoine Kaufmann's avatar
Antoine Kaufmann committed
213
Images
214
215
216
217
******************************


******************************
Antoine Kaufmann's avatar
Antoine Kaufmann committed
218
Distributed Simulations
219
220
221
222
******************************


******************************
Antoine Kaufmann's avatar
Antoine Kaufmann committed
223
Slurm
224
******************************