Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get flatifier rid of SimDag
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Feb 2021 18:25:29 +0000 (19:25 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Feb 2021 18:25:29 +0000 (19:25 +0100)
teshsuite/simdag/flatifier/bogus_missing_gateway.tesh
teshsuite/simdag/flatifier/bogus_two_hosts_asymetric.tesh
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/flatifier/flatifier.tesh

index cc2b34b..340bd96 100644 (file)
@@ -1,13 +1,11 @@
 ! expect signal SIGABRT
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_missing_src_gateway.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] Parse error at ../platforms/bogus_missing_src_gateway.xml:14: zoneRoute gw_src='nod-cluster_router.cluster.us' does name a node. Existing netpoints: 
 > 'node-1.cluster.us','node-2.cluster.us','node-3.cluster.us','node-4.cluster.us','node-cluster_router.cluster.us','noeud-1.grappe.fr','noeud-2.grappe.fr','noeud-3.grappe.fr','noeud-4.grappe.fr','noeud-grappe_router.grappe.fr'
 > [  0.000000] [0:maestro@] Exiting now.
 
 ! expect signal SIGABRT
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_missing_dst_gateway.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] Parse error at ../platforms/bogus_missing_dst_gateway.xml:14: zoneRoute gw_dst='neud-grappe_router.grappe.fr' does name a node. Existing netpoints: 
 > 'node-1.cluster.us','node-2.cluster.us','node-3.cluster.us','node-4.cluster.us','node-cluster_router.cluster.us','noeud-1.grappe.fr','noeud-2.grappe.fr','noeud-3.grappe.fr','noeud-4.grappe.fr','noeud-grappe_router.grappe.fr'
 > [  0.000000] [0:maestro@] Exiting now.
index f18b7e3..a34a29c 100644 (file)
@@ -1,4 +1,3 @@
 ! expect signal SIGABRT
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_two_hosts_asymetric.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n" --log=no_loc
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] The route between alice and bob already exists (Rq: routes are symmetrical by default).
index 9f230da..d9496b9 100644 (file)
@@ -8,7 +8,6 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "simgrid/simdag.h"
 #include "src/surf/network_interface.hpp"
 
 #include <algorithm>
@@ -16,6 +15,8 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(flatifier, "Logging specific to this platform parsing tool");
 
+namespace sg4 = simgrid::s4u;
+
 static bool parse_cmdline(int* timings, char** platformFile, int argc, char** argv)
 {
   bool parse_ok = true;
@@ -34,25 +35,24 @@ static bool parse_cmdline(int* timings, char** platformFile, int argc, char** ar
   return parse_ok;
 }
 
-static void create_environment(xbt_os_timer_t parse_time, const char *platformFile)
+static void create_environment(xbt_os_timer_t parse_time, const std::string platformFile)
 {
   xbt_os_cputimer_start(parse_time);
-  SD_create_environment(platformFile);
+  sg4::Engine::get_instance()->load_platform(platformFile);
   xbt_os_cputimer_stop(parse_time);
 }
 
 static void dump_hosts()
 {
-  size_t totalHosts = sg_host_count();
-  sg_host_t* hosts  = sg_host_list();
-  std::sort(hosts, hosts + totalHosts,
-            [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
-
-  for (size_t i = 0; i < totalHosts; i++) {
-    std::printf("  <host id=\"%s\" speed=\"%.0f\"", hosts[i]->get_cname(), sg_host_get_speed(hosts[i]));
-    const std::unordered_map<std::string, std::string>* props = hosts[i]->get_properties();
-    if (hosts[i]->get_core_count() > 1) {
-      std::printf(" core=\"%d\"", hosts[i]->get_core_count());
+  std::vector<sg4::Host*> hosts  = sg4::Engine::get_instance()->get_all_hosts();
+  std::sort(hosts.begin(), hosts.end(),
+            [](const sg4::Host* a, const sg4::Host* b) { return a->get_name() < b->get_name(); });
+
+  for (auto h : hosts) {
+    std::printf("  <host id=\"%s\" speed=\"%.0f\"", h->get_cname(), h->get_speed());
+    const std::unordered_map<std::string, std::string>* props = h->get_properties();
+    if (h->get_core_count() > 1) {
+      std::printf(" core=\"%d\"", h->get_core_count());
     }
     // Sort the properties before displaying them, so that the tests are perfectly reproducible
     std::vector<std::string> keys;
@@ -68,20 +68,17 @@ static void dump_hosts()
       std::printf("/>\n");
     }
   }
-  xbt_free(hosts);
 }
 
 static void dump_links()
 {
-  size_t totalLinks          = sg_link_count();
-  simgrid::s4u::Link** links = sg_link_list();
+  std::vector<sg4::Link*> links = sg4::Engine::get_instance()->get_all_links();
 
-  std::sort(links, links + totalLinks, [](const simgrid::s4u::Link* a, const simgrid::s4u::Link* b) {
-    return strcmp(sg_link_get_name(a), sg_link_get_name(b)) < 0;
+  std::sort(links.begin(), links.end(), [](const sg4::Link* a, const sg4::Link* b) {
+    return a->get_name() < b->get_name();
   });
 
-  for (size_t i = 0; i < totalLinks; i++) {
-    const simgrid::s4u::Link* link = links[i];
+  for (auto link : links) {
     std::printf("  <link id=\"");
 
     std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->get_cname(), link->get_bandwidth(), link->get_latency());
@@ -91,14 +88,12 @@ static void dump_links()
       std::printf(" sharing_policy=\"FATPIPE\"/>\n");
     }
   }
-
-  xbt_free(links);
 }
 
 static void dump_routers()
 {
   std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
-      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+      sg4::Engine::get_instance()->get_all_netpoints();
   std::sort(netpoints.begin(), netpoints.end(),
             [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
@@ -111,28 +106,25 @@ static void dump_routers()
 
 static void dump_routes()
 {
-  size_t totalHosts = sg_host_count();
-  sg_host_t* hosts  = sg_host_list();
-  std::sort(hosts, hosts + totalHosts,
-            [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
+  std::vector<sg4::Host*> hosts  = sg4::Engine::get_instance()->get_all_hosts();
+  std::sort(hosts.begin(), hosts.end(),
+            [](const sg4::Host* a, const sg4::Host* b) { return a->get_name() < b->get_name(); });
   std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
-      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+      sg4::Engine::get_instance()->get_all_netpoints();
   std::sort(netpoints.begin(), netpoints.end(),
             [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });
 
-  for (size_t it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
-    const simgrid::s4u::Host* host1         = hosts[it_src];
-    simgrid::kernel::routing::NetPoint* src = host1->get_netpoint();
-    for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
-      const simgrid::s4u::Host* host2 = hosts[it_dst];
+  for (auto src_host : hosts) { // Routes from host
+    simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
+    for (auto dst_host : hosts) { // Routes to host
       std::vector<simgrid::kernel::resource::LinkImpl*> route;
-      simgrid::kernel::routing::NetPoint* dst = host2->get_netpoint();
+      simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
       simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
       if (route.empty())
         continue;
-      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->get_cname(), host2->get_cname());
+      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", src_host->get_cname(), dst_host->get_cname());
       for (auto const& link : route)
         std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
       std::printf("\n  </route>\n");
@@ -141,7 +133,7 @@ static void dump_routes()
     for (auto const& dst : netpoints) { // to router
       if (not dst->is_router())
         continue;
-      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->get_cname(), dst->get_cname());
+      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", src_host->get_cname(), dst->get_cname());
       std::vector<simgrid::kernel::resource::LinkImpl*> route;
       simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
       for (auto const& link : route)
@@ -163,18 +155,16 @@ static void dump_routes()
         std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
       std::printf("\n  </route>\n");
     }
-    for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
-      const simgrid::s4u::Host* host2 = hosts[it_dst];
-      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->get_cname(), host2->get_cname());
+    for (auto dst_host : hosts) { // Routes to host
+      std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->get_cname(), dst_host->get_cname());
       std::vector<simgrid::kernel::resource::LinkImpl*> route;
-      simgrid::kernel::routing::NetPoint* netcardDst = host2->get_netpoint();
+      simgrid::kernel::routing::NetPoint* netcardDst = dst_host->get_netpoint();
       simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
       for (auto const& link : route)
         std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
       std::printf("\n  </route>\n");
     }
   }
-  xbt_free(hosts);
 }
 
 static void dump_platform()
@@ -209,7 +199,7 @@ int main(int argc, char** argv)
 
   xbt_os_timer_t parse_time = xbt_os_timer_new();
 
-  SD_init(&argc, argv);
+  sg4::Engine e(&argc, argv);
 
   if (not parse_cmdline(&timings, &platformFile, argc, argv) || not platformFile)
     xbt_die("Invalid command line arguments: expected [--timings] platformFile");
@@ -219,8 +209,8 @@ int main(int argc, char** argv)
   create_environment(parse_time, platformFile);
 
   if (timings) {
-    XBT_INFO("Parsing time: %fs (%zu hosts, %d links)", xbt_os_timer_elapsed(parse_time), sg_host_count(),
-             sg_link_count());
+    XBT_INFO("Parsing time: %fs (%zu hosts, %zu links)", xbt_os_timer_elapsed(parse_time), e.get_host_count(),
+             e.get_link_count());
   } else {
     dump_platform();
   }
index 1b3acda..3f8b607 100644 (file)
@@ -1,6 +1,5 @@
 #!/usr/bin/env tesh
 $ ${bindir:=.}/flatifier ../platforms/one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -135,7 +134,6 @@ $ ${bindir:=.}/flatifier ../platforms/one_cluster.xml "--log=root.fmt:[%10.6r]%e
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/one_cluster_multicore.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -269,7 +267,6 @@ $ ${bindir:=.}/flatifier ../platforms/one_cluster_multicore.xml "--log=root.fmt:
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/host_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -303,7 +300,6 @@ $ ${bindir:=.}/flatifier ../platforms/host_attributes.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/link_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -321,7 +317,6 @@ $ ${bindir:=.}/flatifier ../platforms/link_attributes.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/three_hosts_non_symmetric_route.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -364,7 +359,6 @@ $ ${bindir:=.}/flatifier ../platforms/three_hosts_non_symmetric_route.xml "--log
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -499,7 +493,6 @@ $ ${bindir:=.}/flatifier ../platforms/two_clusters.xml "--log=root.fmt:[%10.6r]%
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -526,7 +519,6 @@ $ ${bindir:=.}/flatifier ../platforms/two_hosts_multi_hop.xml "--log=root.fmt:[%
 > </platform>
 
 $ ${bindir:=.}/flatifier ../platforms/two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -551,7 +543,6 @@ $ ${bindir:=.}/flatifier ../platforms/two_hosts_one_link.xml "--log=root.fmt:[%1
 > </platform>
 
 $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/bypassZoneRoute.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">
@@ -685,7 +676,6 @@ $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/bypassZoneRoute.xml "--
 > </platform>
 
 $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/cluster_torus.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4">