Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a host and not an host
[simgrid.git] / include / simgrid / kernel / routing / VivaldiZone.hpp
1 /* Copyright (c) 2013-2018. 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 <simgrid/kernel/routing/ClusterZone.hpp>
10 #include <xbt/Extendable.hpp>
11
12 namespace simgrid {
13 namespace kernel {
14 namespace routing {
15
16 /** @ingroup ROUTING_API
17  *  @brief NetZone modeling peers connected to the cloud through a private link
18  *
19  *  This netzone model is particularly well adapted to Peer-to-Peer and Clouds platforms:
20  *  each component is connected to the cloud through a private link of which the upload
21  *  and download rate may be asymmetric.
22  *
23  *  The network core (between the private links) is assumed to be over-sized so only the
24  *  latency is taken into account. Instead of a matrix of latencies that would become too
25  *  large when the amount of peers grows, Vivaldi netzones give a coordinate to each peer
26  *  and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) as follows:
27  *
28  *   latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB
29  *
30  *  The resulting value is assumed to be in milliseconds.
31  *
32  *  So, to go from a host A to a host B, the following links would be used:
33  *  <tt>private(A)_UP, private(B)_DOWN</tt>, with the additional latency computed above.
34  *  The bandwidth of the UP and DOWN links is not symmetric (in contrary to usual SimGrid
35  *  links), but naturally correspond to the values provided when the peer was created.
36  *  More information in the relevant section of the XML reference guide: @ref pf_peer.
37  *
38  *  You can find some Coordinate-based platforms from the OptorSim project, as well as a
39  *  script to turn them into SimGrid platforms in examples/platforms/syscoord.
40  *
41  *  Such Network Coordinate systems were shown to provide rather good latency estimations
42  *  in a compact way. Other systems, such as
43  *  <a href="https://en.wikipedia.org/wiki/Phoenix_network_coordinates"Phoenix network coordinates</a>
44  *  were shown superior to the Vivaldi system and could be also implemented in SimGrid.
45  */
46
47 class XBT_PRIVATE VivaldiZone : public ClusterZone {
48 public:
49   explicit VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
50
51   void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
52   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
53
54   // deprecated
55   XBT_ATTRIB_DEPRECATED_v323("Please use VivaldiZone::set_peer_link()") void setPeerLink(NetPoint* netpoint,
56                                                                                          double bw_in, double bw_out,
57                                                                                          std::string coord)
58   {
59     set_peer_link(netpoint, bw_in, bw_out, coord);
60   }
61 };
62
63 namespace vivaldi {
64 class XBT_PRIVATE Coords {
65 public:
66   static simgrid::xbt::Extension<NetPoint, Coords> EXTENSION_ID;
67   explicit Coords(NetPoint* host, std::string str);
68   virtual ~Coords() = default;
69
70   std::vector<double> coords;
71 };
72 } // namespace vivaldi
73 } // namespace routing
74 } // namespace kernel
75 } // namespace simgrid
76
77 #endif /* SURF_ROUTING_VIVALDI_HPP_ */