Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cut some content of the old doc that was converted
[simgrid.git] / doc / doxygen / platform.doc
1 /*! @page platform Describing the virtual platform
2
3
4 @section pf_res Resource description
5
6 @subsection pf_res_computing Computing Resources
7
8
9 @subsubsection pf_tag_cluster <cluster>
10
11 ``<cluster />`` represents a machine-cluster. It is most commonly used
12 when one wants to define many hosts and a network quickly. Technically,
13 ``cluster`` is a meta-tag: <b>from the inner SimGrid point of
14 view, a cluster is a network zone where some optimized routing is defined</b>.
15 The default inner organization of the cluster is as follow:
16
17 @verbatim
18                  __________
19                 |          |
20                 |  router  |
21     ____________|__________|_____________ backbone
22       |   |   |              |     |   |
23     l0| l1| l2|           l97| l96 |   | l99
24       |   |   |   ........   |     |   |
25       |                                |
26     c-0.me                             c-99.me
27 @endverbatim
28
29 Here, a set of <b>host</b>s is defined. Each of them has a <b>link</b>
30 to a central backbone (backbone is a link itself, as a link can
31 be used to represent a switch, see the switch / link section
32 below for more details about it). A <b>router</b> allows to connect a
33 <b>cluster</b> to the outside world. Internally,
34 SimGrid treats a cluster as a network zone containing all hosts: the router is the default
35 gateway for the cluster.
36
37 There is an alternative organization, which is as follows:
38 @verbatim
39                  __________
40                 |          |
41                 |  router  |
42                 |__________|
43                     / | @
44                    /  |  @
45                l0 / l1|   @l2
46                  /    |    @
47                 /     |     @
48             host0   host1   host2
49 @endverbatim
50
51 The principle is the same, except that there is no backbone. This representation
52 can be obtained easily: just do not set the bb_* attributes.
53
54
55 Attribute name  | Mandatory | Values | Description
56 --------------- | --------- | ------ | -----------
57 id              | yes       | string | The identifier of the cluster. Facilitates referring to this cluster.
58 prefix          | yes       | string | Each node of the cluster has to have a name. This name will be prefixed with this prefix.
59 suffix          | yes       | string | Each node of the cluster will be suffixed with this suffix
60 radical         | yes       | string | Regexp used to generate cluster nodes name. Syntax: "10-20" will give you 11 machines numbered from 10 to 20, "10-20;2" will give you 12 machines, one with the number 2, others numbered as before. The produced number is concatenated between prefix and suffix to form machine names.
61 speed           | yes       | int    | Same as the ``speed`` attribute of the ``@<host@>`` tag.
62 core            | no        | int (default: 1) | Same as the ``core`` attribute of the ``@<host@>`` tag.
63 bw              | yes       | int    | Bandwidth for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
64 lat             | yes       | int    | Latency for the links between nodes and backbone (if any). See <b>link</b> section for syntax/details.
65 sharing_policy  | no        | string | Sharing policy for the links between nodes and backbone (if any). See <b>link</b> section for syntax/details.
66 bb_bw           | no        | int    | Bandwidth for backbone (if any). See <b>link</b> section for syntax/details. If bb_bw and bb_lat (see below) attributes are omitted, no backbone is created (alternative cluster architecture <b>described before</b>).
67 bb_lat          | no        | int    | Latency for backbone (if any). See <b>link</b> section for syntax/details. If bb_lat and bb_bw (see above) attributes are omitted, no backbone is created (alternative cluster architecture <b>described before</b>).
68 bb_sharing_policy | no      | string | Sharing policy for the backbone (if any). See <b>link</b> section for syntax/details.
69 limiter_link      | no        | int    | Bandwidth for limiter link (if any). This adds a specific link for each node, to set the maximum bandwidth reached when communicating in both directions at the same time. In theory this value should be 2*bw for splitduplex links, but in reality this might be less. This value will depend heavily on the communication model, and on the cluster's hardware, so no default value can be set, this has to be measured. More details can be obtained in <a href="https://hal.inria.fr/hal-00919507/"> "Toward Better Simulation of MPI Applications on Ethernet/TCP Networks"</a>
70 loopback_bw       | no      | int    | Bandwidth for loopback (if any). See <b>link</b> section for syntax/details. If loopback_bw and loopback_lat (see below) attributes are omitted, no loopback link is created and all intra-node communication will use the main network link of the node. Loopback link is a @ref pf_sharing_policy_fatpipe "@b FATPIPE".
71 loopback_lat      | no      | int    | Latency for loopback (if any). See <b>link</b> section for syntax/details. See loopback_bw for more info.
72 topology          | no      | FLAT@|TORUS@|FAT_TREE@|DRAGONFLY (default: FLAT) | Network topology to use. SimGrid currently supports FLAT (with or without backbone, as described before), <a href="http://en.wikipedia.org/wiki/Torus_interconnect">TORUS </a>, FAT_TREE, and DRAGONFLY attributes for this tag.
73 topo_parameters   | no      | string | Specific parameters to pass for the topology defined in the topology tag. For torus networks, comma-separated list of the number of nodes in each dimension of the torus. Please refer to the specific documentation for @ref simgrid::kernel::routing::FatTreeZone "FatTree NetZone", @ref simgrid::kernel::routing::DragonflyZone "Dragonfly NetZone".
74
75
76 the router name is defined as the resulting String in the following
77 java line of code:
78
79 @verbatim
80 router_name = prefix + clusterId + "_router" + suffix;
81 @endverbatim
82
83
84 #### Cluster example ####
85
86 Consider the following two (and independent) uses of the ``cluster`` tag:
87
88 @verbatim
89 <cluster id="my_cluster_1" prefix="" suffix="" radical="0-262144"
90          speed="1e9" bw="125e6" lat="5E-5"/>
91
92 <cluster id="my_cluster_2" prefix="c-" suffix=".me" radical="0-99"
93          speed="1e9" bw="125e6" lat="5E-5"
94          bb_bw="2.25e9" bb_lat="5E-4"/>
95 @endverbatim
96
97 The second example creates one router and 100 machines with the following names:
98 @verbatim
99 c-my_cluster_2_router.me
100 c-0.me
101 c-1.me
102 c-2.me
103 ...
104 c-99.me
105 @endverbatim
106
107 @subsubsection pf_cabinet &lt;cabinet&gt;
108
109 @note
110     This tag is only available when the routing mode of the network zone
111     is set to ``Cluster``.
112
113 The ``&lt;cabinet /&gt;`` tag is, like the @ref pf_tag_cluster "&lt;cluster&gt;" tag,
114 a meta-tag. This means that it is simply a shortcut for creating a set of (homogenous) hosts and links quickly;
115 unsurprisingly, this tag was introduced to setup cabinets in data centers quickly. Unlike
116 &lt;cluster&gt;, however, the &lt;cabinet&gt; assumes that you create the backbone
117 and routers yourself; see our examples below.
118
119 #### Attributes ####
120
121 Attribute name  | Mandatory | Values | Description
122 --------------- | --------- | ------ | -----------
123 id              | yes       | string | The identifier of the cabinet. Facilitates referring to this cluster.
124 prefix          | yes       | string | Each node of the cabinet has to have a name. This name will be prefixed with this prefix.
125 suffix          | yes       | string | Each node of the cabinet will be suffixed with this suffix
126 radical         | yes       | string | Regexp used to generate cabinet nodes name. Syntax: "10-20" will give you 11 machines numbered from 10 to 20, "10-20;2" will give you 12 machines, one with the number 2, others numbered as before. The produced number is concatenated between prefix and suffix to form machine names.
127 speed           | yes       | int    | Same as the ``speed`` attribute of the @ref pf_tag_host "&lt;host&gt;" tag.
128 bw              | yes       | int    | Bandwidth for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
129 lat             | yes       | int    | Latency for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
130
131 @note
132     Please note that as of now, it is impossible to change attributes such as,
133     amount of cores (always set to 1), the sharing policy of the links (always set to @ref pf_sharing_policy_splitduplex "SPLITDUPLEX").
134
135 #### Example ####
136
137 The following example was taken from ``examples/platforms/meta_cluster.xml`` and
138 shows how to use the cabinet tag.
139
140 @verbatim
141   <zone  id="my_cluster1"  routing="Cluster">
142     <cabinet id="cabinet1" prefix="host-" suffix=".cluster1"
143       speed="1Gf" bw="125MBps" lat="100us" radical="1-10"/>
144     <cabinet id="cabinet2" prefix="host-" suffix=".cluster1"
145       speed="1Gf" bw="125MBps" lat="100us" radical="11-20"/>
146     <cabinet id="cabinet3" prefix="host-" suffix=".cluster1"
147       speed="1Gf" bw="125MBps" lat="100us" radical="21-30"/>
148
149     <backbone id="backbone1" bandwidth="2.25GBps" latency="500us"/>
150   </zone>
151 @endverbatim
152
153 @note
154    Please note that you must specify the @ref pf_backbone "&lt;backbone&gt;"
155    tag by yourself; this is not done automatically and there are no checks
156    that ensure this backbone was defined.
157
158 The hosts generated in the above example are named host-1.cluster, host-2.cluster1
159 etc.
160
161
162 @subsection pf_ne Network equipments
163
164 There are two tags at all times available to represent network entities and
165 several other tags that are available only in certain contexts.
166 1. ``<link>``: Represents a entity that has a limited bandwidth, a
167     latency, and that can be shared according to TCP way to share this
168     bandwidth.
169 @remark
170   The concept of links in SimGrid may not be intuitive, as links are not
171   limited to connecting (exactly) two entities; in fact, you can have more than
172   two equipments connected to it. (In graph theoretical terms: A link in
173   SimGrid is not an edge, but a hyperedge)
174
175 2. ``<router/>``: Represents an entity that a message can be routed
176     to, but that is unable to execute any code. In SimGrid, routers have also
177     no impact on the performance: Routers do not limit any bandwidth nor
178     do they increase latency. As a matter of fact, routers are (almost) ignored
179     by the simulator when the simulation has begun.
180
181 3. ``<backbone/>``: This tag is only available when the containing network zone is
182                     used as a cluster (i.e., mode="Cluster")
183
184 @remark
185     If you want to represent an entity like a switch, you must use ``<link>`` (see section). Routers are used
186     to run some routing algorithm and determine routes (see Section @ref pf_routing for details).
187
188 @subsubsection pf_backbone <backbone/>
189
190 @note
191   This tag is <b>only available</b> when the containing network zone uses the "Cluster" routing mode!
192
193 Using this tag, you can designate an already existing link to be a backbone.
194
195 Attribute name  | Mandatory | Values | Description
196 --------------- | --------- | ------ | -----------
197 id              | yes       | string | Name of the link that is supposed to act as a backbone.
198
199 @subsection pf_storage Storage
200
201 @note
202   This is a prototype version that should evolve quickly, hence this
203   is just some doc valuable only at the time of writing.
204   This section describes the storage management under SimGrid ; nowadays
205   it's only usable with MSG. It relies basically on linux-like concepts.
206   You also may want to have a look to its corresponding section in 
207   @ref msg_file ; access functions are organized as a POSIX-like
208   interface.
209
210 @subsubsection pf_sto_conc Storage - Main Concepts
211
212 The storage facilities implemented in SimGrid help to model (and account for) 
213 storage devices, such as tapes, hard-drives, CD or DVD devices etc. 
214 A typical situation is depicted in the figure below:
215
216 @image html ./webcruft/storage_sample_scenario.png
217 @image latex ./webcruft/storage_sample_scenario.png "storage_sample_scenario" width=@textwidth
218
219 In this figure, two hosts called Bob and Alice are interconnected via a network
220 and each host is physically attached to a disk; it is not only possible for each host to
221 mount the disk they are attached to directly, but they can also mount disks
222 that are in a remote location. In this example, Bob mounts Alice's disk remotely
223 and accesses the storage via the network.
224
225 SimGrid provides 3 different entities that can be used to model setups
226 that include storage facilities:
227
228 Entity name     | Description
229 --------------- | -----------
230 @ref pf_storage_entity_storage_type "storage_type"    | Defines a template for a particular kind of storage (such as a hard-drive) and specifies important features of the storage, such as capacity, performance (read/write), contents, ... Different models of hard-drives use different storage_types (because the difference between an SSD and an HDD does matter), as they differ in some specifications (e.g., different sizes or read/write performance).
231 @ref pf_tag_storage "storage"        | Defines an actual instance of a storage type (disk, RAM, ...); uses a ``storage_type`` template (see line above) so that you don't need to re-specify the same details over and over again.
232 @ref pf_tag_mount "mount"          | Must be wrapped by a @ref pf_tag_host tag; declares which storage(s) this host has mounted and where (i.e., the mountpoint).
233
234
235 @anchor pf_storage_content_file
236 ### %Storage Content File ###
237
238 In order to assess exactly how much time is spent reading from the storage,
239 SimGrid needs to know what is stored on the storage device (identified by distinct (file-)name, like in a file system)
240 and what size this content has.
241
242 @note
243     The content file is never changed by the simulation; it is parsed once
244     per simulation and kept in memory afterwards. When the content of the
245     storage changes, only the internal SimGrid data structures change.
246
247 @anchor pf_storage_content_file_structure
248 #### Structure of a %Storage Content File ####
249
250 Here is an excerpt from two storage content file; if you want to see the whole file, check
251 the file ``examples/platforms/content/storage_content.txt`` that comes with the
252 SimGrid source code.
253
254 SimGrid essentially supports two different formats: UNIX-style filepaths should
255 follow the well known format:
256
257 @verbatim
258 /lib/libsimgrid.so.3.6.2  12710497
259 /bin/smpicc  918
260 /bin/smpirun  7292
261 /bin/smpif2c  1990
262 /bin/simgrid_update_xml  5018
263 /bin/graphicator  66986
264 /bin/simgrid-colorizer  2993
265 /bin/smpiff  820
266 /bin/tesh  356434
267 @endverbatim
268
269 Windows filepaths, unsurprisingly, use the windows style:
270
271 @verbatim
272 @Windows@avastSS.scr 41664
273 @Windows@bfsvc.exe 75264
274 @Windows@bootstat.dat 67584
275 @Windows@CoreSingleLanguage.xml 31497
276 @Windows@csup.txt 12
277 @Windows@dchcfg64.exe 335464
278 @Windows@dcmdev64.exe 93288
279 @endverbatim
280
281 @note
282     The different file formats come at a cost; in version 3.12 (and most likely
283     in later versions, too), copying files from windows-style storages to unix-style
284     storages (and vice versa) is not supported.
285
286 @anchor pf_storage_content_file_create
287 #### Generate a %Storage Content File ####
288
289 If you want to generate a storage content file based on your own filesystem (or at least a filesystem you have access to),
290 try running this command (works only on unix systems):
291
292 @verbatim
293 find . -type f -exec ls -1s --block=1 {} @; 2>/dev/null | awk '{ print $2 " " $1}' > ./content.txt
294 @endverbatim
295
296 @subsubsection pf_storage_entities The Storage Entities
297
298 These are the entities that you can use in your platform files to include
299 storage in your model. See also the list of our @ref pf_storage_example_files "example files";
300 these might also help you to get started.
301
302 @anchor pf_storage_entity_storage_type
303 #### @<storage_type@> ####
304
305 Attribute name  | Mandatory | Values | Description
306 --------------- | --------- | ------ | -----------
307 id              | yes       | string | Identifier of this storage_type; used when referring to it
308 model           | no        | string | In the future, this will allow to change the performance model to use
309 size            | yes       | string | Specifies the amount of available storage space; you can specify storage like "500GiB" or "500GB" if you want. (TODO add a link to all the available abbreviations)
310 content         | yes       | string | Path to a @ref pf_storage_content_file "Storage Content File" on your system. This file must exist.
311
312 This tag must contain some predefined model properties, specified via the &lt;model_prop&gt; tag. Here is a list,
313 see below for an example:
314
315 Property id     | Mandatory | Values | Description
316 --------------- | --------- | ------ | -----------
317 Bwrite          | yes       | string | Bandwidth for write access; in B/s (but you can also specify e.g. "30MBps")
318 Bread           | yes       | string | Bandwidth for read access; in B/s (but you can also specify e.g. "30MBps")
319
320 @note
321      A storage_type can also contain the <b>&lt;prop&gt;</b> tag. The &lt;prop&gt; tag allows you
322      to associate additional information to this &lt;storage_type&gt; and follows the
323      attribute/value schema; see the example below. You may want to use it to give information to
324      the tool you use for rendering your simulation, for example.
325
326 Here is a complete example for the ``storage_type`` tag:
327 @verbatim
328 <storage_type id="single_HDD" size="4000">
329   <model_prop id="Bwrite" value="30MBps" />
330   <model_prop id="Bread" value="100MBps" />
331   <prop id="Brand" value="Western Digital" />
332 </storage_type>
333 @endverbatim
334
335 @subsubsection pf_tag_storage &lt;storage&gt; 
336
337 Attributes     | Mandatory | Values | Description
338 -------------- | --------- | ------ | -----------
339 id             | yes       | string | Identifier of this ``storage``; used when referring to it
340 typeId         | yes       | string | Here you need to refer to an already existing @ref pf_storage_entity_storage_type "@<storage_type@>"; the storage entity defined by this tag will then inherit the properties defined there.
341 attach         | yes       | string | Name of a host (see Section @ref pf_tag_host) to which this storage is <i>physically</i> attached to (e.g., a hard drive in a computer)
342 content        | no        | string | When specified, overwrites the content attribute of @ref pf_storage_entity_storage_type "@<storage_type@>"
343
344 Here are two examples:
345
346 @verbatim
347      <storage id="Disk1" typeId="single_HDD" attach="bob" />
348
349      <storage id="Disk2" typeId="single_SSD"
350               content="content/win_storage_content.txt" />
351 @endverbatim
352
353 The first example is straightforward: A disk is defined and called "Disk1"; it is
354 of type "single_HDD" (shown as an example of @ref pf_storage_entity_storage_type "@<storage_type@>" above) and attached
355 to a host called "bob" (the definition of this host is omitted here).
356
357 The second storage is called "Disk2", is still of the same type as Disk1 but
358 now specifies a new content file (so the contents will be different from Disk1)
359 and the filesystem uses the windows style; finally, it is attached to a second host,
360 called alice (which is again not defined here).
361
362 @subsubsection pf_tag_mount &lt;mount&gt;
363
364 | Attribute   | Mandatory   | Values   | Description                                                                                               |
365 | ----------- | ----------- | -------- | -------------                                                                                             |
366 | id          | yes         | string   | Refers to a @ref pf_tag_storage "&lt;storage&gt;" entity that will be mounted on that computer |
367 | name        | yes         | string   | Path/location to/of the logical reference (mount point) of this disk
368
369 This tag must be enclosed by a @ref pf_tag_host tag. It then specifies where the mountpoint of a given storage device (defined by the ``id`` attribute)
370 is; this location is specified by the ``name`` attribute.
371
372 Here is a simple example, taken from the file ``examples/platform/storage.xml``:
373
374 @verbatim
375     <storage_type id="single_SSD" size="500GiB">
376        <model_prop id="Bwrite" value="60MBps" />
377        <model_prop id="Bread" value="200MBps" />
378     </storage_type>
379
380     <storage id="Disk2" typeId="single_SSD"
381               content="content/win_storage_content.txt"
382               attach="alice" />
383     <storage id="Disk4" typeId="single_SSD"
384              content="content/small_content.txt"
385              attach="denise"/>
386
387     <host id="alice" speed="1Gf">
388       <mount storageId="Disk2" name="c:"/>
389     </host>
390
391     <host id="denise" speed="1Gf">
392       <mount storageId="Disk2" name="c:"/>
393       <mount storageId="Disk4" name="/home"/>
394     </host>
395 @endverbatim
396
397 This example is quite interesting, as the same device, called "Disk2", is mounted by
398 two hosts at the same time! Note, however, that the host called ``alice`` is actually
399 attached to this storage, as can be seen in the @ref pf_tag_storage "&lt;storage&gt;"
400 tag. This means that ``denise`` must access this storage through the network, but SimGrid automatically takes
401 care of that for you.
402
403 Furthermore, this example shows that ``denise`` has mounted two storages with different
404 filesystem types (unix and windows). In general, a host can mount as many storage devices as
405 required.
406
407 @note
408     Again, the difference between ``attach`` and ``mount`` is simply that
409     an attached storage is always physically inside (or connected to) that machine;
410     for instance, a USB stick is attached to one and only one machine (where it's plugged-in)
411     but it can only be mounted on others, as mounted storage can also be a remote location.
412
413 ###### Example files #####
414
415 @verbinclude example_filelist_xmltag_mount
416
417 @subsubsection pf_storage_example_files Example files
418
419 Several examples were already discussed above; if you're interested in full examples,
420 check the the following platforms:
421
422 1. ``examples/platforms/storage.xml``
423 2. ``examples/platforms/remote_io.xml``
424
425 If you're looking for some examplary C code, you may find the source code
426 available in the directory ``examples/msg/io/`` useful.
427
428 @subsubsection pf_storage_examples_modelling Modelling different situations
429
430 The storage functionality of SimGrid is type-agnostic, that is, the implementation
431 does not presume any type of storage, such as HDDs/SSDs, RAM,
432 CD/DVD devices, USB sticks etc.
433
434 This allows the user to apply the simulator for a wide variety of scenarios; one
435 common scenario would be the access of remote RAM.
436
437 #### Modelling the access of remote RAM ####
438
439 How can this be achieved in SimGrid? Let's assume we have a setup where three hosts
440 (HostA, HostB, HostC) need to access remote RAM:
441
442 @verbatim
443       Host A
444     /
445 RAM -- Host B
446     @
447       Host C
448 @endverbatim
449
450 An easy way to model this scenario is to setup and define the RAM via the
451 @ref pf_tag_storage "storage" and @ref pf_storage_entity_storage_type "storage type"
452 entities and attach it to a remote dummy host; then, every host can have their own links
453 to this host (modelling for instance certain scenarios, such as PCIe ...)
454
455 @verbatim
456               Host A
457             /
458 RAM - Dummy -- Host B
459             @
460               Host C
461 @endverbatim
462
463 Now, if read from this storage, the host that mounts this storage
464 communicates to the dummy host which reads from RAM and
465 sends the information back.
466
467
468 @section pf_routing Routing
469
470 To achieve high performance, the routing tables used within SimGrid are
471 static. This means that routing between two nodes is calculated once
472 and will not change during execution. The SimGrid team chose to use this
473 approach as it is rare to have a real deficiency of a resource;
474 most of the time, a communication fails because the links experience too much
475 congestion and hence, your connection stops before the timeout or
476 because the computer designated to be the destination of that message
477 is not responding.
478
479 We also chose to use shortest paths algorithms in order to emulate
480 routing. Doing so is consistent with the reality: [RIP](https://en.wikipedia.org/wiki/Routing_Information_Protocol),
481 [OSPF](https://en.wikipedia.org/wiki/Open_Shortest_Path_First), [BGP](https://en.wikipedia.org/wiki/Border_Gateway_Protocol)
482 are all calculating shortest paths. They do require some time to converge, but
483 eventually, when the routing tables have stabilized, your packets will follow
484 the shortest paths.
485
486 @subsection  pf_tag_zone &lt;zone&gt;
487
488 @subsection pf_rm Routing models
489
490 For each network zone, you must define explicitly which routing model will
491 be used. There are 3 different categories for routing models:
492
493 1. @ref pf_routing_model_shortest_path "Shortest-path" based models: SimGrid calculates shortest
494    paths and manages them. Behaves more or less like most real life
495    routing mechanisms.
496 2. @ref pf_routing_model_manual "Manually-entered" route models: you have to define all routes
497    manually in the platform description file; this can become
498    tedious very quickly, as it is very verbose.
499    Consistent with some manually managed real life routing.
500 3. @ref pf_routing_model_simple "Simple/fast models": those models offer fast, low memory routing
501    algorithms. You should consider to use this type of model if 
502    you can make some assumptions about your network zone.
503    Routing in this case is more or less ignored.
504
505 @subsubsection pf_raf The router affair
506
507 Using routers becomes mandatory when using shortest-path based
508 models or when using the bindings to the ns-3 packet-level
509 simulator instead of the native analytical network model implemented
510 in SimGrid.
511
512 For graph-based shortest path algorithms, routers are mandatory, because these
513 algorithms require a graph as input and so we need to have source and
514 destination for each edge.
515
516 Routers are naturally an important concept ns-3 since the
517 way routers run the packet routing algorithms is actually simulated.
518 SimGrid's analytical models however simply aggregate the routing time
519 with the transfer time. 
520
521 So why did we incorporate routers in SimGrid? Rebuilding a graph representation
522 only from the route information turns out to be a very difficult task, because
523 of the missing information about how routes intersect. That is why we
524 introduced routers, which are simply used to express these intersection points.
525 It is important to understand that routers are only used to provide topological
526 information.
527
528 To express this topological information, a <b>route</b> has to be
529 defined in order to declare which link is connected to a router. 
530
531
532 @subsubsection pf_routing_model_shortest_path Shortest-path based models
533
534 The following table shows all the models that compute routes using
535 shortest-paths algorithms are currently available in SimGrid. More detail on how
536 to choose the best routing model is given in the Section called @"@ref pf_routing_howto_choose_wisely@".
537
538 | Name                                                | Description                                                                |
539 | --------------------------------------------------- | -------------------------------------------------------------------------- |
540 | @ref pf_routing_model_floyd "Floyd"                 | Floyd routing data. Pre-calculates all routes once                         |
541 | @ref pf_routing_model_dijkstra "Dijkstra"           | Dijkstra routing data. Calculates routes only when needed                  |
542 | @ref pf_routing_model_dijkstracache "DijkstraCache" | Dijkstra routing data. Handles some cache for already calculated routes.   |
543
544 All those shortest-path models are instanciated in the same way and are
545 completely interchangeable. Here are some examples:
546
547 @anchor pf_routing_model_floyd
548 ### Floyd ###
549
550 Floyd example:
551 @verbatim
552 <zone  id="zone0"  routing="Floyd">
553
554   <cluster id="my_cluster_1" prefix="c-" suffix=""
555            radical="0-1" speed="1000000000" bw="125000000" lat="5E-5"
556            router_id="router1"/>
557
558   <zone id="zone1" routing="None">
559     <host id="host1" speed="1000000000"/>
560   </zone>
561
562   <link id="link1" bandwidth="100000" latency="0.01"/>
563
564   <zoneroute src="my_cluster_1" dst="zone1"
565     gw_src="router1"
566     gw_dst="host1">
567     <link_ctn id="link1"/>
568   </zoneroute>
569
570 </zone>
571 @endverbatim
572
573 zoneroute given at the end gives a topological information: link1 is
574 between router1 and host1.
575
576 #### Example platform files ####
577
578 This is an automatically generated list of example files that use the Floyd
579 routing model (the path is given relative to SimGrid's source directory)
580
581 @verbinclude example_filelist_routing_floyd
582
583 @anchor pf_routing_model_dijkstra
584 ### Dijkstra ###
585
586 #### Example platform files ####
587
588 This is an automatically generated list of example files that use the Dijkstra
589 routing model (the path is given relative to SimGrid's source directory)
590
591 @verbinclude example_filelist_routing_dijkstra
592
593 Dijkstra example:
594 @verbatim
595  <zone id="zone_2" routing="Dijkstra">
596      <host id="zone_2_host1" speed="1000000000"/>
597      <host id="zone_2_host2" speed="1000000000"/>
598      <host id="zone_2_host3" speed="1000000000"/>
599      <link id="zone_2_link1" bandwidth="1250000000" latency="5E-4"/>
600      <link id="zone_2_link2" bandwidth="1250000000" latency="5E-4"/>
601      <link id="zone_2_link3" bandwidth="1250000000" latency="5E-4"/>
602      <link id="zone_2_link4" bandwidth="1250000000" latency="5E-4"/>
603      <router id="central_router"/>
604      <router id="zone_2_gateway"/>
605      <!-- routes providing topological information -->
606      <route src="central_router" dst="zone_2_host1"><link_ctn id="zone_2_link1"/></route>
607      <route src="central_router" dst="zone_2_host2"><link_ctn id="zone_2_link2"/></route>
608      <route src="central_router" dst="zone_2_host3"><link_ctn id="zone_2_link3"/></route>
609      <route src="central_router" dst="zone_2_gateway"><link_ctn id="zone_2_link4"/></route>
610   </zone>
611 @endverbatim
612
613 @anchor pf_routing_model_dijkstracache
614 ### DijkstraCache ###
615
616 DijkstraCache example:
617 @verbatim
618 <zone id="zone_2" routing="DijkstraCache">
619      <host id="zone_2_host1" speed="1000000000"/>
620      ...
621 (platform unchanged compared to upper example)
622 @endverbatim
623
624 #### Example platform files ####
625
626 This is an automatically generated list of example files that use the DijkstraCache
627 routing model (the path is given relative to SimGrid's source directory):
628
629 Editor's note: At the time of writing, no platform file used this routing model - so
630 if there are no example files listed here, this is likely to be correct.
631
632 @verbinclude example_filelist_routing_dijkstra_cache
633
634 @subsubsection pf_routing_model_manual Manually-entered route models
635
636 | Name                               | Description                                                                    |
637 | ---------------------------------- | ------------------------------------------------------------------------------ |
638 | @ref pf_routing_model_full "Full"  | You have to enter all necessary routers manually; that is, every single route. This may consume a lot of memory when the XML is parsed and might be tedious to write; i.e., this is only recommended (if at all) for small platforms. |
639
640 @anchor pf_routing_model_full
641 ### Full ###
642
643 Full example:
644 @verbatim
645 <zone  id="zone0"  routing="Full">
646    <host id="host1" speed="1000000000"/>
647    <host id="host2" speed="1000000000"/>
648    <link id="link1" bandwidth="125000000" latency="0.000100"/>
649    <route src="host1" dst="host2"><link_ctn id="link1"/></route>
650  </zone>
651 @endverbatim
652
653 #### Example platform files ####
654
655 This is an automatically generated list of example files that use the Full
656 routing model (the path is given relative to SimGrid's source directory):
657
658 @verbinclude example_filelist_routing_full
659
660 @subsubsection pf_routing_model_simple Simple/fast models
661
662 | Name                                     | Description                                                                                                                         |
663 | ---------------------------------------- | ------------------------------------------------------------------------------                                                      |
664 | @ref pf_routing_model_cluster "Cluster"  | This is specific to the @ref pf_tag_cluster "&lt;cluster/&gt;" tag and should not be used by the user, as several assumptions are made. |
665 | @ref pf_routing_model_none    "None"     | No routing at all. Unless you know what you're doing, avoid using this mode in combination with a non-constant network model.       |
666 | @ref pf_routing_model_vivaldi "Vivaldi"  | Perfect when you want to use coordinates. Also see the corresponding @ref pf_P2P_tags "P2P section" below.                          |
667
668 @anchor pf_routing_model_cluster
669 ### Cluster ###
670
671 @note
672  In this mode, the @ref pf_cabinet "&lt;cabinet/&gt;" tag is available.
673
674 #### Example platform files ####
675
676 This is an automatically generated list of example files that use the Cluster
677 routing model (the path is given relative to SimGrid's source directory):
678
679 @verbinclude example_filelist_routing_cluster
680
681 @anchor pf_routing_model_none
682
683 ### None ###
684
685 This model does exactly what it's name advertises: Nothing. There is no routing
686 available within this model and if you try to communicate within the zone that
687 uses this model, SimGrid will fail unless you have explicitly activated the
688 @ref options_model_select_network_constant "Constant Network Model" (this model charges
689 the same for every single communication). It should
690 be noted, however, that you can still attach an @ref pf_tag_zoneroute "ZoneRoute",
691 as is demonstrated in the example below:
692
693 @verbinclude platforms/cluster_and_one_host.xml
694
695 #### Example platform files ####
696
697 This is an automatically generated list of example files that use the None
698 routing model (the path is given relative to SimGrid's source directory):
699
700 @verbinclude example_filelist_routing_none
701
702
703 @anchor pf_routing_model_vivaldi
704 ### Vivaldi ###
705
706 For more information on how to use the [Vivaldi Coordinates](https://en.wikipedia.org/wiki/Vivaldi_coordinates),
707 see also Section @ref pf_P2P_tags "P2P tags".
708
709 Note that it is possible to combine the Vivaldi routing model with other routing models;
710 an example can be found in the file @c examples/platforms/cloud.xml. This
711 examples models a NetZone using Vivaldi that contains other NetZones that use different
712 routing models.
713
714 #### Example platform files ####
715
716 This is an automatically generated list of example files that use the None
717 routing model (the path is given relative to SimGrid's source directory):
718
719 @verbinclude example_filelist_routing_vivaldi
720
721
722 @subsection ps_dec Defining routes
723
724 There are currently four different ways to define routes: 
725
726 | Name                                              | Description                                                                         |
727 | ------------------------------------------------- | ----------------------------------------------------------------------------------- |
728 | @ref pf_tag_route "route"                 | Used to define route between host/router                                            |
729 | @ref pf_tag_zoneroute "zoneRoute"             | Used to define route between different zones                                           |
730 | @ref pf_tag_bypassroute "bypassRoute"     | Used to supersede normal routes as calculated by the network model between host/router; e.g., can be used to use a route that is not the shortest path for any of the shortest-path routing models. |
731 | @ref pf_tag_bypassasroute "bypassZoneRoute"  | Used in the same way as bypassRoute, but for zones                                     |
732
733 Basically all those tags will contain an (ordered) list of references
734 to link that compose the route you want to define.
735
736 Consider the example below:
737
738 @verbatim
739 <route src="Alice" dst="Bob">
740         <link_ctn id="link1"/>
741         <link_ctn id="link2"/>
742         <link_ctn id="link3"/>
743 </route>
744 @endverbatim
745
746 The route here from host Alice to Bob will be first link1, then link2,
747 and finally link3. What about the reverse route? @ref pf_tag_route "Route" and
748 @ref pf_tag_zoneroute "zoneroute" have an optional attribute @c symmetrical, that can
749 be either @c YES or @c NO. @c YES means that the reverse route is the same
750 route in the inverse order, and is set to @c YES by default. Note that
751 this is not the case for bypass*Route, as it is more probable that you
752 want to bypass only one default route.
753
754 For an @ref pf_tag_zoneroute "zoneroute", things are just slightly more complicated, as you have
755 to give the id of the gateway which is inside the zone you want to access ... 
756 So it looks like this:
757
758 @verbatim
759 <zoneroute src="zone1" dst="zone2"
760   gw_src="router1" gw_dst="router2">
761   <link_ctn id="link1"/>
762 </zoneroute>
763 @endverbatim
764
765 gw == gateway, so when any message are trying to go from zone1 to zone2,
766 it means that it must pass through router1 to get out of the zone, then
767 pass through link1, and get into zone2 by being received by router2.
768 router1 must belong to zone1 and router2 must belong to zone2.
769
770 @subsubsection pf_tag_zoneroute &lt;zoneRoute&gt;
771
772 The purpose of this entity is to define a route between two
773 NetZones. Recall that all zones form a tree, so to connect two
774 sibiling zones, you must give such a zoneRoute specifying the source
775 and destination zones, along with the gateway in each zone (ie, the
776 point to reach within that zone to reach the netzone), and the list of
777 links in the ancestor zone to go from one zone to another.
778
779 So, to go from an host @c src_host that is within zone @c src, to an
780 host @c dst_host that is within @c dst, you need to:
781
782  - move within zone @c src, from @c src_host to the specified @c gw_src;
783  - traverse all links specified by the zoneRoute (they are supposed to be within the common ancestor);
784  - move within zone @c dst, from @c gw_dst to @c dst_host.
785
786 #### Attributes ####
787
788 | Attribute name  | Mandatory | Values | Description                                                                                                                                |
789 | --------------- | --------- | ------ | -----------                                                                                                                                |
790 | src             | yes       | String | The identifier of the source zone                                                                                                            |
791 | dst             | yes       | String | See the @c src attribute                                                                                                                   |
792 | gw_src          | yes       | String | The gateway that will be used within the src zone; this can be any @ref pf_tag_host "Host" or @ref pf_router "Router" defined within the src zone. |
793 | gw_dst          | yes       | String | Same as @c gw_src, but with the dst zone instead.                                                                                            |
794 | symmetrical     | no        | YES@|NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly.               | 
795
796 #### Example ####
797
798 @verbatim
799 <zone  id="zone0"  routing="Full">
800   <cluster id="my_cluster_1" prefix="c-" suffix=".me"
801                 radical="0-149" speed="1000000000" bw="125000000" lat="5E-5"
802         bb_bw="2250000000" bb_lat="5E-4"/>
803
804   <cluster id="my_cluster_2" prefix="c-" suffix=".me"
805     radical="150-299" speed="1000000000" bw="125000000" lat="5E-5"
806     bb_bw="2250000000" bb_lat="5E-4"/>
807
808      <link id="backbone" bandwidth="1250000000" latency="5E-4"/>
809
810      <zoneroute src="my_cluster_1" dst="my_cluster_2"
811          gw_src="c-my_cluster_1_router.me"
812          gw_dst="c-my_cluster_2_router.me">
813                 <link_ctn id="backbone"/>
814      </zoneroute>
815      <zoneroute src="my_cluster_2" dst="my_cluster_1"
816          gw_src="c-my_cluster_2_router.me"
817          gw_dst="c-my_cluster_1_router.me">
818                 <link_ctn id="backbone"/>
819      </zoneroute>
820 </zone>
821 @endverbatim
822
823 @subsubsection pf_tag_route &lt;route&gt; 
824
825 The principle is the same as for 
826 @ref pf_tag_zoneroute "ZoneRoute": The route contains a list of links that
827 provide a path from @c src to @c dst. Here, @c src and @c dst can both be either a 
828 @ref pf_tag_host "host" or @ref pf_router "router".  This is mostly useful for the 
829 @ref pf_routing_model_full "Full routing model" as well as for the 
830 @ref pf_routing_model_shortest_path "shortest-paths" based models (as they require 
831 topological information).
832
833
834 | Attribute name  | Mandatory | Values                 | Description                                                                                        |
835 | --------------- | --------- | ---------------------- | -----------                                                                                        |
836 | src             | yes       | String                 | The value given to the source's "id" attribute                                                     |
837 | dst             | yes       | String                 | The value given to the destination's "id" attribute.                                               |
838 | symmetrical     | no        | YES@| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
839
840
841 #### Examples ####
842
843 A route in the @ref pf_routing_model_full "Full routing model" could look like this:
844 @verbatim
845  <route src="Tremblay" dst="Bourassa">
846      <link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
847  </route>
848 @endverbatim
849
850 A route in the @ref pf_routing_model_shortest_path "Shortest-Path routing model" could look like this:
851 @verbatim
852 <route src="Tremblay" dst="Bourassa">
853   <link_ctn id="3"/>
854 </route>
855 @endverbatim
856 @note 
857     You must only have one link in your routes when you're using them to provide
858     topological information, as the routes here are simply the edges of the
859     (network-)graph and the employed algorithms need to know which edge connects
860     which pair of entities.
861
862 @subsubsection pf_tag_bypassasroute bypasszoneroute
863
864 As said before, once you choose
865 a model, it (most likely; the constant network model, for example, doesn't) calculates routes for you. But maybe you want to
866 define some of your routes, which will be specific. You may also want
867 to bypass some routes defined in lower level zone at an upper stage:
868 <b>bypasszoneroute</b> is the tag you're looking for. It allows to
869 bypass routes defined between already defined between zone (if you want
870 to bypass route for a specific host, you should just use byPassRoute).
871 The principle is the same as zoneroute: <b>bypasszoneroute</b> contains
872 list of links that are in the path between src and dst.
873
874 #### Attributes ####
875
876 | Attribute name  | Mandatory | Values                  | Description                                                                                                  |
877 | --------------- | --------- | ----------------------  | -----------                                                                                                  |
878 | src             | yes       | String                  | The value given to the source zone's "id" attribute                                                            |
879 | dst             | yes       | String                  | The value given to the destination zone's "id" attribute.                                                      |
880 | gw_src          | yes       | String                  | The value given to the source gateway's "id" attribute; this can be any host or router within the src zone     |
881 | gw_dst          | yes       | String                  | The value given to the destination gateway's "id" attribute; this can be any host or router within the dst zone|
882 | symmetrical     | no        | YES@| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
883
884 #### Example ####
885
886 @verbatim
887 <bypasszoneRoute src="my_cluster_1" dst="my_cluster_2"
888   gw_src="my_cluster_1_router"
889   gw_dst="my_cluster_2_router">
890     <link_ctn id="link_tmp"/>
891 </bypasszoneroute>
892 @endverbatim
893
894 This example shows that link @c link_tmp (definition not displayed here) directly
895 connects the router @c my_cluster_1_router in the source cluster to the router
896 @c my_cluster_2_router in the destination router. Additionally, as the @c symmetrical
897 attribute was not given, this route is presumed to be symmetrical.
898
899 @subsubsection pf_tag_bypassroute bypassRoute
900
901 As said before, once you choose
902 a model, it (most likely; the constant network model, for example, doesn't) calculates routes for you. But maybe you want to
903 define some of your routes, which will be specific. You may also want
904 to bypass some routes defined in lower level zone at an upper stage:
905 <b>bypassRoute</b> is the tag you're looking for. It allows to bypass
906 routes defined between <b>host/router</b>. The principle is the same
907 as route: <b>bypassRoute</b> contains list of links references of
908 links that are in the path between src and dst.
909
910 #### Attributes ####
911
912 | Attribute name  | Mandatory | Values                  | Description                                                                                                  |
913 | --------------- | --------- | ----------------------  | -----------                                                                                                  |
914 | src             | yes       | String                  | The value given to the source zone's "id" attribute                                                            |
915 | dst             | yes       | String                  | The value given to the destination zone's "id" attribute.                                                      |
916 | symmetrical     | no        | YES @| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
917
918 #### Examples ####
919
920 @verbatim
921 <bypassRoute src="host_1" dst="host_2">
922    <link_ctn id="link_tmp"/>
923 </bypassRoute>
924 @endverbatim
925
926 This example shows that link @c link_tmp (definition not displayed here) directly
927 connects host @c host_1 to host @c host_2. Additionally, as the @c symmetrical
928 attribute was not given, this route is presumed to be symmetrical.
929
930 @subsection pb_baroex Basic Routing Example
931
932 Let's say you have an zone named zone_Big that contains two other zone, zone_1
933 and zone_2. If you want to make a host (h1) from zone_1 with another one
934 (h2) from zone_2 then you'll have to proceed as follows:
935 @li First, you have to ensure that a route is defined from h1 to the
936     zone_1's exit gateway and from h2 to zone_2's exit gateway.
937 @li Then, you'll have to define a route between zone_1 to zone_2. As those
938     zone are both resources belonging to zone_Big, then it has to be done
939     at zone_big level. To define such a route, you have to give the
940     source zone (zone_1), the destination zone (zone_2), and their respective
941     gateway (as the route is effectively defined between those two
942     entry/exit points). Elements of this route can only be elements
943     belonging to zone_Big, so links and routers in this route should be
944     defined inside zone_Big. If you choose some shortest-path model,
945     this route will be computed automatically.
946
947 As said before, there are mainly 2 tags for routing:
948 @li <b>zoneroute</b>: to define routes between two  <b>zone</b>
949 @li <b>route</b>: to define routes between two <b>host/router</b>
950
951 As we are dealing with routes between zone, it means that those we'll
952 have some definition at zone_Big level. Let consider zone_1 contains 1
953 host, 1 link and one router and zone_2 3 hosts, 4 links and one router.
954 There will be a central router, and a cross-like topology. At the end
955 of the crosses arms, you'll find the 3 hosts and the router that will
956 act as a gateway. We have to define routes inside those two zone. Let
957 say that zone_1 contains full routes, and zone_2 contains some Floyd
958 routing (as we don't want to bother with defining all routes). As
959 we're using some shortest path algorithms to route into zone_2, we'll
960 then have to define some <b>route</b> to gives some topological
961 information to SimGrid. Here is a file doing it all:
962
963 @verbatim
964 <zone  id="zone_Big"  routing="Dijkstra">
965   <zone id="zone_1" routing="Full">
966      <host id="zone_1_host1" speed="1000000000"/>
967      <link id="zone_1_link" bandwidth="1250000000" latency="5E-4"/>
968      <router id="zone_1_gateway"/>
969      <route src="zone_1_host1" dst="zone_1_gateway">
970             <link_ctn id="zone_1_link"/>
971      </route>
972   </zone>
973   <zone id="zone_2" routing="Floyd">
974      <host id="zone_2_host1" speed="1000000000"/>
975      <host id="zone_2_host2" speed="1000000000"/>
976      <host id="zone_2_host3" speed="1000000000"/>
977      <link id="zone_2_link1" bandwidth="1250000000" latency="5E-4"/>
978      <link id="zone_2_link2" bandwidth="1250000000" latency="5E-4"/>
979      <link id="zone_2_link3" bandwidth="1250000000" latency="5E-4"/>
980      <link id="zone_2_link4" bandwidth="1250000000" latency="5E-4"/>
981      <router id="central_router"/>
982      <router id="zone_2_gateway"/>
983      <!-- routes providing topological information -->
984      <route src="central_router" dst="zone_2_host1"><link_ctn id="zone_2_link1"/></route>
985      <route src="central_router" dst="zone_2_host2"><link_ctn id="zone_2_link2"/></route>
986      <route src="central_router" dst="zone_2_host3"><link_ctn id="zone_2_link3"/></route>
987      <route src="central_router" dst="zone_2_gateway"><link_ctn id="zone_2_link4"/></route>
988   </zone>
989     <link id="backbone" bandwidth="1250000000" latency="5E-4"/>
990
991      <zoneroute src="zone_1" dst="zone_2"
992          gw_src="zone_1_gateway"
993          gw_dst="zone_2_gateway">
994                 <link_ctn id="backbone"/>
995      </zoneroute>
996 </zone>
997 @endverbatim
998
999 @section pf_other Other tags
1000
1001 The following tags can be used inside a @<platform@> tag even if they are not
1002 directly describing the platform:
1003
1004   - @ref pf_tag_config passes configuration options, e.g. to change the network model;
1005   - @ref pf_tag_prop gives user-defined properties to various elements
1006
1007 @subsection pf_trace trace and trace_connect
1008
1009 Both tags are an alternate way to pass files containing information on
1010 availability, state etc. to an entity. (See also @ref howto_churn).
1011 Instead of referring to the file directly in the host, link, or
1012 cluster tag, you proceed by defining a trace with an id corresponding
1013 to a file, later a host/link/cluster, and finally using trace_connect
1014 you say that the file trace must be used by the entity.
1015
1016
1017 #### Example #### 
1018
1019 @verbatim
1020 <zone  id="zone0"  routing="Full">
1021   <host id="bob" speed="1000000000"/>
1022 </zone>
1023 <trace id="myTrace" file="bob.trace" periodicity="1.0"/>
1024 <trace_connect trace="myTrace" element="bob" kind="POWER"/>
1025 @endverbatim
1026
1027 @note 
1028     The order here is important.  @c trace_connect must come 
1029     after the elements @c trace and @c host, as both the host
1030     and the trace definition must be known when @c trace_connect
1031     is parsed; the order of @c trace and @c host is arbitrary.
1032
1033
1034 #### @c trace attributes ####
1035
1036
1037 | Attribute name  | Mandatory | Values                 | Description                                                                                       |
1038 | --------------- | --------- | ---------------------- | -----------                                                                                       |
1039 | id              | yes       | String                 | Identifier of this trace; this is the name you pass on to @c trace_connect.                       |
1040 | file            | no        | String                 | Filename of the file that contains the information - the path must follow the style of your OS. You can omit this, but then you must specifiy the values inside of &lt;trace&gt; and &lt;/trace&gt; - see the example below. |
1041 | trace_periodicity | yes | String | This is the same as for @ref pf_tag_host "hosts" (see there for details) |
1042
1043 Here is an example  of trace when no file name is provided:
1044
1045 @verbatim
1046  <trace id="myTrace" periodicity="1.0">
1047     0.0 1.0
1048     11.0 0.5
1049     20.0 0.8
1050  </trace>
1051 @endverbatim
1052
1053 #### @c trace_connect attributes ####
1054
1055 | Attribute name  | Mandatory | Values                 | Description                                                                                       |
1056 | --------------- | --------- | ---------------------- | -----------                                                                                       |
1057 | kind            | no        | HOST_AVAIL@|POWER@|<br/>LINK_AVAIL@|BANDWIDTH@|LATENCY (Default: HOST_AVAIL)   | Describes the kind of trace.                   |
1058 | trace           | yes       | String                 | Identifier of the referenced trace (specified of the trace's @c id attribute)                     |
1059 | element         | yes       | String                 | The identifier of the referenced entity as given by its @c id attribute                           |
1060
1061 @section pf_hints Hints, tips and frequently requested features
1062
1063 Now you should know at least the syntax and be able to create a
1064 platform by your own. However, after having ourselves wrote some platforms, there
1065 are some best practices you should pay attention to in order to
1066 produce good platform and some choices you can make in order to have
1067 faster simulations. Here's some hints and tips, then.
1068
1069 @subsection pf_hints_search Finding the platform example that you need
1070
1071 Most platform files that we ship are in the @c examples/platforms
1072 folder. The good old @c grep tool can find the examples you need when
1073 wondering on a specific XML tag. Here is an example session searching
1074 for @ref pf_trace "trace_connect":
1075
1076 @verbatim
1077 % cd examples/platforms
1078 % grep -R -i -n --include="*.xml" "trace_connect" .
1079 ./two_hosts_platform_with_availability_included.xml:26:<trace_connect kind="SPEED" trace="A" element="Cpu A"/>
1080 ./two_hosts_platform_with_availability_included.xml:27:<trace_connect kind="HOST_AVAIL" trace="A_failure" element="Cpu A"/>
1081 ./two_hosts_platform_with_availability_included.xml:28:<trace_connect kind="SPEED" trace="B" element="Cpu B"/>
1082 ./two_hosts.xml:17:  <trace_connect trace="Tremblay_power" element="Tremblay" kind="SPEED"/>
1083 @endverbatim
1084
1085 @subsection pf_hint_generating How to generate different platform files?
1086
1087 This is actually a good idea to search for a better platform file,
1088 that better fit the need of your study. To be honest, the provided
1089 examples are not representative of anything. They exemplify our XML
1090 syntax, but that's all. small_platform.xml for example was generated
1091 without much thought beyond that.
1092
1093 The best thing to do when possible is to write your own platform file,
1094 that model the platform on which you run your code. For that, you
1095 could use <a href="https://gitlab.inria.fr/simgrid/platform-calibration">our
1096 calibration scripts</a>. This leads to very good fits between the
1097 platform, the model and the needs.  The g5k.xml example resulted of
1098 such an effort, which also lead to <a href="https://github.com/lpouillo/topo5k/">an 
1099 ongoing attempt</a> to automatically extract the SimGrid platform from
1100 the <a href="http://grid5000.fr/">Grid'5000</a> experimental platform.
1101 But it's hard to come up with generic models. Don't take these files
1102 too seriously. Actually, you should always challenge our models and
1103 your instanciation if the accuracy really matters to you (see <a
1104 href="https://hal.inria.fr/hal-00907887">this discussion</a>).
1105
1106 But such advices only hold if you have a real platform and a real
1107 application at hand. It's moot for more abstract studies working on
1108 ideas and algorithms instead of technical artefacts. Well, in this
1109 case, there unfortunately is nothing better than this old and rusty
1110 <a href="http://pda.gforge.inria.fr/tools/download.html">simulacrum</a>.
1111 This project is dormant since over 10 years (and you will have to
1112 update the generated platforms with <tt>bin/simgrid_update_xml</tt> to
1113 use them), but that's the best we have for this right now....
1114
1115 @subsection pf_zone_h Zone Hierarchy
1116 The network zone design allows SimGrid to go fast, because computing route is
1117 done only for the set of resources defined in the current zone. If you're using
1118 only a big zone containing all resource with no zone into it and you're
1119 using Full model, then ... you'll loose all interest into it. On the
1120 other hand, designing a binary tree of zone with, at the lower level,
1121 only one host, then you'll also loose all the good zone hierarchy can
1122 give you. Remind you should always be "reasonable" in your platform
1123 definition when choosing the hierarchy. A good choice if you try to
1124 describe a real life platform is to follow the zone described in
1125 reality, since this kind of trade-off works well for real life
1126 platforms.
1127
1128 @subsection pf_exit_zone Exit Zone: why and how
1129 Users that have looked at some of our platforms may have notice a
1130 non-intuitive schema ... Something like that:
1131
1132
1133 @verbatim
1134 <zone id="zone_4"  routing="Full">
1135 <zone id="exitzone_4"  routing="Full">
1136         <router id="router_4"/>
1137 </zone>
1138 <cluster id="cl_4_1" prefix="c_4_1-" suffix="" radical="1-20" speed="1000000000" bw="125000000" lat="5E-5" bb_bw="2250000000" bb_lat="5E-4"/>
1139 <cluster id="cl_4_2" prefix="c_4_2-" suffix="" radical="1-20" speed="1000000000" bw="125000000" lat="5E-5" bb_bw="2250000000" bb_lat="5E-4"/>
1140 <link id="4_1" bandwidth="2250000000" latency="5E-5"/>
1141 <link id="4_2" bandwidth="2250000000" latency="5E-5"/>
1142 <link id="bb_4" bandwidth="2250000000" latency="5E-4"/>
1143 <zoneroute src="cl_4_1"
1144         dst="cl_4_2"
1145         gw_src="c_4_1-cl_4_1_router"
1146         gw_dst="c_4_2-cl_4_2_router">
1147                 <link_ctn id="4_1"/>
1148                 <link_ctn id="bb_4"/>
1149                 <link_ctn id="4_2"/>
1150 </zoneroute>
1151 <zoneroute src="cl_4_1"
1152         dst="exitzone_4"
1153         gw_src="c_4_1-cl_4_1_router"
1154         gw_dst="router_4">
1155                 <link_ctn id="4_1"/>
1156                 <link_ctn id="bb_4"/>
1157 </zoneroute>
1158 <zoneroute src="cl_4_2"
1159         dst="exitzone_4"
1160         gw_src="c_4_2-cl_4_2_router"
1161         gw_dst="router_4">
1162                 <link_ctn id="4_2"/>
1163                 <link_ctn id="bb_4"/>
1164 </zoneroute>
1165 </zone>
1166 @endverbatim
1167
1168 In the zone_4, you have an exitzone_4 defined, containing only one router,
1169 and routes defined to that zone from all other zone (as cluster is only a
1170 shortcut for an zone, see cluster description for details). If there was
1171 an upper zone, it would define routes to and from zone_4 with the gateway
1172 router_4. It's just because, as we did not allowed (for performances
1173 issues) to have routes from an zone to a single host/router, you have to
1174 enclose your gateway, when you have zone included in your zone, within an
1175 zone to define routes to it.
1176
1177 @subsection pf_P2P_tags P2P or how to use coordinates
1178 SimGrid allows you to use some coordinated-based system, like vivaldi,
1179 to describe a platform. The main concept is that you have some peers
1180 that are located somewhere: this is the function of the
1181 <b>coordinates</b> of the @<peer@> or @<host@> tag. There's nothing
1182 complicated in using it, here is an example:
1183
1184 @verbatim
1185 <?xml version='1.0'?>
1186 <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
1187 <platform version="4">
1188
1189  <zone  id="zone0"  routing="Vivaldi">
1190         <host id="100030591" coordinates="25.5 9.4 1.4" speed="1.5Gf" />
1191         <host id="100036570" coordinates="-12.7 -9.9 2.1" speed="7.3Gf" />
1192         ...
1193         <host id="100429957" coordinates="17.5 6.7 18.8" speed="8.3Gf" />
1194  </zone>
1195 </platform>
1196 @endverbatim
1197
1198 Coordinates are then used to calculate latency (in microseconds)
1199 between two hosts by calculating the distance between the two hosts
1200 coordinates with the following formula: distance( (x1, y1, z1), (x2,
1201 y2, z2) ) = euclidian( (x1,y1), (x2,y2) ) + abs(z1) + abs(z2)
1202
1203 In other words, we take the euclidian distance on the two first
1204 dimensions, and then add the absolute values found on the third
1205 dimension. This may seem strange, but it was found to allow better
1206 approximations of the latency matrices (see the paper describing
1207 Vivaldi).
1208
1209 Note that the previous example defines a routing directly between hosts but it could be also used to define a routing between zone.
1210 That is for example what is commonly done when using peers (see Section @ref pf_peer).
1211 @verbatim
1212 <?xml version='1.0'?>
1213 <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
1214 <platform version="4">
1215
1216  <zone  id="zone0"  routing="Vivaldi">
1217    <peer id="peer-0" coordinates="173.0 96.8 0.1" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us"/>
1218    <peer id="peer-1" coordinates="247.0 57.3 0.6" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us" />
1219    <peer id="peer-2" coordinates="243.4 58.8 1.4" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us" />
1220 </zone>
1221 </platform>
1222 @endverbatim
1223 In such a case though, we connect the zone created by the <b>peer</b> tag with the Vivaldi routing mechanism.
1224 This means that to route between zone1 and zone2, it will use the coordinates of router_zone1 and router_zone2.
1225 This is currently a convention and we may offer to change this convention in the DTD later if needed.
1226 You may have noted that conveniently, a peer named FOO defines an zone named FOO and a router named router_FOO, which is why it works seamlessly with the <b>peer</b> tag.
1227
1228
1229 @subsection pf_routing_howto_choose_wisely Choosing wisely the routing model to use
1230
1231
1232 Choosing wisely the routing model to use can significantly fasten your
1233 simulation/save your time when writing the platform/save tremendous
1234 disk space. Here is the list of available model and their
1235 characteristics (lookup: time to resolve a route):
1236
1237 @li <b>Full</b>: Full routing data (fast, large memory requirements,
1238     fully expressive)
1239 @li <b>Floyd</b>: Floyd routing data (slow initialization, fast
1240     lookup, lesser memory requirements, shortest path routing only).
1241     Calculates all routes at once at the beginning.
1242 @li <b>Dijkstra</b>: Dijkstra routing data (fast initialization, slow
1243     lookup, small memory requirements, shortest path routing only).
1244     Calculates a route when necessary.
1245 @li <b>DijkstraCache</b>: Dijkstra routing data (fast initialization,
1246     fast lookup, small memory requirements, shortest path routing
1247     only). Same as Dijkstra, except it handles a cache for latest used
1248     routes.
1249 @li <b>None</b>: No routing (usable with Constant network only).
1250     Defines that there is no routes, so if you try to determine a
1251     route without constant network within this zone, SimGrid will raise
1252     an exception.
1253 @li <b>Vivaldi</b>: Vivaldi routing, so when you want to use coordinates
1254 @li <b>Cluster</b>: Cluster routing, specific to cluster tag, should
1255     not be used.
1256
1257 @subsection pf_loopback I want to specify the characteristics of the loopback link!
1258
1259 Each routing model automatically adds a loopback link for each declared host, i.e.,
1260 a network route from the host to itself, if no such route is declared in the XML
1261 file. This default link has a bandwidth of 498 Mb/s, a latency of 15 microseconds, 
1262 and is <b>not</b> shared among network flows. 
1263
1264 If you want to specify the characteristics of the loopback link for a given host, you
1265 just have to specify a route from this host to itself with the desired characteristics 
1266 in the XML file. This will prevent the routing model to add and use the default 
1267 loopback link.
1268
1269 @subsection pf_switch I want to describe a switch but there is no switch tag!
1270
1271 Actually we did not include switch tag. But when you're trying to
1272 simulate a switch, assuming 
1273 fluid bandwidth models are used (which SimGrid uses by default unless 
1274 ns-3 or constant network models are activated), the limiting factor is
1275 switch backplane bandwidth. So, essentially, at least from
1276 the simulation perspective, a switch is similar to a
1277 link: some device that is traversed by flows and with some latency and
1278 so,e maximum bandwidth. Thus, you can simply simulate a switch as a
1279 link. Many links
1280 can be connected to this "switch", which is then included in routes just
1281 as a normal link.
1282
1283
1284 @subsection pf_multicabinets I want to describe multi-cabinets clusters!
1285
1286 You have several possibilities, as usual when modeling things. If your
1287 cabinets are homogeneous and the intercabinet network negligible for
1288 your study, you should just create a larger cluster with all hosts at
1289 the same layer. 
1290
1291 In the rare case where your hosts are not homogeneous between the
1292 cabinets, you can create your cluster completely manually. For that,
1293 create an As using the Cluster routing, and then use one
1294 &lt;cabinet&gt; for each cabinet. This cabinet tag can only be used an
1295 As using the Cluster routing schema, and creating 
1296
1297 Be warned that creating a cluster manually from the XML with
1298 &lt;cabinet&gt;, &lt;backbone&gt; and friends is rather tedious. The
1299 easiest way to retrieve some control of your model without diving into
1300 the &lt;cluster&gt; internals is certainly to create one separate
1301 &lt;cluster&gt; per cabinet and interconnect them together. This is
1302 what we did in the G5K example platform for the Graphen cluster.
1303
1304 @subsection pf_platform_multipath I want to express multipath routing in platform files!
1305
1306 It is unfortunately impossible to express the fact that there is more
1307 than one routing path between two given hosts. Let's consider the
1308 following platform file:
1309
1310 @verbatim
1311 <route src="A" dst="B">
1312    <link_ctn id="1"/>
1313 </route>
1314 <route src="B" dst="C">
1315   <link_ctn id="2"/>
1316 </route>
1317 <route src="A" dst="C">
1318   <link_ctn id="3"/>
1319 </route>
1320 @endverbatim
1321
1322 Although it is perfectly valid, it does not mean that data traveling
1323 from A to C can either go directly (using link 3) or through B (using
1324 links 1 and 2). It simply means that the routing on the graph is not
1325 trivial, and that data do not following the shortest path in number of
1326 hops on this graph. Another way to say it is that there is no implicit
1327 in these routing descriptions. The system will only use the routes you
1328 declare (such as &lt;route src="A" dst="C"&gt;&lt;link_ctn
1329 id="3"/&gt;&lt;/route&gt;), without trying to build new routes by aggregating
1330 the provided ones.
1331
1332 You are also free to declare platform where the routing is not
1333 symmetrical. For example, add the following to the previous file:
1334
1335 @verbatim
1336 <route src="C" dst="A">
1337   <link_ctn id="2"/>
1338   <link_ctn id="1"/>
1339 </route>
1340 @endverbatim
1341
1342 This makes sure that data from C to A go through B where data from A
1343 to C go directly. Don't worry about realism of such settings since
1344 we've seen ways more weird situation in real settings (in fact, that's
1345 the realism of very regular platforms which is questionable, but
1346 that's another story).
1347
1348 */