Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer a reference for first parameter of {test,wait}_{all,any}.
[simgrid.git] / docs / source / Platform_routing.rst
1 .. raw:: html
2
3    <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
4    <script>
5    window.onload=function() { // Wait for the SVG to be loaded before changing it
6      var elem=document.querySelector("#TOC").contentDocument.getElementById("RoutingBox")
7      elem.style="opacity:0.93999999;fill:#ff0000;fill-opacity:0.1;stroke:#000000;stroke-width:0.35277778;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1";
8    }
9    </script>
10    <br/>
11    <br/>
12
13 .. _platform_routing:
14
15 Demystifying the routing
16 ########################
17
18 When describing a platform, routing is certainly the most complex
19 and error-prone part. This section explains the basics of SimGrid's
20 routing mechanism which allows you to easily compose and scale your
21 platform.
22
23 |flat_img| |tree_img|
24
25 .. |flat_img| image:: img/zone_hierarchy.png
26    :width: 45%
27
28 .. |tree_img| image:: img/zone_tree.svg
29    :width: 45%
30 Circles represent processing units and squares represent network
31 routers. Bold lines represent communication links. The zone "AS2" models the core of a national network interconnecting a
32 small flat cluster (AS4) and a larger hierarchical cluster (AS5), a
33 subset of a LAN (AS6), and a set of peers scattered around the world
34 (AS7).
35
36 Networking zones (:ref:`pf_tag_zone`) are an advanced concept used to factorize the description
37 to reduce the size of your platform on disk and in memory.
38 Any zone may contain sub-zones, allowing for a hierarchical
39 decomposition of the platform (as you can see in the tree representation on the left).
40 Routing can be made more efficient (as the
41 inter-zone routing gets factored with :ref:`pf_tag_zoneroute`) and
42 allows you to have more than one routing model in your platform. For
43 example, you can have a coordinate-based routing for the WAN parts
44 of your platforms, a full routing within each datacenter, and a highly
45 optimized routing within each cluster of the datacenter.  In this
46 case, determining the route between two given hosts gets 
47 "somewhat more complex" but SimGrid still computes
48 these routes for you in a time- and space-efficient manner.
49
50
51 Routing basic elements: hosts and links
52 ***************************************
53
54 A platform is composed of a set of resources, namely hosts, links and disks.
55 On these resources you may run activities that will require some capacity and
56 will make the time advance.
57
58 Given a look at this example of some hosts and links being declared
59
60 .. code-block:: xml
61
62   <zone id="AS5-4" routing="Full">
63     <host id="host0" speed="1Gf"/>
64     <host id="host1" speed="2Gf"/>
65     <link id="link0" bandwidth="125MBps" latency="100us"/>
66   </zone>
67
68 It describes a simple FullZone with 2 hosts inside connected through
69 a link. Note that the ``link0`` just represents a resource with a
70 certain bandwidth capacity and latency. It's only when you add
71 a route between ``host0`` and ``host1`` that this link will be used by
72 SimGrid in the communications.
73
74 .. code-block:: xml
75
76   <zone id="AS5-4" routing="Full">
77     ...
78     <route src="host0" dst="host1"><link_ctn id="link0"/></route>
79   </zone>
80
81 Note that no verification is performed concerning the links you use in a route.
82 This is quite flexible and enables interesting features. However, it also allows you
83 to do some strange topologies, such as having a single link used by a pair
84 of hosts from different zone:
85
86 .. code-block:: xml
87
88   <zone id="Nonsense" routing="Full">
89     <host id="host3" speed="1Gf"/>
90     <host id="host4" speed="2Gf"/>
91     <route src="host3" dst="host4"><link_ctn id="link0"/></route>
92   </zone>
93
94 Probably you do not want to do this, but it's your responsibility to write
95 your platform file properly. SimGrid will not try to be smarter than you!
96
97 Describing routes: intra vs inter
98 *********************************
99
100 Intra zone
101 ==========
102
103 TLDR: use :ref:`pf_tag_route`
104
105 The communications inside a given zone is defined by ``routing=`` parameter
106 in the :ref:`pf_tag_zone`. For example, in a *Full* zone, the user must declare
107 a :ref:`pf_tag_route` for each pair of hosts inside the zone. Other zones, such as *Floyd*
108 or *Dijkstra* will calculate the shortest path, while *DragonFly* and *Fat-Tree* uses
109 specialized routing algorithms to improve performance.
110
111 When adding a route inside a zone, keep in mind that you need 3 main parameters:
112   - src: Host (or router) source
113   - dst: Host (or router) destination
114   - links: list of resources (links in this case) used in the communication
115
116 Inter zone
117 ==========
118
119 TLDR: use :ref:`pf_tag_zoneroute`
120
121 When describing complex topologies, such as the one depicted in the beginning
122 of this page, you will need to connected not only hosts but zones too. The rationale
123 behind a route between zone is exactly the same as for hosts. The only difference is
124 the 2 new gateway parameters in the syntax of :ref:`pf_tag_zoneroute`.
125
126 A zone is not a physical resource, just a collection of resources. Consequently, you
127 need to describe the gateway, i.e. the physical resource inside the zone used for the route.
128 It gives you 4 parameters to describe a zoneRoute:
129   - src: The object of source zone
130   - dst: The object of destination zone
131   - gw_src: Gateway inside src zone. A Host (or router) belonging to src zone.
132   - gw_dst: Gateway inside dst zone. A Host (or router) belonging to src zone.
133   - links: Links that connect gw_src to gw_dst.
134
135 .. note:: You must be careful to call zoneRoute with the correct parameters: zones for src and dst, and hosts/routers for gw_src and gw_dst
136
137 .. warning:: SimGrid does not have the concept of default gateway/router. Each zoneRoute must describe the appropriate gateways which may be different for each route.
138
139 Calculating the routes
140 **********************
141
142 This section is not mandatory for a normal SimGrid user. However, if you want
143 to know a little more of we calculate the route
144 between nodes inside SimGrid, keep reading it.
145
146
147 Intra-zone communications
148 =========================
149
150 This is the easy, happy case. When
151 a host wants to communicate with another host belonging to the same
152 zone, it is the zone's duty to find the list of links that are
153 involved in the communication.
154
155 As we stated earlier, each zone implements a different strategy, defined
156 through the ``routing=`` parameter.
157   - **Full**: all routes must be explicitly given using the
158     :ref:`pf_tag_route` and :ref:`pf_tag_link_ctn` tags (this :ref:`routing
159     model <pf_rm>` is both simple and inefficient :). It is OK to not
160     specify each and every route between hosts, as long as you do not try
161     to start a communication on any of the missing routes during your
162     simulation.
163   - **Dijkstra/Floyd**: calculates the shortest path between each pair
164     of nodes using the routes described by the user (:ref:`pf_tag_route`).
165     As long as you graph is connected, no problems.
166   - **Cluster/Fat-Tree/DragonFly/Torus**: routing is defined by the topology, automatically created.
167   - **Star**: star-like topology. Users describe routes from/to every host in the zone.
168   - **Vivaldi/Wi-Fi**: "fully-connected" zones with special characteristics.
169
170
171     
172 Inter-zone communications
173 =========================
174
175 .. image:: ./img/zoom_comm.svg
176    :scale: 70%
177
178 Inter-zone communications are a little more complicated since you need to pass
179 through several zones. Let's give a look with more details in a communication
180 within our initial topology.
181
182 In this case, *Host1* within *AS2* wants to communicate with *Host2* from *AS5-4*.
183 As we can see, they're not part of the same zone nor have direct links connecting
184 them. The routing procedure is as follows:
185
186 1. **Find common root and ancestors**: As a SimGrid's platform is a tree of zones,
187    it is assured that we have a common zone that includes both hosts. Also, we need
188    the zone within the root zone that contains the hosts. In our case, we have:
189
190    - **Common root**: *AS1*, it is the root zone that contains all hosts in our example
191
192    - **Src ancestor**: *AS2*, it is the own *Host1's* zone.
193
194    - **Dst ancestor**: *AS5*, it's the *AS5* that contains *AS5-4*.
195
196 2. **Adding route from src to dst ancestor**: Ask *AS1* for the route between *AS2* and *AS5*.
197    Add *Link1* to our list of links
198
199 3. **Recursively search for route between hosts (Host1/Host2) and ancestors (AS2, AS5)**
200
201    3.1. **Route from Host1 to AS2's gateway (Host1)**: nothing to do, same zone.
202
203    3.2. **Route from Host2 to AS5's gateway (gw1)**: start step 1 again, searching
204    for a common root (*AS5* in this case) and the common ancestors (*AS5-4* and *AS5-3*).
205    Add *Link3* to list of links.
206
207 4. **Add local links in src and dst zones**
208
209    4.1. **Route from Host1 to AS2's gateway**: same node, no link to add.
210
211    4.2. **Route from Host2 to AS5-4's gateway**: follow intra-zone and add *Link2*.
212
213
214 In the end, our communication from *Host1/AS2* to *Host2/AS5-4* will pass through
215 the links: *Link1, Link3* and *Link2*.
216
217 Note that a communication between *Host3/AS2* and *Host2/AS5-4* follow the same procedure, except
218 for step 4.1 where we would add the link between *Host3* and *Host1* inside *AS2* zone.
219
220