Logo AND Algorithmique Numérique Distribuée

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