Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a new test to see how failures are handled by SimDag.
authorsuter <frederic.suter@cc.in2p3.fr>
Thu, 28 Jun 2012 13:23:55 +0000 (15:23 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Sun, 1 Jul 2012 19:26:04 +0000 (21:26 +0200)
Seem to raise a bug because unscheduling and rescheduling a FAILED
tasks makes it run in no time.

examples/simdag/CMakeLists.txt
examples/simdag/faulty_host.trace [new file with mode: 0644]
examples/simdag/faulty_host.xml [new file with mode: 0644]
examples/simdag/sd_fail.c [new file with mode: 0644]

index 31fa267..24b2153 100644 (file)
@@ -4,6 +4,7 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
 
 add_executable(ex_sd_test sd_test.c)
 add_executable(sd_test2 sd_test2.c)
+add_executable(sd_fail sd_fail.c)
 add_executable(sd_typed_tasks_test sd_typed_tasks_test.c)
 add_executable(sd_comm_throttling sd_comm_throttling.c)
 add_executable(sd_seq_access sd_seq_access.c)
@@ -14,6 +15,7 @@ add_executable(simdag_tracing simdag_trace.c)
 if(NOT WIN32)
   target_link_libraries(ex_sd_test simgrid pthread m )
   target_link_libraries(sd_test2 simgrid pthread m )
+  target_link_libraries(sd_fail simgrid pthread m )
   target_link_libraries(sd_typed_tasks_test simgrid pthread m )
   target_link_libraries(sd_comm_throttling simgrid pthread m )
   target_link_libraries(sd_seq_access simgrid pthread m )
@@ -33,6 +35,7 @@ if(NOT WIN32)
 else(NOT WIN32)
   target_link_libraries(ex_sd_test simgrid)
   target_link_libraries(sd_test2 simgrid)
+  target_link_libraries(sd_fail simgrid)
   target_link_libraries(sd_typed_tasks_test simgrid)
   target_link_libraries(sd_comm_throttling simgrid)
   target_link_libraries(sd_seq_access simgrid)
diff --git a/examples/simdag/faulty_host.trace b/examples/simdag/faulty_host.trace
new file mode 100644 (file)
index 0000000..0e93b54
--- /dev/null
@@ -0,0 +1,4 @@
+0 1
+10 0
+11 1
+50 0
\ No newline at end of file
diff --git a/examples/simdag/faulty_host.xml b/examples/simdag/faulty_host.xml
new file mode 100644 (file)
index 0000000..bc82e94
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+ <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+ <platform version="3">
+ <AS  id="AS0"  routing="Full">
+   <host id="Faulty Host" power="1E9"
+         state_file="faulty_host.trace"/>
+   <host id="Safe Host" power="5E8"/>
+ </AS>
+ </platform>
diff --git a/examples/simdag/sd_fail.c b/examples/simdag/sd_fail.c
new file mode 100644 (file)
index 0000000..39ffe5d
--- /dev/null
@@ -0,0 +1,62 @@
+/* Copyright (c) 2006, 2007, 2008, 2009, 2010. 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 <stdlib.h>
+#include "simdag/simdag.h"
+#include "xbt/ex.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_fail,
+                             "Logging specific to this SimDag example");
+
+int main(int argc, char **argv)
+{
+  SD_task_t task;
+
+  /* initialization of SD */
+  SD_init(&argc, argv);
+
+  /* creation of the environment */
+  SD_create_environment("./faulty_host.xml");
+  /* creation of a single task that will poorly fail when the workstation
+   * will stop */
+
+  task = SD_task_create_comp_seq("Poor task", NULL, 2e10);
+
+  XBT_INFO("Schedule task '%s' on workstation 'Faulty Host'",
+           SD_task_get_name(task));
+
+  SD_task_schedulel(task, 1, SD_workstation_get_by_name("Faulty Host"));
+
+  SD_simulate(-1.0);
+
+  SD_task_dump(task);
+
+  XBT_INFO("Task %s has failed. %.f flops remain to be done",
+           SD_task_get_name(task),
+           SD_task_get_remaining_amount(task));
+
+  XBT_INFO("let's unschedule taks %s and reschedule it on the 'Safe Host'",
+           SD_task_get_name(task));
+  SD_task_unschedule(task);
+  SD_task_schedulel(task, 1, SD_workstation_get_by_name("Safe Host"));
+
+  XBT_INFO("Run the simulation again");
+  SD_simulate(-1.0);
+
+  SD_task_dump(task);
+  XBT_INFO("Task '%s' start time: %f, finish time: %f",
+      SD_task_get_name(task),
+      SD_task_get_start_time(task),
+      SD_task_get_finish_time(task));
+
+  SD_task_destroy(task);
+
+  SD_exit();
+  return 0;
+}