Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve the routing documentation
[simgrid.git] / src / kernel / routing / VivaldiZone.hpp
1 /* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SURF_ROUTING_VIVALDI_HPP_
7 #define SURF_ROUTING_VIVALDI_HPP_
8
9 #include "src/kernel/routing/ClusterZone.hpp"
10
11 namespace simgrid {
12 namespace kernel {
13 namespace routing {
14
15 /** @ingroup ROUTING_API
16  *  @brief NetZone modeling peers connected to the cloud through a private link
17  *
18  *  This netzone model is particularly well adapted to Peer-to-Peer and Clouds platforms:
19  *  each component is connected to the cloud through a private link of which the upload
20  *  and download rate may be asymmetric.
21  *
22  *  The network core (between the private links) is assumed to be over-sized so only the
23  *  latency is taken into account. Instead of a matrix of latencies that would become too
24  *  large when the amount of peers grows, Vivaldi netzones give a coordinate to each peer
25  *  and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) as follows:
26  *
27  *   latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB
28  *
29  *  The resulting value is assumed to be in milliseconds.
30  *
31  *  So, to go from an host A to an host B, the following links would be used:
32  *  <tt>private(A)_UP, private(B)_DOWN</tt>, with the additional latency computed above.
33  *
34  *  Such Network Coordinate systems were shown to provide rather good latency estimations
35  *  in a compact way. Other systems, such as
36  *  <a href="https://en.wikipedia.org/wiki/Phoenix_network_coordinates"Phoenix network coordinates</a>
37  *  were shown superior to the Vivaldi system and could be also implemented in SimGrid.
38  *
39  *
40  *  @todo: the third dimension of the coordinates could be dropped and integrated in the peer private links.
41  *
42  *  @todo: we should provide a script to compute the coordinates from a matrix of latency measurements,
43  *  according to the corresponding publications.
44  */
45
46 class XBT_PRIVATE VivaldiZone : public ClusterZone {
47 public:
48   explicit VivaldiZone(NetZone* father, const char* name);
49
50   void setPeerLink(NetCard* netcard, double bw_in, double bw_out, double lat, const char* coord);
51   void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
52 };
53
54 namespace vivaldi {
55 class XBT_PRIVATE Coords {
56 public:
57   static simgrid::xbt::Extension<NetCard, Coords> EXTENSION_ID;
58   explicit Coords(NetCard* host, const char* str);
59   virtual ~Coords();
60
61   std::vector<double> coords;
62 };
63 }
64 }
65 }
66 } // namespace
67
68 #endif /* SURF_ROUTING_VIVALDI_HPP_ */