From 13bf12b18f191192a6ba4f0ef5452b88986aa88f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 1 Jan 2017 18:01:21 +0100 Subject: [PATCH] ignore the lat parameter of peer tag - It was redundent with the z coordinate of the peer. - This changes the timings of the examples using the Vivaldi routing - Also update and improve the documentation. - doxygen don't quite like links to sections which names contain a html-like tag (as ) and produce weird error messages in this case. Not much I can do here... --- doc/doxygen/platform.doc | 17 +++++++++++++---- examples/java/app/tokenring/app_tokenring.tesh | 10 +++++----- examples/msg/app-token-ring/app-token-ring.tesh | 8 ++++---- examples/platforms/two_peers.xml | 4 ++-- src/kernel/routing/VivaldiZone.cpp | 6 +++--- src/kernel/routing/VivaldiZone.hpp | 7 ++++--- src/surf/sg_platf.cpp | 2 +- src/surf/xml/platf_private.hpp | 1 - src/surf/xml/surfxml_sax_cb.cpp | 5 ++++- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/doc/doxygen/platform.doc b/doc/doxygen/platform.doc index ba3bb76b08..14b94aab9a 100644 --- a/doc/doxygen/platform.doc +++ b/doc/doxygen/platform.doc @@ -129,7 +129,7 @@ between the hosts goes through link1. \subsection pf_Cr Computing resources: hosts, clusters and peers. -\subsubsection pf_host <host/> +\subsubsection pf_host <host> A host represents a computer/node card. Every host is able to execute code and it can send and receive data to/from other hosts. Most importantly, @@ -402,10 +402,10 @@ The hosts generated in the above example are named host-1.cluster, host-2.cluste etc. -\subsubsection pf_peer The <peer> tag +\subsubsection pf_peer \ (Vivaldi netzones only) This tag represents a peer, as in Peer-to-Peer (P2P) networks. This -can only be used in Vivaldi NetZones. It creates the following +can only be used in Vivaldi NetZones. It creates the following resources to the NetZone: \li A host @@ -421,12 +421,21 @@ id | yes | string | The identifier of the peer. Facilitates r speed | yes | int | See the description of the ``host`` tag for this attribute bw_in | yes | int | Bandwidth of the private downstream link bw_out | yes | int | Bandwidth of the private upstream link -lat | yes | double | Latency for both up- and downstream, in seconds. coordinates | no | string | Coordinates of the gateway for this peer. Example value: 12.8 14.4 6.4 sharing_policy | no | SHARED\|FULLDUPLEX (default: FULLDUPLEX) | Sharing policy for links. See link description for details. availability_file| no | string | Availability file for the peer. Same as host availability file. See host description for details. state_file | no | string | State file for the peer. Same as host state file. See host description for details. + +The communication latency between an host A=(xA,yA,zA) and an host +B=(xB,yB,zB) is computed as follows: + + latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB + +See the documentation of simgrid::kernel::routing::VivaldiZone for +details on how the latency is computed from the coordinate, and on the +the up and down bandwidth are used. + \subsection pf_ne Network equipments: links and routers There are two tags at all times available to represent network entities and diff --git a/examples/java/app/tokenring/app_tokenring.tesh b/examples/java/app/tokenring/app_tokenring.tesh index b18b64c74e..73a084d3c6 100644 --- a/examples/java/app/tokenring/app_tokenring.tesh +++ b/examples/java/app/tokenring/app_tokenring.tesh @@ -22,11 +22,11 @@ $ java -classpath ${classpath:=.} app/tokenring/Main ${srcdir:=.}/../platforms/t > [ 0.000000] (0:maestro@) Using regular java threads. > [ 0.000000] (0:maestro@) Number of hosts '2' > [ 0.000000] (1:0@100030591) Host '0' send 'Token' to Host '1' -> [ 0.637910] (2:1@100036570) Host '1' received 'Token' -> [ 0.637910] (2:1@100036570) Host '1' send 'Token' to Host '0' -> [ 1.275820] (1:0@100030591) Host '0' received 'Token' -> [ 1.275820] (0:maestro@) MSG_main finished; Cleaning up the simulation... -> [ 1.275820] (0:maestro@) Simulation time 1.2758201322136908 +> [ 0.624423] (2:1@100036570) Host '1' received 'Token' +> [ 0.624423] (2:1@100036570) Host '1' send 'Token' to Host '0' +> [ 1.248846] (1:0@100030591) Host '0' received 'Token' +> [ 1.248846] (0:maestro@) MSG_main finished; Cleaning up the simulation... +> [ 1.248846] (0:maestro@) Simulation time 1.2488464578972847 $ java -classpath ${classpath:=.} app/tokenring/Main ${srcdir:=.}/../platforms/meta_cluster.xml '--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n' > [ 0.000000] (0:maestro@) Using regular java threads. diff --git a/examples/msg/app-token-ring/app-token-ring.tesh b/examples/msg/app-token-ring/app-token-ring.tesh index 936a327583..8f52f93f5a 100644 --- a/examples/msg/app-token-ring/app-token-ring.tesh +++ b/examples/msg/app-token-ring/app-token-ring.tesh @@ -19,10 +19,10 @@ $ $SG_TEST_EXENV ${bindir:=.}/app-token-ring ${srcdir:=.}/routing_cluster.xml "- $ $SG_TEST_EXENV ${bindir:=.}/app-token-ring ${srcdir:=.}/two_peers.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (0:maestro@) Number of hosts '2' > [ 0.000000] (1:0@100030591) Host "0" send 'Token' to Host "1" -> [ 0.637910] (2:1@100036570) Host "1" received "Token" -> [ 0.637910] (2:1@100036570) Host "1" send 'Token' to Host "0" -> [ 1.275820] (1:0@100030591) Host "0" received "Token" -> [ 1.275820] (0:maestro@) Simulation time 1.27582 +> [ 0.624423] (2:1@100036570) Host "1" received "Token" +> [ 0.624423] (2:1@100036570) Host "1" send 'Token' to Host "0" +> [ 1.248846] (1:0@100030591) Host "0" received "Token" +> [ 1.248846] (0:maestro@) Simulation time 1.24885 $ $SG_TEST_EXENV ${bindir:=.}/app-token-ring ${srcdir:=.}/meta_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (0:maestro@) Number of hosts '60' diff --git a/examples/platforms/two_peers.xml b/examples/platforms/two_peers.xml index 00d976883c..92ac5d5937 100644 --- a/examples/platforms/two_peers.xml +++ b/examples/platforms/two_peers.xml @@ -2,7 +2,7 @@ - - + + diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index e88cc0fa4d..25b6e65606 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -58,7 +58,7 @@ VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father { } -void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, double latency, const char* coord) +void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, const char* coord) { xbt_assert(netcard->netzone() == this, "Cannot add a peer link to a netcard that is not in this AS"); @@ -66,8 +66,8 @@ void VivaldiZone::setPeerLink(NetCard* netcard, double bw_in, double bw_out, dou std::string link_up = "link_" + netcard->name() + "_UP"; std::string link_down = "link_" + netcard->name() + "_DOWN"; - Link* linkUp = surf_network_model->createLink(link_up.c_str(), bw_out, latency, SURF_LINK_SHARED); - Link* linkDown = surf_network_model->createLink(link_down.c_str(), bw_in, latency, SURF_LINK_SHARED); + Link* linkUp = surf_network_model->createLink(link_up.c_str(), bw_out, 0, SURF_LINK_SHARED); + Link* linkDown = surf_network_model->createLink(link_down.c_str(), bw_in, 0, SURF_LINK_SHARED); privateLinks_.insert({netcard->id(), {linkUp, linkDown}}); } diff --git a/src/kernel/routing/VivaldiZone.hpp b/src/kernel/routing/VivaldiZone.hpp index 2c84ac7452..28d53aadc6 100644 --- a/src/kernel/routing/VivaldiZone.hpp +++ b/src/kernel/routing/VivaldiZone.hpp @@ -30,6 +30,9 @@ namespace routing { * * So, to go from an host A to an host B, the following links would be used: * private(A)_UP, private(B)_DOWN, with the additional latency computed above. + * The bandwidth of the UP and DOWN links is not symmetric (in contrary to usual SimGrid + * links), but naturally correspond to the values provided when the peer was created. + * More information in the relevant section of the XML reference guide: @ref pf_peer. * * Such Network Coordinate systems were shown to provide rather good latency estimations * in a compact way. Other systems, such as @@ -37,8 +40,6 @@ namespace routing { * were shown superior to the Vivaldi system and could be also implemented in SimGrid. * * - * @todo: the third dimension of the coordinates could be dropped and integrated in the peer private links. - * * @todo: we should provide a script to compute the coordinates from a matrix of latency measurements, * according to the corresponding publications. */ @@ -47,7 +48,7 @@ class XBT_PRIVATE VivaldiZone : public ClusterZone { public: explicit VivaldiZone(NetZone* father, const char* name); - void setPeerLink(NetCard* netcard, double bw_in, double bw_out, double lat, const char* coord); + void setPeerLink(NetCard* netcard, double bw_in, double bw_out, const char* coord); void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override; }; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 577dab355c..2cc3b1744f 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -563,7 +563,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) speedPerPstate.push_back(peer->speed); simgrid::s4u::Host* host = as->createHost(peer->id, &speedPerPstate, 1); - as->setPeerLink(host->pimpl_netcard, peer->bw_in, peer->bw_out, peer->lat, peer->coord); + as->setPeerLink(host->pimpl_netcard, peer->bw_in, peer->bw_out, peer->coord); simgrid::s4u::Host::onCreation(*host); /* Change from the defaults */ diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 790876a9d6..e604e465dd 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -78,7 +78,6 @@ typedef struct s_sg_platf_peer_cbarg { double speed; double bw_in; double bw_out; - double lat; const char* coord; tmgr_trace_t speed_trace; tmgr_trace_t state_trace; diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 8292cf740d..d9a4c52e94 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -639,11 +639,14 @@ void STag_surfxml_peer(){ peer.speed = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id); peer.bw_in = surf_parse_get_bandwidth(A_surfxml_peer_bw___in, "bw_in of peer", peer.id); peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id); - peer.lat = surf_parse_get_time(A_surfxml_peer_lat, "lat of peer", peer.id); peer.coord = A_surfxml_peer_coordinates; peer.speed_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : nullptr; peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : nullptr; + if (A_surfxml_peer_lat[0] != '\0') + XBT_WARN("The latency parameter in is now deprecated. Use the z coordinate instead of '%s'.", + A_surfxml_peer_lat); + sg_platf_new_peer(&peer); } -- 2.20.1