Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c4e0ea49c4dc68e1d5fd02f45fc50484ae7c2089
[simgrid.git] / doc / doxygen / platform.doc
1 /*! @page platform Describing the virtual platform
2
3 @tableofcontents
4
5 @htmlonly
6 <div align="center">
7 @endhtmlonly
8 @htmlinclude graphical-toc.svg
9 @htmlonly
10 </div>
11 <script>
12 document.getElementById("VirtualPlatform").style="opacity:0.93999999;fill:#ff0000;fill-opacity:0.1;stroke:#000000;stroke-width:0.35277778;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1";
13 </script>
14 @endhtmlonly
15
16 As @ref starting_components "explained in the introduction," any
17 SimGrid study must entail the description of the platform on which you
18 want to simulate your application. You have to describe **each element
19 of your platform**, such as computing hosts, clusters, each disks,
20 links, etc. You must also define the **routing on your platform**, ie
21 which path is taken between two hosts. Finally, you may also describe
22 an **experimental scenario**, with qualitative changes (e.g.,
23 bandwidth changes representing an external load) and qualitative
24 changes (representing how some elements fail and restart over time).
25
26 You should really separate your application from the platform
27 description, as it will ease your experimental campain afterward.
28 Mixing them is seen as a really bad experimental practice. The easiest
29 to enforce this split is to put the platform description in a XML
30 file. Many example platforms are provided in the archive, and this
31 page gives all needed details to write such files, as well as some
32 hints and tricks about describing your platform.
33
34 On the other side, XML is sometimes not expressive enough for some
35 platforms, in particular large platforms exhibiting repetitive
36 patterns that are not simply expressed in XML.  In practice, many
37 users end up generating their XML platform files from some sort of
38 scripts. It is probably preferable to rewrite your XML @ref
39 platform_lua "platform using the lua scripting language" instead.
40 In the future, it should be possible to describe the platform directly
41 in C++, but this is not possible yet.
42
43 As usual, SimGrid is a versatile framework, and you should find the
44 way of describing your platform that best fits your experimental
45 practice. 
46
47 @section pf_overview Describing the platform with XML
48
49 Your platform description should follow the specification presented in
50 the [simgrid.dtd](http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd)
51 DTD file. The same DTD is used for both the platform and deployment
52 files.
53
54 From time to time, this DTD evolves to introduce possibly
55 backward-incompatible changes. That is why each platform desciption is
56 enclosed within a @c platform tag, that have a @c version attribute. 
57 The current version is <b>4.1</b>. The @c simgrid_update_xml program can
58 upgrade most of the past platform files to the recent formalism.
59
60 @section pf_first_example First Platform Example 
61
62 Here is a very simple platform file, containing 3 resources (two hosts
63 and one link), and explicitly giving the route between the hosts.
64
65 @code{.xml}
66 <?xml version='1.0'?>
67 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
68 <platform version="4.1">
69   <zone id="first zone" routing="Full">
70     <!-- the resources -->
71     <host id="host1" speed="1Mf"/>
72     <host id="host2" speed="2Mf"/>
73     <link id="link1" bandwidth="125MBps" latency="100us"/>
74     <!-- the routing: specify how the hosts are interconnected -->
75     <route src="host1" dst="host2">
76       <link_ctn id="link1"/>
77     </route>
78   </zone>
79 </platform>
80 @endcode
81
82 As we said, the englobing @ref pf_overview "&lt;platform&gt;" tag is
83 used to specify the dtd version used for this file.
84
85 Then, every resource (specified with @ref pf_tag_host, @ref
86 pf_tag_link or others) must be located within a given **networking
87 zone**.  Each zone is in charge of the routing between its
88 resources. It means that when an host wants to communicate with
89 another host of the same zone, it is the zone's duty to find the list
90 of links that are involved in the communication. Here, since the @ref
91 pf_tag_zone tag has **Full** as a **routing attribute**, all routes
92 must be explicitely given using the @ref pf_tag_route and @ref
93 pf_tag_linkctn tags (this @ref pf_rm "routing model" is both simple
94 and inefficient :) It is OK to not specify the route between two
95 hosts, as long as the processes located on them never try to
96 communicate together.
97
98 A zone can contain several zones itself, leading to a hierarchical
99 decomposition of the platform. This can be more efficient (as the
100 inter-zone routing gets factorized with @ref pf_tag_zoneroute), and
101 allows to have more than one routing model in your platform. For
102 example, you could have a coordinate-based routing for the WAN parts
103 of your platforms, a full routing within each datacenter, and a highly
104 optimized routing within each cluster of the datacenter.  In this
105 case, determining the route between two given hosts gets @ref
106 routing_basics "somewhat more complex" but SimGrid still computes
107 these routes for you in a time- and space-efficient manner.
108 Here is an illustration of these concepts:
109
110 ![A hierarchy of networking zones.](AS_hierarchy.png)
111
112 Circles represent processing units and squares represent network
113 routers. Bold lines represent communication links. The zone "AS2"
114 models the core of a national network interconnecting a small flat
115 cluster (AS4) and a larger hierarchical cluster (AS5), a subset of a
116 LAN (AS6), and a set of peers scattered around the world (AS7).
117
118 @section pf_res Resource description
119
120 @subsection pf_res_computing Computing Resources
121
122 @subsubsection pf_tag_host &lt;host&gt;
123
124 An host is the computing resource on which an actor can execute.
125
126 Attribute         | Values                                 | Description
127 ----------------- | -------------------------------------- | -----------
128 id                | String (mandatory)                     | The identifier of the host. facilitates referring to this AS.
129 speed             | double (mandatory)                     | Computational power of every core of this host in FLOPS (must be positive)
130 core              | int (defaults to 1)                    | Number of cores (see @ref howto_multicore)
131 availability_file | File name (optional) | (Relative or absolute) filename to use as input; must contain availability traces for this host. The syntax of this file is defined below.
132 state_file        | File name (optional) |  File to use as a state profile (see @ref howto_churn)
133 coordinates       | String (mandatory when using Vivaldi routing) | The coordinates of this host (see @ref pf_P2P_tags).
134 pstate     | Double (Defaults to 0) | FIXME: Not yet documented.
135
136 #### Included tags ####
137
138  - @ref pf_tag_mount Specifies the storages mounted on that host
139  - @ref pf_tag_prop Specifies a user-defined property of that host, that you can retrieve with MSG_host_get_property_value() or simgrid::s4u::Host::property().
140
141 #### Examples ####
142
143 @code{.xml}
144 <host id="host1" speed="1000000000"/>
145 <host id="host2" speed="1000000000">
146    <prop id="color" value="blue"/>
147    <prop id="rendershape" value="square"/>
148 </host>
149 @endcode
150
151 @anchor pf_host_dynamism
152 ### Expressing dynamism ###
153
154 SimGrid provides mechanisms to change a hosts' availability over
155 time, using the ``availability_file`` attribute to the ``@<host@>`` tag
156 and a separate text file whose syntax is exemplified below.
157
158 #### Adding a trace file ####
159
160 @verbatim
161 <platform version="4">
162   <host id="bob" speed="500Gf" availability_file="bob.trace" />
163 </platform>
164 @endverbatim
165
166 #### Example of "bob.trace" file ####
167
168 ~~~~~~~~~~~~~~{.py}
169 PERIODICITY 1.0
170   0.0 1.0
171   11.0 0.5
172   20.0 0.8
173 ~~~~~~~~~~~~~~
174
175 Let us begin to explain this example by looking at line 2. (Line 1 will become clear soon).
176 The first column describes points in time, in this case, time 0. The second column
177 describes the relative amount of power this host is able to deliver (relative
178 to the maximum performance specified in the ``@<host@>`` tag). (Clearly, the
179 second column needs to contain values that are not smaller than 0 and not larger than 1).
180 In this example, our host will deliver 500 Mflop/s at time 0, as 500 Mflop/s is the
181 maximum performance of this host. At time 11.0, it will
182 deliver half of its maximum performance, i.e., 250 Mflop/s until time 20.0 when it will
183 will start delivering 80@% of its power. In this example, this amounts to 400 Mflop/s.
184
185 Since the periodicity in line 1 was set to be 1.0, i.e., 1 timestep, this host will
186 continue to provide 500 Mflop/s from time 21. From time 32 it will provide 250 MFlop/s and so on.
187
188 @subsubsection pf_tag_cluster &lt;cluster&gt;
189
190 ``<cluster />`` represents a machine-cluster. It is most commonly used
191 when one wants to define many hosts and a network quickly. Technically,
192 ``cluster`` is a meta-tag: <b>from the inner SimGrid point of
193 view, a cluster is a network zone where some optimized routing is defined</b>.
194 The default inner organization of the cluster is as follow:
195
196 @verbatim
197                  __________
198                 |          |
199                 |  router  |
200     ____________|__________|_____________ backbone
201       |   |   |              |     |   |
202     l0| l1| l2|           l97| l96 |   | l99
203       |   |   |   ........   |     |   |
204       |                                |
205     c-0.me                             c-99.me
206 @endverbatim
207
208 Here, a set of <b>host</b>s is defined. Each of them has a <b>link</b>
209 to a central backbone (backbone is a link itself, as a link can
210 be used to represent a switch, see the switch / link section
211 below for more details about it). A <b>router</b> allows to connect a
212 <b>cluster</b> to the outside world. Internally,
213 SimGrid treats a cluster as a network zone containing all hosts: the router is the default
214 gateway for the cluster.
215
216 There is an alternative organization, which is as follows:
217 @verbatim
218                  __________
219                 |          |
220                 |  router  |
221                 |__________|
222                     / | @
223                    /  |  @
224                l0 / l1|   @l2
225                  /    |    @
226                 /     |     @
227             host0   host1   host2
228 @endverbatim
229
230 The principle is the same, except that there is no backbone. This representation
231 can be obtained easily: just do not set the bb_* attributes.
232
233
234 Attribute name  | Mandatory | Values | Description
235 --------------- | --------- | ------ | -----------
236 id              | yes       | string | The identifier of the cluster. Facilitates referring to this cluster.
237 prefix          | yes       | string | Each node of the cluster has to have a name. This name will be prefixed with this prefix.
238 suffix          | yes       | string | Each node of the cluster will be suffixed with this suffix
239 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.
240 speed           | yes       | int    | Same as the ``speed`` attribute of the ``@<host@>`` tag.
241 core            | no        | int (default: 1) | Same as the ``core`` attribute of the ``@<host@>`` tag.
242 bw              | yes       | int    | Bandwidth for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
243 lat             | yes       | int    | Latency for the links between nodes and backbone (if any). See <b>link</b> section for syntax/details.
244 sharing_policy  | no        | string | Sharing policy for the links between nodes and backbone (if any). See <b>link</b> section for syntax/details.
245 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>).
246 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>).
247 bb_sharing_policy | no      | string | Sharing policy for the backbone (if any). See <b>link</b> section for syntax/details.
248 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>
249 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".
250 loopback_lat      | no      | int    | Latency for loopback (if any). See <b>link</b> section for syntax/details. See loopback_bw for more info.
251 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.
252 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".
253
254
255 the router name is defined as the resulting String in the following
256 java line of code:
257
258 @verbatim
259 router_name = prefix + clusterId + "_router" + suffix;
260 @endverbatim
261
262
263 #### Cluster example ####
264
265 Consider the following two (and independent) uses of the ``cluster`` tag:
266
267 @verbatim
268 <cluster id="my_cluster_1" prefix="" suffix="" radical="0-262144"
269          speed="1e9" bw="125e6" lat="5E-5"/>
270
271 <cluster id="my_cluster_2" prefix="c-" suffix=".me" radical="0-99"
272          speed="1e9" bw="125e6" lat="5E-5"
273          bb_bw="2.25e9" bb_lat="5E-4"/>
274 @endverbatim
275
276 The second example creates one router and 100 machines with the following names:
277 @verbatim
278 c-my_cluster_2_router.me
279 c-0.me
280 c-1.me
281 c-2.me
282 ...
283 c-99.me
284 @endverbatim
285
286 @subsubsection pf_cabinet &lt;cabinet&gt;
287
288 @note
289     This tag is only available when the routing mode of the network zone
290     is set to ``Cluster``.
291
292 The ``&lt;cabinet /&gt;`` tag is, like the @ref pf_tag_cluster "&lt;cluster&gt;" tag,
293 a meta-tag. This means that it is simply a shortcut for creating a set of (homogenous) hosts and links quickly;
294 unsurprisingly, this tag was introduced to setup cabinets in data centers quickly. Unlike
295 &lt;cluster&gt;, however, the &lt;cabinet&gt; assumes that you create the backbone
296 and routers yourself; see our examples below.
297
298 #### Attributes ####
299
300 Attribute name  | Mandatory | Values | Description
301 --------------- | --------- | ------ | -----------
302 id              | yes       | string | The identifier of the cabinet. Facilitates referring to this cluster.
303 prefix          | yes       | string | Each node of the cabinet has to have a name. This name will be prefixed with this prefix.
304 suffix          | yes       | string | Each node of the cabinet will be suffixed with this suffix
305 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.
306 speed           | yes       | int    | Same as the ``speed`` attribute of the @ref pf_tag_host "&lt;host&gt;" tag.
307 bw              | yes       | int    | Bandwidth for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
308 lat             | yes       | int    | Latency for the links between nodes and backbone (if any). See the @ref pf_tag_link "link section" for syntax/details.
309
310 @note
311     Please note that as of now, it is impossible to change attributes such as,
312     amount of cores (always set to 1), the sharing policy of the links (always set to @ref pf_sharing_policy_splitduplex "SPLITDUPLEX").
313
314 #### Example ####
315
316 The following example was taken from ``examples/platforms/meta_cluster.xml`` and
317 shows how to use the cabinet tag.
318
319 @verbatim
320   <zone  id="my_cluster1"  routing="Cluster">
321     <cabinet id="cabinet1" prefix="host-" suffix=".cluster1"
322       speed="1Gf" bw="125MBps" lat="100us" radical="1-10"/>
323     <cabinet id="cabinet2" prefix="host-" suffix=".cluster1"
324       speed="1Gf" bw="125MBps" lat="100us" radical="11-20"/>
325     <cabinet id="cabinet3" prefix="host-" suffix=".cluster1"
326       speed="1Gf" bw="125MBps" lat="100us" radical="21-30"/>
327
328     <backbone id="backbone1" bandwidth="2.25GBps" latency="500us"/>
329   </zone>
330 @endverbatim
331
332 @note
333    Please note that you must specify the @ref pf_backbone "&lt;backbone&gt;"
334    tag by yourself; this is not done automatically and there are no checks
335    that ensure this backbone was defined.
336
337 The hosts generated in the above example are named host-1.cluster, host-2.cluster1
338 etc.
339
340
341 @subsubsection pf_peer &lt;peer&gt; (Vivaldi netzones only)
342
343 This tag represents a peer, as in Peer-to-Peer (P2P) networks. This
344 can only be used in Vivaldi NetZones. It creates the following
345 resources to the NetZone:
346
347 @li A host
348 @li Two links: One for download and one for upload. This is
349     convenient to use and simulate stuff under the last mile model (e.g., ADSL peers).
350 @li It connects the two links to the host
351
352 #### Attributes ####
353
354 Attribute name  | Mandatory | Values | Description
355 --------------- | --------- | ------ | -----------
356 id              | yes       | string | The identifier of the peer. Facilitates referring to this peer.
357 speed           | yes       | int    | See the description of the ``host`` tag for this attribute
358 bw_in           | yes       | int    | Bandwidth of the private downstream link
359 bw_out          | yes       | int    | Bandwidth of the private upstream link
360 coordinates     | no        | string | Coordinates of the gateway for this peer. Example value: 12.8 14.4 6.4
361 sharing_policy  | no        | SHARED@|SPLITDUPLEX (default: SPLITDUPLEX) | Sharing policy for links. See <b>link</b> description for details.
362 availability_file| no       | string | Availability file for the peer. Same as host availability file. See <b>host</b> description for details.
363 state_file      | no        | string | State file for the peer. Same as host state file. See <b>host</b> description for details.
364
365
366 The communication latency between an host A=(xA,yA,zA) and an host
367 B=(xB,yB,zB) is computed as follows:
368  
369  latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB
370
371 See the documentation of simgrid::kernel::routing::VivaldiZone for
372 details on how the latency is computed from the coordinate, and on the
373 the up and down bandwidth are used.
374
375 @subsection pf_ne Network equipments
376
377 There are two tags at all times available to represent network entities and
378 several other tags that are available only in certain contexts.
379 1. ``<link>``: Represents a entity that has a limited bandwidth, a
380     latency, and that can be shared according to TCP way to share this
381     bandwidth.
382 @remark
383   The concept of links in SimGrid may not be intuitive, as links are not
384   limited to connecting (exactly) two entities; in fact, you can have more than
385   two equipments connected to it. (In graph theoretical terms: A link in
386   SimGrid is not an edge, but a hyperedge)
387
388 2. ``<router/>``: Represents an entity that a message can be routed
389     to, but that is unable to execute any code. In SimGrid, routers have also
390     no impact on the performance: Routers do not limit any bandwidth nor
391     do they increase latency. As a matter of fact, routers are (almost) ignored
392     by the simulator when the simulation has begun.
393
394 3. ``<backbone/>``: This tag is only available when the containing network zone is
395                     used as a cluster (i.e., mode="Cluster")
396
397 @remark
398     If you want to represent an entity like a switch, you must use ``<link>`` (see section). Routers are used
399     to run some routing algorithm and determine routes (see Section @ref pf_routing for details).
400
401 @subsubsection pf_router &lt;router/&gt;
402
403 As said before, <b>router</b> is used only to give some information
404 for routing algorithms. So, it does not have any attributes except:
405
406 #### Attributes ####
407
408 Attribute name  | Mandatory | Values | Description
409 --------------- | --------- | ------ | -----------
410 id              | yes       | string | The identifier of the router to be used when referring to it.
411 coordinates     | no        | string | Must be provided when choosing the Vivaldi, coordinate-based routing model for the network zone the router belongs to. More details can be found in the Section @ref pf_P2P_tags.
412
413 #### Example ####
414
415 @verbatim
416  <router id="gw_dc1_horizdist"/>
417 @endverbatim
418
419 @subsubsection pf_tag_link &lt;link&gt;
420
421 Network links can represent one-hop network connections. They are
422 characterized by their id and their bandwidth; links can (but may not) be subject
423 to latency.
424
425 #### Attributes ####
426
427 Attribute name  | Mandatory | Values | Description
428 --------------- | --------- | ------ | -----------
429 id              | yes       | string | The identifier of the link to be used when referring to it.
430 bandwidth       | yes       | int    | Maximum bandwidth for this link, given in bytes/s
431 latency         | no        | double (default: 0.0) | Latency for this link.
432 sharing_policy  | no        | @ref sharing_policy_shared "SHARED"@|@ref pf_sharing_policy_fatpipe "FATPIPE"@|@ref pf_sharing_policy_splitduplex "SPLITDUPLEX" (default: SHARED) | Sharing policy for the link.
433 bandwidth_file  | no        | string | Allows you to use a file as input for bandwidth.
434 latency_file    | no        | string | Allows you to use a file as input for latency.
435 state_file      | no        | string | Allows you to use a file as input for states.
436
437
438 #### Possible shortcuts for ``latency`` ####
439
440 When using the latency attribute, you can specify the latency by using the scientific
441 notation or by using common abbreviations. For instance, the following three tags
442 are equivalent:
443
444 @verbatim
445  <link id="LINK1" bandwidth="125000000" latency="5E-6"/>
446  <link id="LINK1" bandwidth="125000000" latency="5us"/>
447  <link id="LINK1" bandwidth="125000000" latency="0.000005"/>
448 @endverbatim
449
450 Here, the second tag uses "us", meaning "microseconds". Other shortcuts are:
451
452 Name | Abbreviation | Time (in seconds)
453 ---- | ------------ | -----------------
454 Week | w | 7 * 24 * 60 * 60
455 Day  | d | 24 * 60 * 60
456 Hour | h | 60 * 60
457 Minute | m | 60
458 Second | s | 1
459 Millisecond | ms | 0.001 = 10^(-3)
460 Microsecond | us | 0.000001 = 10^(-6)
461 Nanosecond  | ns | 0.000000001 = 10^(-9)
462 Picosecond  | ps | 0.000000000001 = 10^(-12)
463
464 #### Sharing policy ####
465
466 @anchor sharing_policy_shared
467 By default a network link is @b SHARED, i.e., if two or more data flows go
468 through a link, the bandwidth is shared fairly among all data flows. This
469 is similar to the sharing policy TCP uses.
470
471 @anchor pf_sharing_policy_fatpipe
472 On the other hand, if a link is defined as a @b FATPIPE,
473 each flow going through this link will be provided with the complete bandwidth,
474 i.e., no sharing occurs and the bandwidth is only limiting each flow individually.
475 Please note that this is really on a per-flow basis, not only on a per-host basis!
476 The complete bandwidth provided by this link in this mode
477 is ``number_of_flows*bandwidth``, with at most ``bandwidth`` being available per flow.
478
479 Using the FATPIPE mode allows to model backbones that won't affect performance
480 (except latency).
481
482 @anchor pf_sharing_policy_splitduplex
483 The last mode available is @b SPLITDUPLEX. This means that SimGrid will
484 automatically generate two links (one carrying the suffix _UP and the other the
485 suffix _DOWN) for each ``<link>`` tag. This models situations when the direction
486 of traffic is important.
487
488 @remark
489   Transfers from one side to the other will interact similarly as
490   TCP when ACK returning packets circulate on the other direction. More
491   discussion about it is available in the description of link_ctn description.
492
493 In other words: The SHARED policy defines a physical limit for the bandwidth.
494 The FATPIPE mode defines a limit for each application,
495 with no upper total limit.
496
497 @remark
498   Tip: By using the FATPIPE mode, you can model big backbones that
499   won't affect performance (except latency).
500
501 #### Example ####
502
503 @verbatim
504  <link id="SWITCH" bandwidth="125000000" latency="5E-5" sharing_policy="FATPIPE" />
505 @endverbatim
506
507 #### Expressing dynamism and failures ####
508
509 Similar to hosts, it is possible to declare links whose state, bandwidth
510 or latency changes over time (see Section @ref pf_host_dynamism for details).
511
512 In the case of network links, the ``bandwidth`` and ``latency`` attributes are
513 replaced by the ``bandwidth_file`` and ``latency_file`` attributes.
514 The following XML snippet demonstrates how to use this feature in the platform
515 file. The structure of the files "link1.bw" and "link1.lat" is shown below.
516
517 @verbatim
518 <link id="LINK1" state_file="link1.fail" bandwidth="80000000" latency=".0001" bandwidth_file="link1.bw" latency_file="link1.lat" />
519 @endverbatim
520
521 @note
522   Even if the syntax is the same, the semantic of bandwidth and latency
523   trace files differs from that of host availability files. For bandwidth and
524   latency, the corresponding files do not
525   express availability as a fraction of the available capacity but directly in
526   bytes per seconds for the bandwidth and in seconds for the latency. This is
527   because most tools allowing to capture traces on real platforms (such as NWS)
528   express their results this way.
529
530 ##### Example of "link1.bw" file #####
531
532 ~~~{.py}
533 PERIODICITY 12.0
534 4.0 40000000
535 8.0 60000000
536 ~~~
537
538 In this example, the bandwidth changes repeatedly, with all changes
539 being repeated every 12 seconds.
540
541 At the beginning of the the simulation, the link's bandwidth is 80,000,000
542 B/s (i.e., 80 Mb/s); this value was defined in the XML snippet above.
543 After four seconds, it drops to 40 Mb/s (line 2), and climbs
544 back to 60 Mb/s after another 4 seconds (line 3). The value does not change any
545 more until the end of the period, that is, after 12 seconds have been simulated).
546 At this point, periodicity kicks in and this behavior is repeated: Seconds
547 12-16 will experience 80 Mb/s, 16-20 40 Mb/s etc.).
548
549 ##### Example of "link1.lat" file #####
550
551 ~~~{.py}
552 PERIODICITY 5.0
553 1.0 0.001
554 2.0 0.01
555 3.0 0.001
556 ~~~
557
558 In this example, the latency varies with a period of 5 seconds.
559 In the xml snippet above, the latency is initialized to be 0.0001s (100µs). This
560 value will be kept during the first second, since the latency_file contains
561 changes to this value at second one, two and three.
562 At second one, the value will be 0.001, i.e., 1ms. One second later it will
563 be adjusted to 0.01 (or 10ms) and one second later it will be set again to 1ms. The
564 value will not change until second 5, when the periodicity defined in line 1
565 kicks in. It then loops back, starting at 100µs (the initial value) for one second.
566
567 #### The ``<prop/>`` tag ####
568
569 Similar to the ``<host>`` tag, a link may also contain the ``<prop/>`` tag; see the host
570 documentation (Section @ref pf_tag_host) for an example.
571
572
573 @subsubsection pf_backbone <backbone/>
574
575 @note
576   This tag is <b>only available</b> when the containing network zone uses the "Cluster" routing mode!
577
578 Using this tag, you can designate an already existing link to be a backbone.
579
580 Attribute name  | Mandatory | Values | Description
581 --------------- | --------- | ------ | -----------
582 id              | yes       | string | Name of the link that is supposed to act as a backbone.
583
584 @subsection pf_storage Storage
585
586 @note
587   This is a prototype version that should evolve quickly, hence this
588   is just some doc valuable only at the time of writing.
589   This section describes the storage management under SimGrid ; nowadays
590   it's only usable with MSG. It relies basically on linux-like concepts.
591   You also may want to have a look to its corresponding section in 
592   @ref msg_file ; access functions are organized as a POSIX-like
593   interface.
594
595 @subsubsection pf_sto_conc Storage - Main Concepts
596
597 The storage facilities implemented in SimGrid help to model (and account for) 
598 storage devices, such as tapes, hard-drives, CD or DVD devices etc. 
599 A typical situation is depicted in the figure below:
600
601 @image html ./webcruft/storage_sample_scenario.png
602 @image latex ./webcruft/storage_sample_scenario.png "storage_sample_scenario" width=@textwidth
603
604 In this figure, two hosts called Bob and Alice are interconnected via a network
605 and each host is physically attached to a disk; it is not only possible for each host to
606 mount the disk they are attached to directly, but they can also mount disks
607 that are in a remote location. In this example, Bob mounts Alice's disk remotely
608 and accesses the storage via the network.
609
610 SimGrid provides 3 different entities that can be used to model setups
611 that include storage facilities:
612
613 Entity name     | Description
614 --------------- | -----------
615 @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).
616 @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.
617 @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).
618
619
620 @anchor pf_storage_content_file
621 ### %Storage Content File ###
622
623 In order to assess exactly how much time is spent reading from the storage,
624 SimGrid needs to know what is stored on the storage device (identified by distinct (file-)name, like in a file system)
625 and what size this content has.
626
627 @note
628     The content file is never changed by the simulation; it is parsed once
629     per simulation and kept in memory afterwards. When the content of the
630     storage changes, only the internal SimGrid data structures change.
631
632 @anchor pf_storage_content_file_structure
633 #### Structure of a %Storage Content File ####
634
635 Here is an excerpt from two storage content file; if you want to see the whole file, check
636 the file ``examples/platforms/content/storage_content.txt`` that comes with the
637 SimGrid source code.
638
639 SimGrid essentially supports two different formats: UNIX-style filepaths should
640 follow the well known format:
641
642 @verbatim
643 /lib/libsimgrid.so.3.6.2  12710497
644 /bin/smpicc  918
645 /bin/smpirun  7292
646 /bin/smpif2c  1990
647 /bin/simgrid_update_xml  5018
648 /bin/graphicator  66986
649 /bin/simgrid-colorizer  2993
650 /bin/smpiff  820
651 /bin/tesh  356434
652 @endverbatim
653
654 Windows filepaths, unsurprisingly, use the windows style:
655
656 @verbatim
657 @Windows@avastSS.scr 41664
658 @Windows@bfsvc.exe 75264
659 @Windows@bootstat.dat 67584
660 @Windows@CoreSingleLanguage.xml 31497
661 @Windows@csup.txt 12
662 @Windows@dchcfg64.exe 335464
663 @Windows@dcmdev64.exe 93288
664 @endverbatim
665
666 @note
667     The different file formats come at a cost; in version 3.12 (and most likely
668     in later versions, too), copying files from windows-style storages to unix-style
669     storages (and vice versa) is not supported.
670
671 @anchor pf_storage_content_file_create
672 #### Generate a %Storage Content File ####
673
674 If you want to generate a storage content file based on your own filesystem (or at least a filesystem you have access to),
675 try running this command (works only on unix systems):
676
677 @verbatim
678 find . -type f -exec ls -1s --block=1 {} @; 2>/dev/null | awk '{ print $2 " " $1}' > ./content.txt
679 @endverbatim
680
681 @subsubsection pf_storage_entities The Storage Entities
682
683 These are the entities that you can use in your platform files to include
684 storage in your model. See also the list of our @ref pf_storage_example_files "example files";
685 these might also help you to get started.
686
687 @anchor pf_storage_entity_storage_type
688 #### @<storage_type@> ####
689
690 Attribute name  | Mandatory | Values | Description
691 --------------- | --------- | ------ | -----------
692 id              | yes       | string | Identifier of this storage_type; used when referring to it
693 model           | no        | string | In the future, this will allow to change the performance model to use
694 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)
695 content         | yes       | string | Path to a @ref pf_storage_content_file "Storage Content File" on your system. This file must exist.
696
697 This tag must contain some predefined model properties, specified via the &lt;model_prop&gt; tag. Here is a list,
698 see below for an example:
699
700 Property id     | Mandatory | Values | Description
701 --------------- | --------- | ------ | -----------
702 Bwrite          | yes       | string | Bandwidth for write access; in B/s (but you can also specify e.g. "30MBps")
703 Bread           | yes       | string | Bandwidth for read access; in B/s (but you can also specify e.g. "30MBps")
704
705 @note
706      A storage_type can also contain the <b>&lt;prop&gt;</b> tag. The &lt;prop&gt; tag allows you
707      to associate additional information to this &lt;storage_type&gt; and follows the
708      attribute/value schema; see the example below. You may want to use it to give information to
709      the tool you use for rendering your simulation, for example.
710
711 Here is a complete example for the ``storage_type`` tag:
712 @verbatim
713 <storage_type id="single_HDD" size="4000">
714   <model_prop id="Bwrite" value="30MBps" />
715   <model_prop id="Bread" value="100MBps" />
716   <prop id="Brand" value="Western Digital" />
717 </storage_type>
718 @endverbatim
719
720 @subsubsection pf_tag_storage &lt;storage&gt; 
721
722 Attributes     | Mandatory | Values | Description
723 -------------- | --------- | ------ | -----------
724 id             | yes       | string | Identifier of this ``storage``; used when referring to it
725 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.
726 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)
727 content        | no        | string | When specified, overwrites the content attribute of @ref pf_storage_entity_storage_type "@<storage_type@>"
728
729 Here are two examples:
730
731 @verbatim
732      <storage id="Disk1" typeId="single_HDD" attach="bob" />
733
734      <storage id="Disk2" typeId="single_SSD"
735               content="content/win_storage_content.txt" />
736 @endverbatim
737
738 The first example is straightforward: A disk is defined and called "Disk1"; it is
739 of type "single_HDD" (shown as an example of @ref pf_storage_entity_storage_type "@<storage_type@>" above) and attached
740 to a host called "bob" (the definition of this host is omitted here).
741
742 The second storage is called "Disk2", is still of the same type as Disk1 but
743 now specifies a new content file (so the contents will be different from Disk1)
744 and the filesystem uses the windows style; finally, it is attached to a second host,
745 called alice (which is again not defined here).
746
747 @subsubsection pf_tag_mount &lt;mount&gt;
748
749 | Attribute   | Mandatory   | Values   | Description                                                                                               |
750 | ----------- | ----------- | -------- | -------------                                                                                             |
751 | id          | yes         | string   | Refers to a @ref pf_tag_storage "&lt;storage&gt;" entity that will be mounted on that computer |
752 | name        | yes         | string   | Path/location to/of the logical reference (mount point) of this disk
753
754 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)
755 is; this location is specified by the ``name`` attribute.
756
757 Here is a simple example, taken from the file ``examples/platform/storage.xml``:
758
759 @verbatim
760     <storage_type id="single_SSD" size="500GiB">
761        <model_prop id="Bwrite" value="60MBps" />
762        <model_prop id="Bread" value="200MBps" />
763     </storage_type>
764
765     <storage id="Disk2" typeId="single_SSD"
766               content="content/win_storage_content.txt"
767               attach="alice" />
768     <storage id="Disk4" typeId="single_SSD"
769              content="content/small_content.txt"
770              attach="denise"/>
771
772     <host id="alice" speed="1Gf">
773       <mount storageId="Disk2" name="c:"/>
774     </host>
775
776     <host id="denise" speed="1Gf">
777       <mount storageId="Disk2" name="c:"/>
778       <mount storageId="Disk4" name="/home"/>
779     </host>
780 @endverbatim
781
782 This example is quite interesting, as the same device, called "Disk2", is mounted by
783 two hosts at the same time! Note, however, that the host called ``alice`` is actually
784 attached to this storage, as can be seen in the @ref pf_tag_storage "&lt;storage&gt;"
785 tag. This means that ``denise`` must access this storage through the network, but SimGrid automatically takes
786 care of that for you.
787
788 Furthermore, this example shows that ``denise`` has mounted two storages with different
789 filesystem types (unix and windows). In general, a host can mount as many storage devices as
790 required.
791
792 @note
793     Again, the difference between ``attach`` and ``mount`` is simply that
794     an attached storage is always physically inside (or connected to) that machine;
795     for instance, a USB stick is attached to one and only one machine (where it's plugged-in)
796     but it can only be mounted on others, as mounted storage can also be a remote location.
797
798 ###### Example files #####
799
800 @verbinclude example_filelist_xmltag_mount
801
802 @subsubsection pf_storage_example_files Example files
803
804 Several examples were already discussed above; if you're interested in full examples,
805 check the the following platforms:
806
807 1. ``examples/platforms/storage.xml``
808 2. ``examples/platforms/remote_io.xml``
809
810 If you're looking for some examplary C code, you may find the source code
811 available in the directory ``examples/msg/io/`` useful.
812
813 @subsubsection pf_storage_examples_modelling Modelling different situations
814
815 The storage functionality of SimGrid is type-agnostic, that is, the implementation
816 does not presume any type of storage, such as HDDs/SSDs, RAM,
817 CD/DVD devices, USB sticks etc.
818
819 This allows the user to apply the simulator for a wide variety of scenarios; one
820 common scenario would be the access of remote RAM.
821
822 #### Modelling the access of remote RAM ####
823
824 How can this be achieved in SimGrid? Let's assume we have a setup where three hosts
825 (HostA, HostB, HostC) need to access remote RAM:
826
827 @verbatim
828       Host A
829     /
830 RAM -- Host B
831     @
832       Host C
833 @endverbatim
834
835 An easy way to model this scenario is to setup and define the RAM via the
836 @ref pf_tag_storage "storage" and @ref pf_storage_entity_storage_type "storage type"
837 entities and attach it to a remote dummy host; then, every host can have their own links
838 to this host (modelling for instance certain scenarios, such as PCIe ...)
839
840 @verbatim
841               Host A
842             /
843 RAM - Dummy -- Host B
844             @
845               Host C
846 @endverbatim
847
848 Now, if read from this storage, the host that mounts this storage
849 communicates to the dummy host which reads from RAM and
850 sends the information back.
851
852
853 @section pf_routing Routing
854
855 To achieve high performance, the routing tables used within SimGrid are
856 static. This means that routing between two nodes is calculated once
857 and will not change during execution. The SimGrid team chose to use this
858 approach as it is rare to have a real deficiency of a resource;
859 most of the time, a communication fails because the links experience too much
860 congestion and hence, your connection stops before the timeout or
861 because the computer designated to be the destination of that message
862 is not responding.
863
864 We also chose to use shortest paths algorithms in order to emulate
865 routing. Doing so is consistent with the reality: [RIP](https://en.wikipedia.org/wiki/Routing_Information_Protocol),
866 [OSPF](https://en.wikipedia.org/wiki/Open_Shortest_Path_First), [BGP](https://en.wikipedia.org/wiki/Border_Gateway_Protocol)
867 are all calculating shortest paths. They do require some time to converge, but
868 eventually, when the routing tables have stabilized, your packets will follow
869 the shortest paths.
870
871 @subsection  pf_tag_zone &lt;zone&gt;
872
873 Before SimGrid v3.16, networking zones used to be called Autonomous
874 Systems, but this was misleading as zones may include other zones in a
875 hierarchical manner. If you find any remaining reference to network
876 zones, please report this as a bug.
877
878 Attribute   | Value                                             | Description
879 ----------- | ------------------------------------------------- | ----------------------------------------------
880 id          | String (mandatory)                                | The identifier of this zone (must be unique)
881 routing     | One of the existing routing algorithm (mandatory) | See Section @ref pf_rm for details.
882
883 <b>Example:</b>
884 @code
885 <zone id="zone0" routing="Full">
886    <host id="host1" speed="1000000000"/>
887    <host id="host2" speed="1000000000"/>
888    <link id="link1" bandwidth="125000000" latency="0.000100"/>
889    <route src="host1" dst="host2"><link_ctn id="link1"/></route>
890 </zone>
891 @endcode
892
893 In this example, zone0 contains two hosts (host1 and host2). The route
894 between the hosts goes through link1.
895
896 @subsection pf_rm Routing models
897
898 For each network zone, you must define explicitly which routing model will
899 be used. There are 3 different categories for routing models:
900
901 1. @ref pf_routing_model_shortest_path "Shortest-path" based models: SimGrid calculates shortest
902    paths and manages them. Behaves more or less like most real life
903    routing mechanisms.
904 2. @ref pf_routing_model_manual "Manually-entered" route models: you have to define all routes
905    manually in the platform description file; this can become
906    tedious very quickly, as it is very verbose.
907    Consistent with some manually managed real life routing.
908 3. @ref pf_routing_model_simple "Simple/fast models": those models offer fast, low memory routing
909    algorithms. You should consider to use this type of model if 
910    you can make some assumptions about your network zone.
911    Routing in this case is more or less ignored.
912
913 @subsubsection pf_raf The router affair
914
915 Using routers becomes mandatory when using shortest-path based
916 models or when using the bindings to the ns-3 packet-level
917 simulator instead of the native analytical network model implemented
918 in SimGrid.
919
920 For graph-based shortest path algorithms, routers are mandatory, because these
921 algorithms require a graph as input and so we need to have source and
922 destination for each edge.
923
924 Routers are naturally an important concept ns-3 since the
925 way routers run the packet routing algorithms is actually simulated.
926 SimGrid's analytical models however simply aggregate the routing time
927 with the transfer time. 
928
929 So why did we incorporate routers in SimGrid? Rebuilding a graph representation
930 only from the route information turns out to be a very difficult task, because
931 of the missing information about how routes intersect. That is why we
932 introduced routers, which are simply used to express these intersection points.
933 It is important to understand that routers are only used to provide topological
934 information.
935
936 To express this topological information, a <b>route</b> has to be
937 defined in order to declare which link is connected to a router. 
938
939
940 @subsubsection pf_routing_model_shortest_path Shortest-path based models
941
942 The following table shows all the models that compute routes using
943 shortest-paths algorithms are currently available in SimGrid. More detail on how
944 to choose the best routing model is given in the Section called @"@ref pf_routing_howto_choose_wisely@".
945
946 | Name                                                | Description                                                                |
947 | --------------------------------------------------- | -------------------------------------------------------------------------- |
948 | @ref pf_routing_model_floyd "Floyd"                 | Floyd routing data. Pre-calculates all routes once                         |
949 | @ref pf_routing_model_dijkstra "Dijkstra"           | Dijkstra routing data. Calculates routes only when needed                  |
950 | @ref pf_routing_model_dijkstracache "DijkstraCache" | Dijkstra routing data. Handles some cache for already calculated routes.   |
951
952 All those shortest-path models are instanciated in the same way and are
953 completely interchangeable. Here are some examples:
954
955 @anchor pf_routing_model_floyd
956 ### Floyd ###
957
958 Floyd example:
959 @verbatim
960 <zone  id="zone0"  routing="Floyd">
961
962   <cluster id="my_cluster_1" prefix="c-" suffix=""
963            radical="0-1" speed="1000000000" bw="125000000" lat="5E-5"
964            router_id="router1"/>
965
966   <zone id="zone1" routing="None">
967     <host id="host1" speed="1000000000"/>
968   </zone>
969
970   <link id="link1" bandwidth="100000" latency="0.01"/>
971
972   <zoneroute src="my_cluster_1" dst="zone1"
973     gw_src="router1"
974     gw_dst="host1">
975     <link_ctn id="link1"/>
976   </zoneroute>
977
978 </zone>
979 @endverbatim
980
981 zoneroute given at the end gives a topological information: link1 is
982 between router1 and host1.
983
984 #### Example platform files ####
985
986 This is an automatically generated list of example files that use the Floyd
987 routing model (the path is given relative to SimGrid's source directory)
988
989 @verbinclude example_filelist_routing_floyd
990
991 @anchor pf_routing_model_dijkstra
992 ### Dijkstra ###
993
994 #### Example platform files ####
995
996 This is an automatically generated list of example files that use the Dijkstra
997 routing model (the path is given relative to SimGrid's source directory)
998
999 @verbinclude example_filelist_routing_dijkstra
1000
1001 Dijkstra example:
1002 @verbatim
1003  <zone id="zone_2" routing="Dijkstra">
1004      <host id="zone_2_host1" speed="1000000000"/>
1005      <host id="zone_2_host2" speed="1000000000"/>
1006      <host id="zone_2_host3" speed="1000000000"/>
1007      <link id="zone_2_link1" bandwidth="1250000000" latency="5E-4"/>
1008      <link id="zone_2_link2" bandwidth="1250000000" latency="5E-4"/>
1009      <link id="zone_2_link3" bandwidth="1250000000" latency="5E-4"/>
1010      <link id="zone_2_link4" bandwidth="1250000000" latency="5E-4"/>
1011      <router id="central_router"/>
1012      <router id="zone_2_gateway"/>
1013      <!-- routes providing topological information -->
1014      <route src="central_router" dst="zone_2_host1"><link_ctn id="zone_2_link1"/></route>
1015      <route src="central_router" dst="zone_2_host2"><link_ctn id="zone_2_link2"/></route>
1016      <route src="central_router" dst="zone_2_host3"><link_ctn id="zone_2_link3"/></route>
1017      <route src="central_router" dst="zone_2_gateway"><link_ctn id="zone_2_link4"/></route>
1018   </zone>
1019 @endverbatim
1020
1021 @anchor pf_routing_model_dijkstracache
1022 ### DijkstraCache ###
1023
1024 DijkstraCache example:
1025 @verbatim
1026 <zone id="zone_2" routing="DijkstraCache">
1027      <host id="zone_2_host1" speed="1000000000"/>
1028      ...
1029 (platform unchanged compared to upper example)
1030 @endverbatim
1031
1032 #### Example platform files ####
1033
1034 This is an automatically generated list of example files that use the DijkstraCache
1035 routing model (the path is given relative to SimGrid's source directory):
1036
1037 Editor's note: At the time of writing, no platform file used this routing model - so
1038 if there are no example files listed here, this is likely to be correct.
1039
1040 @verbinclude example_filelist_routing_dijkstra_cache
1041
1042 @subsubsection pf_routing_model_manual Manually-entered route models
1043
1044 | Name                               | Description                                                                    |
1045 | ---------------------------------- | ------------------------------------------------------------------------------ |
1046 | @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. |
1047
1048 @anchor pf_routing_model_full
1049 ### Full ###
1050
1051 Full example:
1052 @verbatim
1053 <zone  id="zone0"  routing="Full">
1054    <host id="host1" speed="1000000000"/>
1055    <host id="host2" speed="1000000000"/>
1056    <link id="link1" bandwidth="125000000" latency="0.000100"/>
1057    <route src="host1" dst="host2"><link_ctn id="link1"/></route>
1058  </zone>
1059 @endverbatim
1060
1061 #### Example platform files ####
1062
1063 This is an automatically generated list of example files that use the Full
1064 routing model (the path is given relative to SimGrid's source directory):
1065
1066 @verbinclude example_filelist_routing_full
1067
1068 @subsubsection pf_routing_model_simple Simple/fast models
1069
1070 | Name                                     | Description                                                                                                                         |
1071 | ---------------------------------------- | ------------------------------------------------------------------------------                                                      |
1072 | @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. |
1073 | @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.       |
1074 | @ref pf_routing_model_vivaldi "Vivaldi"  | Perfect when you want to use coordinates. Also see the corresponding @ref pf_P2P_tags "P2P section" below.                          |
1075
1076 @anchor pf_routing_model_cluster
1077 ### Cluster ###
1078
1079 @note
1080  In this mode, the @ref pf_cabinet "&lt;cabinet/&gt;" tag is available.
1081
1082 #### Example platform files ####
1083
1084 This is an automatically generated list of example files that use the Cluster
1085 routing model (the path is given relative to SimGrid's source directory):
1086
1087 @verbinclude example_filelist_routing_cluster
1088
1089 @anchor pf_routing_model_none
1090
1091 ### None ###
1092
1093 This model does exactly what it's name advertises: Nothing. There is no routing
1094 available within this model and if you try to communicate within the zone that
1095 uses this model, SimGrid will fail unless you have explicitly activated the
1096 @ref options_model_select_network_constant "Constant Network Model" (this model charges
1097 the same for every single communication). It should
1098 be noted, however, that you can still attach an @ref pf_tag_zoneroute "ZoneRoute",
1099 as is demonstrated in the example below:
1100
1101 @verbinclude platforms/cluster_and_one_host.xml
1102
1103 #### Example platform files ####
1104
1105 This is an automatically generated list of example files that use the None
1106 routing model (the path is given relative to SimGrid's source directory):
1107
1108 @verbinclude example_filelist_routing_none
1109
1110
1111 @anchor pf_routing_model_vivaldi
1112 ### Vivaldi ###
1113
1114 For more information on how to use the [Vivaldi Coordinates](https://en.wikipedia.org/wiki/Vivaldi_coordinates),
1115 see also Section @ref pf_P2P_tags "P2P tags".
1116
1117 Note that it is possible to combine the Vivaldi routing model with other routing models;
1118 an example can be found in the file @c examples/platforms/cloud.xml. This
1119 examples models a NetZone using Vivaldi that contains other NetZones that use different
1120 routing models.
1121
1122 #### Example platform files ####
1123
1124 This is an automatically generated list of example files that use the None
1125 routing model (the path is given relative to SimGrid's source directory):
1126
1127 @verbinclude example_filelist_routing_vivaldi
1128
1129
1130 @subsection ps_dec Defining routes
1131
1132 There are currently four different ways to define routes: 
1133
1134 | Name                                              | Description                                                                         |
1135 | ------------------------------------------------- | ----------------------------------------------------------------------------------- |
1136 | @ref pf_tag_route "route"                 | Used to define route between host/router                                            |
1137 | @ref pf_tag_zoneroute "zoneRoute"             | Used to define route between different zones                                           |
1138 | @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. |
1139 | @ref pf_tag_bypassasroute "bypassZoneRoute"  | Used in the same way as bypassRoute, but for zones                                     |
1140
1141 Basically all those tags will contain an (ordered) list of references
1142 to link that compose the route you want to define.
1143
1144 Consider the example below:
1145
1146 @verbatim
1147 <route src="Alice" dst="Bob">
1148         <link_ctn id="link1"/>
1149         <link_ctn id="link2"/>
1150         <link_ctn id="link3"/>
1151 </route>
1152 @endverbatim
1153
1154 The route here from host Alice to Bob will be first link1, then link2,
1155 and finally link3. What about the reverse route? @ref pf_tag_route "Route" and
1156 @ref pf_tag_zoneroute "zoneroute" have an optional attribute @c symmetrical, that can
1157 be either @c YES or @c NO. @c YES means that the reverse route is the same
1158 route in the inverse order, and is set to @c YES by default. Note that
1159 this is not the case for bypass*Route, as it is more probable that you
1160 want to bypass only one default route.
1161
1162 For an @ref pf_tag_zoneroute "zoneroute", things are just slightly more complicated, as you have
1163 to give the id of the gateway which is inside the zone you want to access ... 
1164 So it looks like this:
1165
1166 @verbatim
1167 <zoneroute src="zone1" dst="zone2"
1168   gw_src="router1" gw_dst="router2">
1169   <link_ctn id="link1"/>
1170 </zoneroute>
1171 @endverbatim
1172
1173 gw == gateway, so when any message are trying to go from zone1 to zone2,
1174 it means that it must pass through router1 to get out of the zone, then
1175 pass through link1, and get into zone2 by being received by router2.
1176 router1 must belong to zone1 and router2 must belong to zone2.
1177
1178 @subsubsection pf_tag_linkctn &lt;link_ctn&gt;
1179
1180 This entity has only one purpose: Refer to an already existing
1181 @ref pf_tag_link "&lt;link/&gt;" when defining a route, i.e., it
1182 can only occur as a child of @ref pf_tag_route "&lt;route/&gt;"
1183
1184 | Attribute name  | Mandatory | Values | Description                                                   |
1185 | --------------- | --------- | ------ | -----------                                                   |
1186 | id              | yes       | String | The identifier of the link that should be added to the route. |
1187 | direction       | maybe     | UP@|DOWN | If the link referenced by @c id has been declared as @ref pf_sharing_policy_splitduplex "SPLITDUPLEX", this indicates which direction the route traverses through this link: UP or DOWN. If you don't use SPLITDUPLEX, do not use this attribute or SimGrid will not find the right link.
1188
1189 #### Example Files ####
1190
1191 This is an automatically generated list of example files that use the @c &lt;link_ctn/&gt;
1192 entity (the path is given relative to SimGrid's source directory):
1193
1194 @verbinclude example_filelist_xmltag_linkctn
1195
1196 @subsubsection pf_tag_zoneroute &lt;zoneRoute&gt;
1197
1198 The purpose of this entity is to define a route between two
1199 NetZones. Recall that all zones form a tree, so to connect two
1200 sibiling zones, you must give such a zoneRoute specifying the source
1201 and destination zones, along with the gateway in each zone (ie, the
1202 point to reach within that zone to reach the netzone), and the list of
1203 links in the ancestor zone to go from one zone to another.
1204
1205 So, to go from an host @c src_host that is within zone @c src, to an
1206 host @c dst_host that is within @c dst, you need to:
1207
1208  - move within zone @c src, from @c src_host to the specified @c gw_src;
1209  - traverse all links specified by the zoneRoute (they are supposed to be within the common ancestor);
1210  - move within zone @c dst, from @c gw_dst to @c dst_host.
1211
1212 #### Attributes ####
1213
1214 | Attribute name  | Mandatory | Values | Description                                                                                                                                |
1215 | --------------- | --------- | ------ | -----------                                                                                                                                |
1216 | src             | yes       | String | The identifier of the source zone                                                                                                            |
1217 | dst             | yes       | String | See the @c src attribute                                                                                                                   |
1218 | 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. |
1219 | gw_dst          | yes       | String | Same as @c gw_src, but with the dst zone instead.                                                                                            |
1220 | symmetrical     | no        | YES@|NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly.               | 
1221
1222 #### Example ####
1223
1224 @verbatim
1225 <zone  id="zone0"  routing="Full">
1226   <cluster id="my_cluster_1" prefix="c-" suffix=".me"
1227                 radical="0-149" speed="1000000000" bw="125000000" lat="5E-5"
1228         bb_bw="2250000000" bb_lat="5E-4"/>
1229
1230   <cluster id="my_cluster_2" prefix="c-" suffix=".me"
1231     radical="150-299" speed="1000000000" bw="125000000" lat="5E-5"
1232     bb_bw="2250000000" bb_lat="5E-4"/>
1233
1234      <link id="backbone" bandwidth="1250000000" latency="5E-4"/>
1235
1236      <zoneroute src="my_cluster_1" dst="my_cluster_2"
1237          gw_src="c-my_cluster_1_router.me"
1238          gw_dst="c-my_cluster_2_router.me">
1239                 <link_ctn id="backbone"/>
1240      </zoneroute>
1241      <zoneroute src="my_cluster_2" dst="my_cluster_1"
1242          gw_src="c-my_cluster_2_router.me"
1243          gw_dst="c-my_cluster_1_router.me">
1244                 <link_ctn id="backbone"/>
1245      </zoneroute>
1246 </zone>
1247 @endverbatim
1248
1249 @subsubsection pf_tag_route &lt;route&gt; 
1250
1251 The principle is the same as for 
1252 @ref pf_tag_zoneroute "ZoneRoute": The route contains a list of links that
1253 provide a path from @c src to @c dst. Here, @c src and @c dst can both be either a 
1254 @ref pf_tag_host "host" or @ref pf_router "router".  This is mostly useful for the 
1255 @ref pf_routing_model_full "Full routing model" as well as for the 
1256 @ref pf_routing_model_shortest_path "shortest-paths" based models (as they require 
1257 topological information).
1258
1259
1260 | Attribute name  | Mandatory | Values                 | Description                                                                                        |
1261 | --------------- | --------- | ---------------------- | -----------                                                                                        |
1262 | src             | yes       | String                 | The value given to the source's "id" attribute                                                     |
1263 | dst             | yes       | String                 | The value given to the destination's "id" attribute.                                               |
1264 | symmetrical     | no        | YES@| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
1265
1266
1267 #### Examples ####
1268
1269 A route in the @ref pf_routing_model_full "Full routing model" could look like this:
1270 @verbatim
1271  <route src="Tremblay" dst="Bourassa">
1272      <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"/>
1273  </route>
1274 @endverbatim
1275
1276 A route in the @ref pf_routing_model_shortest_path "Shortest-Path routing model" could look like this:
1277 @verbatim
1278 <route src="Tremblay" dst="Bourassa">
1279   <link_ctn id="3"/>
1280 </route>
1281 @endverbatim
1282 @note 
1283     You must only have one link in your routes when you're using them to provide
1284     topological information, as the routes here are simply the edges of the
1285     (network-)graph and the employed algorithms need to know which edge connects
1286     which pair of entities.
1287
1288 @subsubsection pf_tag_bypassasroute bypasszoneroute
1289
1290 As said before, once you choose
1291 a model, it (most likely; the constant network model, for example, doesn't) calculates routes for you. But maybe you want to
1292 define some of your routes, which will be specific. You may also want
1293 to bypass some routes defined in lower level zone at an upper stage:
1294 <b>bypasszoneroute</b> is the tag you're looking for. It allows to
1295 bypass routes defined between already defined between zone (if you want
1296 to bypass route for a specific host, you should just use byPassRoute).
1297 The principle is the same as zoneroute: <b>bypasszoneroute</b> contains
1298 list of links that are in the path between src and dst.
1299
1300 #### Attributes ####
1301
1302 | Attribute name  | Mandatory | Values                  | Description                                                                                                  |
1303 | --------------- | --------- | ----------------------  | -----------                                                                                                  |
1304 | src             | yes       | String                  | The value given to the source zone's "id" attribute                                                            |
1305 | dst             | yes       | String                  | The value given to the destination zone's "id" attribute.                                                      |
1306 | 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     |
1307 | 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|
1308 | symmetrical     | no        | YES@| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
1309
1310 #### Example ####
1311
1312 @verbatim
1313 <bypasszoneRoute src="my_cluster_1" dst="my_cluster_2"
1314   gw_src="my_cluster_1_router"
1315   gw_dst="my_cluster_2_router">
1316     <link_ctn id="link_tmp"/>
1317 </bypasszoneroute>
1318 @endverbatim
1319
1320 This example shows that link @c link_tmp (definition not displayed here) directly
1321 connects the router @c my_cluster_1_router in the source cluster to the router
1322 @c my_cluster_2_router in the destination router. Additionally, as the @c symmetrical
1323 attribute was not given, this route is presumed to be symmetrical.
1324
1325 @subsubsection pf_tag_bypassroute bypassRoute
1326
1327 As said before, once you choose
1328 a model, it (most likely; the constant network model, for example, doesn't) calculates routes for you. But maybe you want to
1329 define some of your routes, which will be specific. You may also want
1330 to bypass some routes defined in lower level zone at an upper stage:
1331 <b>bypassRoute</b> is the tag you're looking for. It allows to bypass
1332 routes defined between <b>host/router</b>. The principle is the same
1333 as route: <b>bypassRoute</b> contains list of links references of
1334 links that are in the path between src and dst.
1335
1336 #### Attributes ####
1337
1338 | Attribute name  | Mandatory | Values                  | Description                                                                                                  |
1339 | --------------- | --------- | ----------------------  | -----------                                                                                                  |
1340 | src             | yes       | String                  | The value given to the source zone's "id" attribute                                                            |
1341 | dst             | yes       | String                  | The value given to the destination zone's "id" attribute.                                                      |
1342 | symmetrical     | no        | YES @| NO (Default: YES) | If this route is symmetric, the opposite route (from dst to src) will also be declared implicitly. |
1343
1344 #### Examples ####
1345
1346 @verbatim
1347 <bypassRoute src="host_1" dst="host_2">
1348    <link_ctn id="link_tmp"/>
1349 </bypassRoute>
1350 @endverbatim
1351
1352 This example shows that link @c link_tmp (definition not displayed here) directly
1353 connects host @c host_1 to host @c host_2. Additionally, as the @c symmetrical
1354 attribute was not given, this route is presumed to be symmetrical.
1355
1356 @subsection pb_baroex Basic Routing Example
1357
1358 Let's say you have an zone named zone_Big that contains two other zone, zone_1
1359 and zone_2. If you want to make a host (h1) from zone_1 with another one
1360 (h2) from zone_2 then you'll have to proceed as follows:
1361 @li First, you have to ensure that a route is defined from h1 to the
1362     zone_1's exit gateway and from h2 to zone_2's exit gateway.
1363 @li Then, you'll have to define a route between zone_1 to zone_2. As those
1364     zone are both resources belonging to zone_Big, then it has to be done
1365     at zone_big level. To define such a route, you have to give the
1366     source zone (zone_1), the destination zone (zone_2), and their respective
1367     gateway (as the route is effectively defined between those two
1368     entry/exit points). Elements of this route can only be elements
1369     belonging to zone_Big, so links and routers in this route should be
1370     defined inside zone_Big. If you choose some shortest-path model,
1371     this route will be computed automatically.
1372
1373 As said before, there are mainly 2 tags for routing:
1374 @li <b>zoneroute</b>: to define routes between two  <b>zone</b>
1375 @li <b>route</b>: to define routes between two <b>host/router</b>
1376
1377 As we are dealing with routes between zone, it means that those we'll
1378 have some definition at zone_Big level. Let consider zone_1 contains 1
1379 host, 1 link and one router and zone_2 3 hosts, 4 links and one router.
1380 There will be a central router, and a cross-like topology. At the end
1381 of the crosses arms, you'll find the 3 hosts and the router that will
1382 act as a gateway. We have to define routes inside those two zone. Let
1383 say that zone_1 contains full routes, and zone_2 contains some Floyd
1384 routing (as we don't want to bother with defining all routes). As
1385 we're using some shortest path algorithms to route into zone_2, we'll
1386 then have to define some <b>route</b> to gives some topological
1387 information to SimGrid. Here is a file doing it all:
1388
1389 @verbatim
1390 <zone  id="zone_Big"  routing="Dijkstra">
1391   <zone id="zone_1" routing="Full">
1392      <host id="zone_1_host1" speed="1000000000"/>
1393      <link id="zone_1_link" bandwidth="1250000000" latency="5E-4"/>
1394      <router id="zone_1_gateway"/>
1395      <route src="zone_1_host1" dst="zone_1_gateway">
1396             <link_ctn id="zone_1_link"/>
1397      </route>
1398   </zone>
1399   <zone id="zone_2" routing="Floyd">
1400      <host id="zone_2_host1" speed="1000000000"/>
1401      <host id="zone_2_host2" speed="1000000000"/>
1402      <host id="zone_2_host3" speed="1000000000"/>
1403      <link id="zone_2_link1" bandwidth="1250000000" latency="5E-4"/>
1404      <link id="zone_2_link2" bandwidth="1250000000" latency="5E-4"/>
1405      <link id="zone_2_link3" bandwidth="1250000000" latency="5E-4"/>
1406      <link id="zone_2_link4" bandwidth="1250000000" latency="5E-4"/>
1407      <router id="central_router"/>
1408      <router id="zone_2_gateway"/>
1409      <!-- routes providing topological information -->
1410      <route src="central_router" dst="zone_2_host1"><link_ctn id="zone_2_link1"/></route>
1411      <route src="central_router" dst="zone_2_host2"><link_ctn id="zone_2_link2"/></route>
1412      <route src="central_router" dst="zone_2_host3"><link_ctn id="zone_2_link3"/></route>
1413      <route src="central_router" dst="zone_2_gateway"><link_ctn id="zone_2_link4"/></route>
1414   </zone>
1415     <link id="backbone" bandwidth="1250000000" latency="5E-4"/>
1416
1417      <zoneroute src="zone_1" dst="zone_2"
1418          gw_src="zone_1_gateway"
1419          gw_dst="zone_2_gateway">
1420                 <link_ctn id="backbone"/>
1421      </zoneroute>
1422 </zone>
1423 @endverbatim
1424
1425 @section pf_other Other tags
1426
1427 The following tags can be used inside a @<platform@> tag even if they are not
1428 directly describing the platform:
1429
1430   - @ref pf_tag_config passes configuration options, e.g. to change the network model;
1431   - @ref pf_tag_prop gives user-defined properties to various elements
1432
1433 @subsection pf_tag_config &lt;config&gt;
1434
1435 Adding configuration flags into the platform file is particularly
1436 useful when the described platform is best used with specific
1437 flags. For example, you could finely tune SMPI in your platform file directly.
1438
1439 | Attribute  | Values              | Description                                    |
1440 | ---------- | ------------------- | ---------------------------------------------- |
1441 | id         | String (optional)   | This optional identifier is ignored by SimGrid |
1442
1443 * **Included tags:** @ref pf_tag_prop to specify a given configuration item (see @ref options).
1444
1445 Any such configuration must be given at the very top of the platform file.
1446
1447 * **Example**
1448
1449 @verbatim
1450 <?xml version='1.0'?>
1451 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
1452 <platform version="4">
1453 <config>
1454         <prop id="maxmin/precision" value="0.000010" />
1455         <prop id="cpu/optim" value="TI" />
1456         <prop id="network/model" value="SMPI" />
1457         <prop id="smpi/bw-factor" value="65472:0.940694;15424:0.697866;9376:0.58729" />
1458 </config>
1459
1460 <zone  id="zone0"  routing="Full">
1461 ...
1462 @endverbatim
1463
1464 @subsection pf_tag_prop &lt;prop&gt;
1465
1466 Defines a user-defined property, identified with a name and having a
1467 value. You can specify such properties to most kind of resources:
1468 @ref pf_tag_zone, @ref pf_tag_host, @ref pf_tag_storage,
1469 @ref pf_tag_cluster and @ref pf_tag_link. These values can be retrieved
1470 at runtime with MSG_zone_property() or simgrid::s4u::NetZone::property(),
1471 or similar functions.
1472
1473 | Attribute | Values                  | Description                                                                               |
1474 | --------- | ----------------------  | ----------------------------------------------------------------------------------------- |
1475 | id        | String (mandatory)      | Identifier of this property. Must be unique for a given property holder, eg host or link. |
1476 | value     | String (mandatory)      | Value of this property; The semantic is completely up to you.                             |
1477
1478 * **Included tags:** none.
1479
1480 #### Example ####
1481
1482 @code{.xml}
1483 <prop id="Operating System" value="Linux" />
1484 @endcode
1485
1486
1487 @subsection pf_trace trace and trace_connect
1488
1489 Both tags are an alternate way to pass files containing information on
1490 availability, state etc. to an entity. (See also @ref howto_churn).
1491 Instead of referring to the file directly in the host, link, or
1492 cluster tag, you proceed by defining a trace with an id corresponding
1493 to a file, later a host/link/cluster, and finally using trace_connect
1494 you say that the file trace must be used by the entity.
1495
1496
1497 #### Example #### 
1498
1499 @verbatim
1500 <zone  id="zone0"  routing="Full">
1501   <host id="bob" speed="1000000000"/>
1502 </zone>
1503 <trace id="myTrace" file="bob.trace" periodicity="1.0"/>
1504 <trace_connect trace="myTrace" element="bob" kind="POWER"/>
1505 @endverbatim
1506
1507 @note 
1508     The order here is important.  @c trace_connect must come 
1509     after the elements @c trace and @c host, as both the host
1510     and the trace definition must be known when @c trace_connect
1511     is parsed; the order of @c trace and @c host is arbitrary.
1512
1513
1514 #### @c trace attributes ####
1515
1516
1517 | Attribute name  | Mandatory | Values                 | Description                                                                                       |
1518 | --------------- | --------- | ---------------------- | -----------                                                                                       |
1519 | id              | yes       | String                 | Identifier of this trace; this is the name you pass on to @c trace_connect.                       |
1520 | 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. |
1521 | trace_periodicity | yes | String | This is the same as for @ref pf_tag_host "hosts" (see there for details) |
1522
1523 Here is an example  of trace when no file name is provided:
1524
1525 @verbatim
1526  <trace id="myTrace" periodicity="1.0">
1527     0.0 1.0
1528     11.0 0.5
1529     20.0 0.8
1530  </trace>
1531 @endverbatim
1532
1533 #### @c trace_connect attributes ####
1534
1535 | Attribute name  | Mandatory | Values                 | Description                                                                                       |
1536 | --------------- | --------- | ---------------------- | -----------                                                                                       |
1537 | kind            | no        | HOST_AVAIL@|POWER@|<br/>LINK_AVAIL@|BANDWIDTH@|LATENCY (Default: HOST_AVAIL)   | Describes the kind of trace.                   |
1538 | trace           | yes       | String                 | Identifier of the referenced trace (specified of the trace's @c id attribute)                     |
1539 | element         | yes       | String                 | The identifier of the referenced entity as given by its @c id attribute                           |
1540
1541 @section pf_hints Hints, tips and frequently requested features
1542
1543 Now you should know at least the syntax and be able to create a
1544 platform by your own. However, after having ourselves wrote some platforms, there
1545 are some best practices you should pay attention to in order to
1546 produce good platform and some choices you can make in order to have
1547 faster simulations. Here's some hints and tips, then.
1548
1549 @subsection pf_hints_search Finding the platform example that you need
1550
1551 Most platform files that we ship are in the @c examples/platforms
1552 folder. The good old @c grep tool can find the examples you need when
1553 wondering on a specific XML tag. Here is an example session searching
1554 for @ref pf_trace "trace_connect":
1555
1556 @verbatim
1557 % cd examples/platforms
1558 % grep -R -i -n --include="*.xml" "trace_connect" .
1559 ./two_hosts_platform_with_availability_included.xml:26:<trace_connect kind="SPEED" trace="A" element="Cpu A"/>
1560 ./two_hosts_platform_with_availability_included.xml:27:<trace_connect kind="HOST_AVAIL" trace="A_failure" element="Cpu A"/>
1561 ./two_hosts_platform_with_availability_included.xml:28:<trace_connect kind="SPEED" trace="B" element="Cpu B"/>
1562 ./two_hosts.xml:17:  <trace_connect trace="Tremblay_power" element="Tremblay" kind="SPEED"/>
1563 @endverbatim
1564
1565 @subsection pf_hint_generating How to generate different platform files?
1566
1567 This is actually a good idea to search for a better platform file,
1568 that better fit the need of your study. To be honest, the provided
1569 examples are not representative of anything. They exemplify our XML
1570 syntax, but that's all. small_platform.xml for example was generated
1571 without much thought beyond that.
1572
1573 The best thing to do when possible is to write your own platform file,
1574 that model the platform on which you run your code. For that, you
1575 could use <a href="https://gitlab.inria.fr/simgrid/platform-calibration">our
1576 calibration scripts</a>. This leads to very good fits between the
1577 platform, the model and the needs.  The g5k.xml example resulted of
1578 such an effort, which also lead to <a href="https://github.com/lpouillo/topo5k/">an 
1579 ongoing attempt</a> to automatically extract the SimGrid platform from
1580 the <a href="http://grid5000.fr/">Grid'5000</a> experimental platform.
1581 But it's hard to come up with generic models. Don't take these files
1582 too seriously. Actually, you should always challenge our models and
1583 your instanciation if the accuracy really matters to you (see <a
1584 href="https://hal.inria.fr/hal-00907887">this discussion</a>).
1585
1586 But such advices only hold if you have a real platform and a real
1587 application at hand. It's moot for more abstract studies working on
1588 ideas and algorithms instead of technical artefacts. Well, in this
1589 case, there unfortunately is nothing better than this old and rusty
1590 <a href="http://pda.gforge.inria.fr/tools/download.html">simulacrum</a>.
1591 This project is dormant since over 10 years (and you will have to
1592 update the generated platforms with <tt>bin/simgrid_update_xml</tt> to
1593 use them), but that's the best we have for this right now....
1594
1595 @subsection pf_zone_h Zone Hierarchy
1596 The network zone design allows SimGrid to go fast, because computing route is
1597 done only for the set of resources defined in the current zone. If you're using
1598 only a big zone containing all resource with no zone into it and you're
1599 using Full model, then ... you'll loose all interest into it. On the
1600 other hand, designing a binary tree of zone with, at the lower level,
1601 only one host, then you'll also loose all the good zone hierarchy can
1602 give you. Remind you should always be "reasonable" in your platform
1603 definition when choosing the hierarchy. A good choice if you try to
1604 describe a real life platform is to follow the zone described in
1605 reality, since this kind of trade-off works well for real life
1606 platforms.
1607
1608 @subsection pf_exit_zone Exit Zone: why and how
1609 Users that have looked at some of our platforms may have notice a
1610 non-intuitive schema ... Something like that:
1611
1612
1613 @verbatim
1614 <zone id="zone_4"  routing="Full">
1615 <zone id="exitzone_4"  routing="Full">
1616         <router id="router_4"/>
1617 </zone>
1618 <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"/>
1619 <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"/>
1620 <link id="4_1" bandwidth="2250000000" latency="5E-5"/>
1621 <link id="4_2" bandwidth="2250000000" latency="5E-5"/>
1622 <link id="bb_4" bandwidth="2250000000" latency="5E-4"/>
1623 <zoneroute src="cl_4_1"
1624         dst="cl_4_2"
1625         gw_src="c_4_1-cl_4_1_router"
1626         gw_dst="c_4_2-cl_4_2_router">
1627                 <link_ctn id="4_1"/>
1628                 <link_ctn id="bb_4"/>
1629                 <link_ctn id="4_2"/>
1630 </zoneroute>
1631 <zoneroute src="cl_4_1"
1632         dst="exitzone_4"
1633         gw_src="c_4_1-cl_4_1_router"
1634         gw_dst="router_4">
1635                 <link_ctn id="4_1"/>
1636                 <link_ctn id="bb_4"/>
1637 </zoneroute>
1638 <zoneroute src="cl_4_2"
1639         dst="exitzone_4"
1640         gw_src="c_4_2-cl_4_2_router"
1641         gw_dst="router_4">
1642                 <link_ctn id="4_2"/>
1643                 <link_ctn id="bb_4"/>
1644 </zoneroute>
1645 </zone>
1646 @endverbatim
1647
1648 In the zone_4, you have an exitzone_4 defined, containing only one router,
1649 and routes defined to that zone from all other zone (as cluster is only a
1650 shortcut for an zone, see cluster description for details). If there was
1651 an upper zone, it would define routes to and from zone_4 with the gateway
1652 router_4. It's just because, as we did not allowed (for performances
1653 issues) to have routes from an zone to a single host/router, you have to
1654 enclose your gateway, when you have zone included in your zone, within an
1655 zone to define routes to it.
1656
1657 @subsection pf_P2P_tags P2P or how to use coordinates
1658 SimGrid allows you to use some coordinated-based system, like vivaldi,
1659 to describe a platform. The main concept is that you have some peers
1660 that are located somewhere: this is the function of the
1661 <b>coordinates</b> of the @<peer@> or @<host@> tag. There's nothing
1662 complicated in using it, here is an example:
1663
1664 @verbatim
1665 <?xml version='1.0'?>
1666 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
1667 <platform version="4">
1668
1669  <zone  id="zone0"  routing="Vivaldi">
1670         <host id="100030591" coordinates="25.5 9.4 1.4" speed="1.5Gf" />
1671         <host id="100036570" coordinates="-12.7 -9.9 2.1" speed="7.3Gf" />
1672         ...
1673         <host id="100429957" coordinates="17.5 6.7 18.8" speed="8.3Gf" />
1674  </zone>
1675 </platform>
1676 @endverbatim
1677
1678 Coordinates are then used to calculate latency (in microseconds)
1679 between two hosts by calculating the distance between the two hosts
1680 coordinates with the following formula: distance( (x1, y1, z1), (x2,
1681 y2, z2) ) = euclidian( (x1,y1), (x2,y2) ) + abs(z1) + abs(z2)
1682
1683 In other words, we take the euclidian distance on the two first
1684 dimensions, and then add the absolute values found on the third
1685 dimension. This may seem strange, but it was found to allow better
1686 approximations of the latency matrices (see the paper describing
1687 Vivaldi).
1688
1689 Note that the previous example defines a routing directly between hosts but it could be also used to define a routing between zone.
1690 That is for example what is commonly done when using peers (see Section @ref pf_peer).
1691 @verbatim
1692 <?xml version='1.0'?>
1693 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
1694 <platform version="4">
1695
1696  <zone  id="zone0"  routing="Vivaldi">
1697    <peer id="peer-0" coordinates="173.0 96.8 0.1" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us"/>
1698    <peer id="peer-1" coordinates="247.0 57.3 0.6" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us" />
1699    <peer id="peer-2" coordinates="243.4 58.8 1.4" speed="730Mf" bw_in="13.38MBps" bw_out="1.024MBps" lat="500us" />
1700 </zone>
1701 </platform>
1702 @endverbatim
1703 In such a case though, we connect the zone created by the <b>peer</b> tag with the Vivaldi routing mechanism.
1704 This means that to route between zone1 and zone2, it will use the coordinates of router_zone1 and router_zone2.
1705 This is currently a convention and we may offer to change this convention in the DTD later if needed.
1706 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.
1707
1708
1709 @subsection pf_routing_howto_choose_wisely Choosing wisely the routing model to use
1710
1711
1712 Choosing wisely the routing model to use can significantly fasten your
1713 simulation/save your time when writing the platform/save tremendous
1714 disk space. Here is the list of available model and their
1715 characteristics (lookup: time to resolve a route):
1716
1717 @li <b>Full</b>: Full routing data (fast, large memory requirements,
1718     fully expressive)
1719 @li <b>Floyd</b>: Floyd routing data (slow initialization, fast
1720     lookup, lesser memory requirements, shortest path routing only).
1721     Calculates all routes at once at the beginning.
1722 @li <b>Dijkstra</b>: Dijkstra routing data (fast initialization, slow
1723     lookup, small memory requirements, shortest path routing only).
1724     Calculates a route when necessary.
1725 @li <b>DijkstraCache</b>: Dijkstra routing data (fast initialization,
1726     fast lookup, small memory requirements, shortest path routing
1727     only). Same as Dijkstra, except it handles a cache for latest used
1728     routes.
1729 @li <b>None</b>: No routing (usable with Constant network only).
1730     Defines that there is no routes, so if you try to determine a
1731     route without constant network within this zone, SimGrid will raise
1732     an exception.
1733 @li <b>Vivaldi</b>: Vivaldi routing, so when you want to use coordinates
1734 @li <b>Cluster</b>: Cluster routing, specific to cluster tag, should
1735     not be used.
1736
1737 @subsection pf_loopback I want to specify the characteristics of the loopback link!
1738
1739 Each routing model automatically adds a loopback link for each declared host, i.e.,
1740 a network route from the host to itself, if no such route is declared in the XML
1741 file. This default link has a bandwidth of 498 Mb/s, a latency of 15 microseconds, 
1742 and is <b>not</b> shared among network flows. 
1743
1744 If you want to specify the characteristics of the loopback link for a given host, you
1745 just have to specify a route from this host to itself with the desired characteristics 
1746 in the XML file. This will prevent the routing model to add and use the default 
1747 loopback link.
1748
1749 @subsection pf_switch I want to describe a switch but there is no switch tag!
1750
1751 Actually we did not include switch tag. But when you're trying to
1752 simulate a switch, assuming 
1753 fluid bandwidth models are used (which SimGrid uses by default unless 
1754 ns-3 or constant network models are activated), the limiting factor is
1755 switch backplane bandwidth. So, essentially, at least from
1756 the simulation perspective, a switch is similar to a
1757 link: some device that is traversed by flows and with some latency and
1758 so,e maximum bandwidth. Thus, you can simply simulate a switch as a
1759 link. Many links
1760 can be connected to this "switch", which is then included in routes just
1761 as a normal link.
1762
1763
1764 @subsection pf_multicabinets I want to describe multi-cabinets clusters!
1765
1766 You have several possibilities, as usual when modeling things. If your
1767 cabinets are homogeneous and the intercabinet network negligible for
1768 your study, you should just create a larger cluster with all hosts at
1769 the same layer. 
1770
1771 In the rare case where your hosts are not homogeneous between the
1772 cabinets, you can create your cluster completely manually. For that,
1773 create an As using the Cluster routing, and then use one
1774 &lt;cabinet&gt; for each cabinet. This cabinet tag can only be used an
1775 As using the Cluster routing schema, and creating 
1776
1777 Be warned that creating a cluster manually from the XML with
1778 &lt;cabinet&gt;, &lt;backbone&gt; and friends is rather tedious. The
1779 easiest way to retrieve some control of your model without diving into
1780 the &lt;cluster&gt; internals is certainly to create one separate
1781 &lt;cluster&gt; per cabinet and interconnect them together. This is
1782 what we did in the G5K example platform for the Graphen cluster.
1783
1784 @subsection pf_platform_multipath I want to express multipath routing in platform files!
1785
1786 It is unfortunately impossible to express the fact that there is more
1787 than one routing path between two given hosts. Let's consider the
1788 following platform file:
1789
1790 @verbatim
1791 <route src="A" dst="B">
1792    <link_ctn id="1"/>
1793 </route>
1794 <route src="B" dst="C">
1795   <link_ctn id="2"/>
1796 </route>
1797 <route src="A" dst="C">
1798   <link_ctn id="3"/>
1799 </route>
1800 @endverbatim
1801
1802 Although it is perfectly valid, it does not mean that data traveling
1803 from A to C can either go directly (using link 3) or through B (using
1804 links 1 and 2). It simply means that the routing on the graph is not
1805 trivial, and that data do not following the shortest path in number of
1806 hops on this graph. Another way to say it is that there is no implicit
1807 in these routing descriptions. The system will only use the routes you
1808 declare (such as &lt;route src="A" dst="C"&gt;&lt;link_ctn
1809 id="3"/&gt;&lt;/route&gt;), without trying to build new routes by aggregating
1810 the provided ones.
1811
1812 You are also free to declare platform where the routing is not
1813 symmetrical. For example, add the following to the previous file:
1814
1815 @verbatim
1816 <route src="C" dst="A">
1817   <link_ctn id="2"/>
1818   <link_ctn id="1"/>
1819 </route>
1820 @endverbatim
1821
1822 This makes sure that data from C to A go through B where data from A
1823 to C go directly. Don't worry about realism of such settings since
1824 we've seen ways more weird situation in real settings (in fact, that's
1825 the realism of very regular platforms which is questionable, but
1826 that's another story).
1827
1828 */