Logo AND Algorithmique Numérique Distribuée

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