Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this was no simdag
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 21 Feb 2020 14:24:42 +0000 (15:24 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 21 Feb 2020 15:16:49 +0000 (16:16 +0100)
MANIFEST.in
teshsuite/s4u/CMakeLists.txt
teshsuite/s4u/basic-link-test/basic-link-test.cpp [new file with mode: 0644]
teshsuite/s4u/basic-link-test/basic-link-test.tesh [moved from teshsuite/simdag/basic-link-test/basic-link-test.tesh with 82% similarity]
teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time.cpp [moved from teshsuite/simdag/evaluate-get-route-time/evaluate-get-route-time.c with 52% similarity]
teshsuite/s4u/evaluate-parse-time/evaluate-parse-time.cpp [moved from teshsuite/simdag/evaluate-parse-time/evaluate-parse-time.c with 57% similarity]
teshsuite/s4u/is-router/is-router.cpp [moved from teshsuite/simdag/is-router/is-router.cpp with 74% similarity]
teshsuite/s4u/is-router/is-router.tesh [moved from teshsuite/simdag/is-router/is-router.tesh with 84% similarity]
teshsuite/simdag/CMakeLists.txt
teshsuite/simdag/basic-link-test/basic-link-test.c [deleted file]

index 686526c..f7df6c9 100644 (file)
@@ -709,6 +709,8 @@ include teshsuite/s4u/actor-autorestart/actor-autorestart.cpp
 include teshsuite/s4u/actor-autorestart/actor-autorestart.tesh
 include teshsuite/s4u/actor/actor.cpp
 include teshsuite/s4u/actor/actor.tesh
+include teshsuite/s4u/basic-link-test/basic-link-test.cpp
+include teshsuite/s4u/basic-link-test/basic-link-test.tesh
 include teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp
 include teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.tesh
 include teshsuite/s4u/cloud-sharing/cloud-sharing.cpp
@@ -716,8 +718,12 @@ include teshsuite/s4u/cloud-sharing/cloud-sharing.tesh
 include teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp
 include teshsuite/s4u/concurrent_rw/concurrent_rw.cpp
 include teshsuite/s4u/concurrent_rw/concurrent_rw.tesh
+include teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time.cpp
+include teshsuite/s4u/evaluate-parse-time/evaluate-parse-time.cpp
 include teshsuite/s4u/host-on-off/host-on-off.cpp
 include teshsuite/s4u/host-on-off/host-on-off.tesh
+include teshsuite/s4u/is-router/is-router.cpp
+include teshsuite/s4u/is-router/is-router.tesh
 include teshsuite/s4u/listen_async/listen_async.cpp
 include teshsuite/s4u/listen_async/listen_async.tesh
 include teshsuite/s4u/ns3-simultaneous-send-rcv/ns3-simultaneous-send-rcv.cpp
@@ -730,8 +736,6 @@ include teshsuite/s4u/wait-any-for/wait-any-for.cpp
 include teshsuite/s4u/wait-any-for/wait-any-for.tesh
 include teshsuite/simdag/availability/availability.c
 include teshsuite/simdag/availability/availability.tesh
-include teshsuite/simdag/basic-link-test/basic-link-test.c
-include teshsuite/simdag/basic-link-test/basic-link-test.tesh
 include teshsuite/simdag/basic-parsing-test/basic-parsing-test-bypass.tesh
 include teshsuite/simdag/basic-parsing-test/basic-parsing-test-sym-full.tesh
 include teshsuite/simdag/basic-parsing-test/basic-parsing-test.c
@@ -766,8 +770,6 @@ include teshsuite/simdag/comp-only-par/comp-only-par.c
 include teshsuite/simdag/comp-only-par/comp-only-par.tesh
 include teshsuite/simdag/comp-only-seq/comp-only-seq.c
 include teshsuite/simdag/comp-only-seq/comp-only-seq.tesh
-include teshsuite/simdag/evaluate-get-route-time/evaluate-get-route-time.c
-include teshsuite/simdag/evaluate-parse-time/evaluate-parse-time.c
 include teshsuite/simdag/flatifier/bogus_disk_attachment.tesh
 include teshsuite/simdag/flatifier/bogus_missing_gateway.tesh
 include teshsuite/simdag/flatifier/bogus_two_hosts_asymetric.tesh
@@ -775,8 +777,6 @@ include teshsuite/simdag/flatifier/flatifier.cpp
 include teshsuite/simdag/flatifier/flatifier.tesh
 include teshsuite/simdag/incomplete/incomplete.c
 include teshsuite/simdag/incomplete/incomplete.tesh
-include teshsuite/simdag/is-router/is-router.cpp
-include teshsuite/simdag/is-router/is-router.tesh
 include teshsuite/simdag/platforms/Dijkstra.xml
 include teshsuite/simdag/platforms/bob.trace
 include teshsuite/simdag/platforms/bogus_disk_attachment.xml
index d425b29..a640cbe 100644 (file)
@@ -4,6 +4,7 @@ foreach(x actor actor-autorestart
         cloud-interrupt-migration cloud-sharing
         concurrent_rw 
         host-on-off
+        basic-link-test evaluate-get-route-time evaluate-parse-time is-router
         storage_client_server listen_async pid )
   add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
@@ -29,7 +30,7 @@ foreach(x actor actor-autorestart
   ADD_TESH_FACTORIES(tesh-s4u-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x}/${x}.tesh)
 endforeach()
 
-foreach(x host-on-off listen_async pid storage_client_server cloud-sharing)
+foreach(x basic-link-test host-on-off is-router listen_async pid storage_client_server cloud-sharing)
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
   ADD_TESH(tesh-s4u-${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x}/${x}.tesh)
 endforeach()
diff --git a/teshsuite/s4u/basic-link-test/basic-link-test.cpp b/teshsuite/s4u/basic-link-test/basic-link-test.cpp
new file mode 100644 (file)
index 0000000..bf26c68
--- /dev/null
@@ -0,0 +1,36 @@
+/* Copyright (c) 2008-2020. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u.hpp"
+#include <algorithm>
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic_link_test, s4u, "basic link test");
+
+int main(int argc, char** argv)
+{
+  char user_data[] = "some user_data";
+
+  /* initialization of SD */
+  simgrid::s4u::Engine e(&argc, argv);
+
+  /* creation of the environment */
+  e.load_platform(argv[1]);
+
+  std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
+  XBT_INFO("Link count: %zu", links.size());
+
+  std::sort(links.begin(), links.end(), [](const simgrid::s4u::Link* a, const simgrid::s4u::Link* b) {
+    return strcmp(sg_link_name(a), sg_link_name(b)) < 0;
+  });
+
+  for (const auto& l : links) {
+    XBT_INFO("%s: latency = %.5f, bandwidth = %f", l->get_cname(), l->get_latency(), l->get_bandwidth());
+    l->set_data(user_data);
+    xbt_assert(!strcmp(user_data, static_cast<const char*>(l->get_data())), "User data was corrupted.");
+  }
+
+  return 0;
+}
@@ -1,7 +1,6 @@
 #!/usr/bin/env tesh
 
-$ ${bindir:=.}/basic-link-test ../platforms/one_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
+$ ./basic-link-test ../../simdag/platforms/one_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Link count: 12
 > [  0.000000] (0:maestro@) __loopback__: latency = 0.00002, bandwidth = 498000000.000000
 > [  0.000000] (0:maestro@) bob_cluster_backbone: latency = 0.00050, bandwidth = 2250000000.000000
@@ -16,8 +15,7 @@ $ ${bindir:=.}/basic-link-test ../platforms/one_cluster.xml "--log=root.fmt:[%10
 > [  0.000000] (0:maestro@) bob_cluster_link_6_DOWN: latency = 0.00005, bandwidth = 125000000.000000
 > [  0.000000] (0:maestro@) bob_cluster_link_6_UP: latency = 0.00005, bandwidth = 125000000.000000
 
-$ ${bindir:=.}/basic-link-test ../platforms/link_attributes.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
+$ ./basic-link-test ../../simdag/platforms/link_attributes.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Link count: 5
 > [  0.000000] (0:maestro@) __loopback__: latency = 0.00002, bandwidth = 498000000.000000
 > [  0.000000] (0:maestro@) link1: latency = 0.00005, bandwidth = 125000000.000000
@@ -4,29 +4,31 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-//for i in $(seq 1 100); do teshsuite/simdag/platforms/evaluate_get_route_time ../examples/platforms/cluster_backbone.xml 1 2> /tmp/null ; done
-
-
-#include <stdio.h>
-#include "simgrid/simdag.h"
+/*
+for i in $(seq 1 20); do
+  teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time examples/platforms/cluster_backbone.xml 1 2> /tmp/null
+  sleep 1
+done
+*/
+
+#include "simgrid/s4u.hpp"
 #include "xbt/xbt_os_time.h"
+#include <stdio.h>
 
-#define BILLION  1000000000L;
-
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
   int i;
   int j;
   xbt_os_timer_t timer = xbt_os_timer_new();
 
-  SD_init(&argc, argv);
-  SD_create_environment(argv[1]);
+  simgrid::s4u::Engine e(&argc, argv);
+  e.load_platform(argv[1]);
 
-  sg_host_t *hosts = sg_host_list();
-  int host_count = sg_host_count();
+  std::vector<simgrid::s4u::Host*> hosts = e.get_all_hosts();
+  int host_count                         = e.get_host_count();
 
   /* Random number initialization */
-  srand( (int) (xbt_os_time()*1000) );
+  srand(static_cast<int>(xbt_os_time()));
 
   /* Take random i and j, with i != j */
   xbt_assert(host_count > 1);
@@ -35,20 +37,15 @@ int main(int argc, char **argv)
   if (j >= i) // '>=' is not a bug: j is uniform on host_count-1 values, and shifted on need to maintain uniform random
     j++;
 
-  const_sg_host_t h1 = hosts[i];
-  const_sg_host_t h2 = hosts[j];
-  printf("%d\tand\t%d\t\t",i,j);
-  xbt_dynar_t route = xbt_dynar_new(sizeof(SD_link_t), NULL);
+  printf("%d\tand\t%d\t\t", i, j);
+
+  std::vector<simgrid::s4u::Link*> route;
 
   xbt_os_cputimer_start(timer);
-  sg_host_route(h1, h2, route);
+  hosts[i]->route_to(hosts[j], route, nullptr);
   xbt_os_cputimer_stop(timer);
 
-  xbt_dynar_free(&route);
-
-  printf("%f\n", xbt_os_timer_elapsed(timer) );
-
-  xbt_free(hosts);
+  printf("%f\n", xbt_os_timer_elapsed(timer));
 
   return 0;
 }
@@ -3,32 +3,31 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-//teshsuite/simdag/platforms/evaluate_parse_time ../examples/platforms/nancy.xml
+// teshsuite/s4u/evaluate-parse-time/evaluate-parse-time examples/platforms/g5k.xml
 
 #include <stdio.h>
 
-#include "simgrid/simdag.h"
+#include "simgrid/s4u/Engine.hpp"
 #include "xbt/xbt_os_time.h"
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
   xbt_os_timer_t timer = xbt_os_timer_new();
-  SD_init(&argc, argv);
+  simgrid::s4u::Engine e(&argc, argv);
 
   /* creation of the environment, timed */
   xbt_os_cputimer_start(timer);
-  SD_create_environment(argv[1]);
+  e.load_platform(argv[1]);
   xbt_os_cputimer_stop(timer);
 
   /* Display the result and exit after cleanup */
-  printf( "%f\n", xbt_os_timer_elapsed(timer) );
-  printf("Workstation number: %zu, link number: %d\n", sg_host_count(), sg_link_count());
-  if(argv[2]){
-    printf("Wait for %ss\n",argv[2]);
+  printf("%f\n", xbt_os_timer_elapsed(timer));
+  printf("Host number: %zu, link number: %zu\n", e.get_host_count(), e.get_link_count());
+  if (argv[2]) {
+    printf("Wait for %ss\n", argv[2]);
     xbt_os_sleep(atoi(argv[2]));
   }
 
-
   free(timer);
   return 0;
 }
similarity index 74%
rename from teshsuite/simdag/is-router/is-router.cpp
rename to teshsuite/s4u/is-router/is-router.cpp
index 5acb60c..769ad8d 100644 (file)
@@ -6,21 +6,20 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "simgrid/simdag.h"
 
 #include <algorithm>
 #include <cstdio>
 
-int main(int argc, char **argv)
+int main(int argc, char** argv)
 {
-  SD_init(&argc, argv);
-  SD_create_environment(argv[1]);
+  simgrid::s4u::Engine e(&argc, argv);
+  e.load_platform(argv[1]);
 
-  std::vector<sg_host_t> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
-  std::printf("Host count: %zu, link number: %d\n", hosts.size(), sg_link_count());
+  std::vector<sg_host_t> hosts = e.get_all_hosts();
+
+  std::printf("Host count: %zu, link number: %zu\n", hosts.size(), e.get_link_count());
+  std::vector<simgrid::kernel::routing::NetPoint*> netpoints = e.get_all_netpoints();
 
-  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
-      simgrid::s4u::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();
@@ -28,7 +27,7 @@ int main(int argc, char **argv)
 
   for (const auto& host : hosts) {
     const simgrid::kernel::routing::NetPoint* nc = host->get_netpoint();
-    const char *type = "buggy";
+    const char* type                             = "buggy";
     if (nc->is_router())
       type = "router";
     if (nc->is_netzone())
similarity index 84%
rename from teshsuite/simdag/is-router/is-router.tesh
rename to teshsuite/s4u/is-router/is-router.tesh
index d1d27f7..0edfcb0 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/env tesh
 
-$ ${bindir:=.}/is-router ${srcdir}/teshsuite/simdag/platforms/test_of_is_router.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
+$ ${bindir:=.}/is-router ../../simdag/platforms/test_of_is_router.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
 > Host count: 10, link number: 1
 >    - Seen: "host01". Type: host
 >    - Seen: "host02". Type: host
index 54cc945..199d83f 100644 (file)
@@ -1,4 +1,4 @@
-foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test
+foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-parsing-test
           comm-mxn-all2all comm-mxn-independent comm-mxn-scatter comm-p2p-latency-1
           comm-p2p-latency-2 comm-p2p-latency-3 comm-p2p-latency-bound comp-only-par comp-only-seq incomplete)
   add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.c)
@@ -10,16 +10,7 @@ foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-link-test
   set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
 endforeach()
 
-foreach(x evaluate-parse-time evaluate-get-route-time)
-  add_executable       (${x} EXCLUDE_FROM_ALL ${x}/${x}.c)
-  target_link_libraries(${x} simgrid)
-  set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
-  add_dependencies(tests ${x})
-
-  set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
-endforeach()
-
-foreach(x flatifier is-router)
+foreach(x flatifier)
   add_executable       (${x} EXCLUDE_FROM_ALL ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -71,8 +62,8 @@ set(txt_files     ${txt_files}      ${CMAKE_CURRENT_SOURCE_DIR}/platforms/carol.
                                     ${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.fail
                                     ${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.lat                         PARENT_SCOPE)
 
-foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test
-          comm-mxn-all2all comm-mxn-independent comm-mxn-scatter comm-p2p-latency-1 flatifier is-router
+foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-parsing-test
+          comm-mxn-all2all comm-mxn-independent comm-mxn-scatter comm-p2p-latency-1 flatifier
           comm-p2p-latency-2 comm-p2p-latency-3 comm-p2p-latency-bound comp-only-par comp-only-seq incomplete)
   ADD_TESH(tesh-simdag-${x} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/${x} ${x}.tesh)
 endforeach()
diff --git a/teshsuite/simdag/basic-link-test/basic-link-test.c b/teshsuite/simdag/basic-link-test/basic-link-test.c
deleted file mode 100644 (file)
index a21fa7c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (c) 2008-2020. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include <stdio.h>
-#include "simgrid/simdag.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic_link_test, sd, "SimDag test basic_link_test");
-
-static int cmp_link(const void*a, const void*b) {
-  return strcmp(sg_link_name(*(const SD_link_t*)a), sg_link_name(*(const SD_link_t*)b));
-}
-
-int main(int argc, char **argv)
-{
-  char user_data[] = "some user_data";
-
-  /* initialization of SD */
-  SD_init(&argc, argv);
-
-  /* creation of the environment */
-  SD_create_environment(argv[1]);
-  SD_link_t *links = sg_link_list();
-  int count = sg_link_count();
-  XBT_INFO("Link count: %d", count);
-  qsort((void *)links, count, sizeof(SD_link_t), cmp_link);
-
-  for (int i=0; i < count; i++){
-    XBT_INFO("%s: latency = %.5f, bandwidth = %f", sg_link_name(links[i]),
-             sg_link_latency(links[i]), sg_link_bandwidth(links[i]));
-    sg_link_data_set(links[i], user_data);
-    xbt_assert(!strcmp(user_data, (const char*)sg_link_data(links[i])),"User data was corrupted.");
-  }
-  xbt_free(links);
-  return 0;
-}