Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert a simdag test to s4u DAGs
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Wed, 22 Dec 2021 16:36:30 +0000 (17:36 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Wed, 22 Dec 2021 16:36:30 +0000 (17:36 +0100)
MANIFEST.in
teshsuite/s4u/CMakeLists.txt
teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp [new file with mode: 0644]
teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.tesh [new file with mode: 0644]
teshsuite/simdag/CMakeLists.txt
teshsuite/simdag/incomplete/incomplete.c [deleted file]
teshsuite/simdag/incomplete/incomplete.tesh [deleted file]

index 52a85f1..169d5d5 100644 (file)
@@ -760,6 +760,8 @@ include teshsuite/s4u/comm-get-sender/comm-get-sender.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/dag-incomplete-simulation/dag-incomplete-simulation.cpp
+include teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.tesh
 include teshsuite/s4u/dependencies/dependencies.cpp
 include teshsuite/s4u/dependencies/dependencies.tesh
 include teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time.cpp
@@ -820,8 +822,6 @@ include teshsuite/simdag/flatifier/bogus_missing_gateway.tesh
 include teshsuite/simdag/flatifier/bogus_two_hosts_asymetric.tesh
 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/platforms/Dijkstra.xml
 include teshsuite/simdag/platforms/bob.trace
 include teshsuite/simdag/platforms/bogus_missing_dst_gateway.xml
index 15e28f6..fd41008 100644 (file)
@@ -3,7 +3,7 @@ foreach(x actor actor-autorestart actor-suspend
         comm-get-sender comm-pt2pt wait-all-for wait-any-for
         cloud-interrupt-migration cloud-two-execs
         concurrent_rw
-        dependencies
+        dag-incomplete-simulation dependencies
         host-on-off host-on-off-actors host-on-off-recv host-multicore-speed-file io-set-bw
         basic-link-test basic-parsing-test evaluate-get-route-time evaluate-parse-time is-router
         storage_client_server listen_async pid
@@ -28,7 +28,7 @@ set_property(TARGET activity-lifecycle APPEND PROPERTY INCLUDE_DIRECTORIES "${IN
 ## Add the tests.
 ## Some need to be run with all factories, some don't need tesh to run
 foreach(x actor actor-autorestart actor-suspend activity-lifecycle comm-get-sender wait-all-for wait-any-for
-        cloud-interrupt-migration cloud-two-execs concurrent_rw dependencies io-set-bw
+        cloud-interrupt-migration cloud-two-execs concurrent_rw dag-incomplete-simulation dependencies io-set-bw
            vm-live-migration vm-suicide)
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
   ADD_TESH_FACTORIES(tesh-s4u-${x} "*" --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)
diff --git a/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp b/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp
new file mode 100644 (file)
index 0000000..e1823d6
--- /dev/null
@@ -0,0 +1,58 @@
+/* Copyright (c) 2007-2021. 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"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(incomplete, "Incomplete DAG test");
+
+/* Dag ncomplete simulation Test
+ * Scenario:
+ *   - Create a bunch of activities
+ *   - schedule only a subset of them (init, A and D)
+ *   - run the simulation
+ *   - Verify that we detect which activities are blocked and show their state.
+ * The scheduled activity A sends 1GB. Simulation time should be
+ *          1e9/1.25e8 + 1e-4 = 8.0001 seconds
+ * Activity D is scheduled but depends on unscheduled activity C.
+ */
+int main(int argc, char** argv)
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  e.load_platform(argv[1]);
+
+  auto host = e.host_by_name("cpu0");
+  /* creation of the tasks and their dependencies */
+  simgrid::s4u::ExecPtr Init = simgrid::s4u::Exec::init()->set_name("Init")->set_flops_amount(0)->vetoable_start();
+  simgrid::s4u::CommPtr A = simgrid::s4u::Comm::sendto_init()->set_name("A")->set_payload_size(1e9)->vetoable_start();
+  simgrid::s4u::CommPtr B = simgrid::s4u::Comm::sendto_init()->set_name("B")->vetoable_start();
+  simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start();
+  simgrid::s4u::CommPtr D = simgrid::s4u::Comm::sendto_init()->set_name("D")->set_payload_size(1e9)->vetoable_start();
+  std::vector<simgrid::s4u::ActivityPtr> activities = {Init, A, B, C, D};
+
+  Init->add_successor(A);
+  Init->add_successor(B);
+  C->add_successor(D);
+
+  Init->set_host(host);
+  A->set_from(host)->set_to(host);
+  D->set_from(host)->set_to(host);
+
+  /* let's launch the simulation! */
+  e.run();
+
+  int count = 0;
+  for (auto a : activities) {
+    if (a->get_state() == simgrid::s4u::Activity::State::STARTING) {
+      count++;
+      XBT_INFO("Activity '%s' blocked: Dependencies: %s; Ressources: %s", a->get_cname(),
+               (a->dependencies_solved() ? "solved" : "NOT solved"), (a->is_assigned() ? "assigned" : "NOT assigned"));
+    }
+  }
+  XBT_INFO("Simulation is finished but %d tasks are still not done", count);
+  // Clean up
+  C->unref();
+  return 0;
+}
diff --git a/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.tesh b/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.tesh
new file mode 100644 (file)
index 0000000..9c57d3b
--- /dev/null
@@ -0,0 +1,10 @@
+! output sort
+$ ./dag-incomplete-simulation ${platfdir}/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n" --log=s4u_activity.t:debug
+> [  0.000000] 'A' is assigned to a resource and all dependencies are solved. Let's start
+> [  0.000000] 'Init' is assigned to a resource and all dependencies are solved. Let's start
+> [  0.000000] Remove a dependency from 'Init' on 'A'
+> [  0.000000] Remove a dependency from 'Init' on 'B'
+> [  8.661095] Activity 'B' blocked: Dependencies: solved; Ressources: NOT assigned
+> [  8.661095] Activity 'C' blocked: Dependencies: solved; Ressources: NOT assigned
+> [  8.661095] Activity 'D' blocked: Dependencies: NOT solved; Ressources: assigned
+> [  8.661095] Simulation is finished but 3 tasks are still not done
index 6076687..d51c9fd 100644 (file)
@@ -1,4 +1,4 @@
-foreach(x availability incomplete)
+foreach(x availability )
   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})
@@ -53,7 +53,7 @@ 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 flatifier incomplete)
+foreach(x availability flatifier)
   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/incomplete/incomplete.c b/teshsuite/simdag/incomplete/incomplete.c
deleted file mode 100644 (file)
index 40a0648..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) 2007-2021. 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/simdag.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(incomplete, sd, "SimDag incomplete test");
-
-/* SimDag Incomplete Test
- * Scenario:
- *   - Create a bunch of tasks
- *   - schedule only a subset of them (init, A and D)
- *   - run the simulation
- *   - Verify that we detect which tasks are not scheduled and show their state.
- * The scheduled task A sends 1GB. Simulation time should be
- *          1e9/1.25e8 + 1e-4 = 8.0001 seconds
- * Task D is scheduled but depends on unscheduled task C.
- */
-int main(int argc, char **argv)
-{
-  /* scheduling parameters */
-  double communication_amount1 = 1e9;
-  double no_cost = 0.0;
-
-  /* initialization of SD */
-  SD_init(&argc, argv);
-
-  /* creation of the environment */
-  SD_create_environment(argv[1]);
-
-  /* creation of the tasks and their dependencies */
-  SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
-  SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
-  SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
-  SD_task_t taskC = SD_task_create("Task C", NULL, 1.0);
-  SD_task_t taskD = SD_task_create("Task D", NULL, 1.0);
-
-  SD_task_dependency_add(taskInit, taskA);
-  SD_task_dependency_add(taskInit, taskB);
-  SD_task_dependency_add(taskC, taskD);
-
-  sg_host_t *hosts = sg_host_list();
-  SD_task_schedule(taskInit, 1, hosts, &no_cost, &no_cost, -1.0);
-  SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
-  SD_task_schedule(taskD, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
-  xbt_free(hosts);
-
-  /* let's launch the simulation! */
-  SD_simulate(-1.);
-
-  SD_task_destroy(taskA);
-  SD_task_destroy(taskB);
-  SD_task_destroy(taskC);
-  SD_task_destroy(taskD);
-  SD_task_destroy(taskInit);
-
-  XBT_INFO("Simulation time: %f", simgrid_get_clock());
-
-  return 0;
-}
diff --git a/teshsuite/simdag/incomplete/incomplete.tesh b/teshsuite/simdag/incomplete/incomplete.tesh
deleted file mode 100644 (file)
index a5a7b8b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-! output sort
-$ ${bindir:=.}/incomplete ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [  0.000000] Switching to the L07 model to handle parallel tasks.
-> [  8.000100] Simulation is finished but 3 tasks are still not done
-> [  8.000100] Task D is in scheduled state
-> [  8.000100] Task C is in not scheduled state
-> [  8.000100] Task B is in schedulable state
-> [  8.000100] Simulation time: 8.000100