Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a new test on availability for the SimDAG API.
authorArnaud Legrand <arnaud.legrand@imag.fr>
Mon, 4 Feb 2013 09:53:17 +0000 (10:53 +0100)
committerArnaud Legrand <arnaud.legrand@imag.fr>
Mon, 4 Feb 2013 14:47:39 +0000 (15:47 +0100)
Issue was reported by Ricardo Rodriguez on 29/12/12 and fixed in
previous commits.

buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExe.cmake
teshsuite/simdag/availability/CMakeLists.txt [new file with mode: 0644]
teshsuite/simdag/availability/availability_test.c [new file with mode: 0644]
teshsuite/simdag/availability/availability_test.tesh [new file with mode: 0644]
teshsuite/simdag/availability/linkBandwidth7.bw [new file with mode: 0644]
teshsuite/simdag/availability/simulacrum_7_hosts.xml [new file with mode: 0644]

index 8c8a2af..ca4830c 100644 (file)
@@ -106,6 +106,7 @@ if(NOT enable_memcheck)
   ADD_TEST(tesh-simdag-mxn-3                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network/mxn/test_intra_scatter.tesh)
   ADD_TEST(tesh-simdag-par-1                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask/test_comp_only_seq.tesh)
   ADD_TEST(tesh-simdag-par-2                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask/test_comp_only_par.tesh)
+  ADD_TEST(tesh-simdag-availability             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/availability/availability_test.tesh)
 
   # MSG examples
   ADD_TEST(msg-file                             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/io/io.tesh)
index b49c63c..090b6e7 100644 (file)
@@ -794,6 +794,7 @@ set(TESHSUITE_CMAKEFILES_TXT
   teshsuite/simdag/network/p2p/CMakeLists.txt
   teshsuite/simdag/partask/CMakeLists.txt
   teshsuite/simdag/platforms/CMakeLists.txt
+  teshsuite/simdag/availability/CMakeLists.txt
   teshsuite/xbt/CMakeLists.txt
   teshsuite/smpi/CMakeLists.txt
   teshsuite/smpi/mpich-test/CMakeLists.txt
index 1ca6822..9cf775f 100644 (file)
@@ -22,6 +22,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network/p2p)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network/mxn)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/availability)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/env)
diff --git a/teshsuite/simdag/availability/CMakeLists.txt b/teshsuite/simdag/availability/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a866b6d
--- /dev/null
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(availability_test availability_test.c)
+
+### Add definitions for compile
+if(NOT WIN32)
+  target_link_libraries(availability_test simgrid m)
+else()
+  target_link_libraries(availability_test simgrid)
+endif()
+
+set(tesh_files
+  ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/availability_test.tesh
+  PARENT_SCOPE
+  )
+set(xml_files
+  ${xml_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/simulacrum_7_hosts.xml
+  PARENT_SCOPE
+  )
+set(teshsuite_src
+  ${teshsuite_src}
+  ${CMAKE_CURRENT_SOURCE_DIR}/availability_test.c
+  PARENT_SCOPE
+  )
+set(bin_files
+  ${bin_files}
+  PARENT_SCOPE
+  )
+set(txt_files
+  ${txt_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/linkBandwidth7.bw
+  PARENT_SCOPE
+  )
diff --git a/teshsuite/simdag/availability/availability_test.c b/teshsuite/simdag/availability/availability_test.c
new file mode 100644 (file)
index 0000000..1fb03f4
--- /dev/null
@@ -0,0 +1,177 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <simdag/simdag.h>
+#include <xbt/log.h>
+#include <xbt/ex.h>
+#include <signal.h>
+
+
+typedef struct {
+  FILE *daxFile;
+  FILE *envFile;
+} XMLfiles;
+
+
+static void usage(char *name)
+{
+  fprintf(stdout, "Error on parameters.\n");
+  fprintf(stdout, "usage: %s <XML environment file>  <DAX file>\n", name);
+}
+
+static void checkParameters(int argc, char *argv[])
+{
+  if (argc != 3) {
+    int i;
+    printf("====%d===\n",argc);
+    for(i=0; i<argc; i++) {
+      printf("\t%s\n",argv[i]);
+    }
+    usage(argv[0]);
+    exit(-1);
+  }
+ /* Check that files exist */
+  XMLfiles xmlFiles;
+  if ((xmlFiles.envFile = fopen(argv[1], "r")) == NULL) {
+    fprintf(stderr, "Error while opening XML file %s.\n", argv[1]);
+    exit(-1);
+  }
+  fclose(xmlFiles.envFile);
+
+  if ((xmlFiles.daxFile = fopen(argv[2], "r")) == NULL) {
+    fprintf(stderr, "Error while opening DAX file %s.\n", argv[2]);
+    exit(-1);
+  }
+  fclose(xmlFiles.daxFile);
+}
+
+static int name_compare_hosts(const void *n1, const void *n2)
+{
+  char name1[80], name2[80];
+  strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *) n1)));
+  strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *) n2)));
+
+  return strcmp(name1, name2);
+}
+
+static void scheduleDAX(xbt_dynar_t dax)
+{
+  unsigned int cursor;
+  SD_task_t task;
+
+  const SD_workstation_t *ws_list = SD_workstation_get_list();
+  int totalHosts = SD_workstation_get_number();
+  qsort((void *) ws_list, totalHosts, sizeof(SD_workstation_t),
+        name_compare_hosts);
+
+  int count = SD_workstation_get_number();
+  //fprintf(stdout, "No. workstations: %d, %d\n", count, (dax != NULL));
+
+  xbt_dynar_foreach(dax, cursor, task) {
+    if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
+      if (!strcmp(SD_task_get_name(task), "end")
+          || !strcmp(SD_task_get_name(task), "root")) {
+        fprintf(stdout, "Scheduling %s to node: %s\n", SD_task_get_name(task),
+                SD_workstation_get_name(ws_list[0]));
+        SD_task_schedulel(task, 1, ws_list[0]);
+      } else {
+        fprintf(stdout, "Scheduling %s to node: %s\n", SD_task_get_name(task),
+                SD_workstation_get_name(ws_list[(cursor) % count]));
+        SD_task_schedulel(task, 1, ws_list[(cursor) % count]);
+      }
+    }
+  }
+}
+
+/* static void printTasks(xbt_dynar_t completedTasks) */
+/* { */
+/*     unsigned int cursor; */
+/*     SD_task_t task; */
+
+/*     xbt_dynar_foreach(completedTasks, cursor, task) */
+/*     { */
+/*             if(SD_task_get_state(task) == SD_DONE) */
+/*             { */
+/*                     fprintf(stdout, "Task done: %s, %f, %f\n", */
+/*                                             SD_task_get_name(task), SD_task_get_start_time(task), SD_task_get_finish_time(task)); */
+/*             } */
+/*     } */
+/* } */
+
+
+/* void createDottyFile(xbt_dynar_t dax, char *filename) */
+/* { */
+/*     char filename2[1000]; */
+/*     unsigned int cursor; */
+/*     SD_task_t task; */
+
+/*     sprintf(filename2, "%s.dot", filename); */
+/*     FILE *dotout = fopen(filename2, "w"); */
+/*     fprintf(dotout, "digraph A {\n"); */
+/*     xbt_dynar_foreach(dax, cursor, task) */
+/*     { */
+/*             SD_task_dotty(task, dotout); */
+/*     } */
+/*     fprintf(dotout, "}\n"); */
+/*     fclose(dotout); */
+/* } */
+
+static xbt_dynar_t initDynamicThrottling(int *argc, char *argv[])
+{
+  /* Initialize SD */
+  SD_init(argc, argv);
+
+  /* Check parameters */
+  checkParameters(*argc,argv);
+
+  /* Create environment */
+  SD_create_environment(argv[1]);
+  /* Load DAX file */
+  xbt_dynar_t dax = SD_daxload(argv[2]);
+
+  //  createDottyFile(dax, argv[2]);
+
+  // Schedule DAX
+  fprintf(stdout, "Scheduling DAX...\n");
+  scheduleDAX(dax);
+  fprintf(stdout, "DAX scheduled\n");
+  SD_simulate(-1);
+  fprintf(stdout, "Simulation end. Time: %f\n", SD_get_clock());
+
+  return dax;
+}
+
+/**
+ * Garbage collector :D
+ */
+static void garbageCollector(xbt_dynar_t dax)
+{
+  SD_task_t task;
+  unsigned int cursor;
+  xbt_dynar_foreach(dax, cursor, task) {
+    SD_task_destroy(task);
+  }
+  SD_exit();
+}
+
+
+
+/**
+ * Main procedure
+ * @param argc
+ * @param argv
+ * @return
+ */
+int main(int argc, char *argv[])
+{
+
+  /* Start process... */
+  xbt_dynar_t dax = initDynamicThrottling(&argc, argv);
+
+  // Free memory
+  garbageCollector(dax);
+  return 0;
+}
diff --git a/teshsuite/simdag/availability/availability_test.tesh b/teshsuite/simdag/availability/availability_test.tesh
new file mode 100644 (file)
index 0000000..160c156
--- /dev/null
@@ -0,0 +1,34 @@
+$ simdag/availability/availability_test ${srcdir:=.}/simdag/availability/simulacrum_7_hosts.xml --cfg=path:${srcdir:=.}/simdag/availability/ ${srcdir:=.}/../examples/simdag/scheduling/Montage_25.xml --cfg=network/TCP_gamma:4194304 --log=sd_daxparse.thresh:critical
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
+> [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
+> Scheduling DAX...
+> Scheduling root to node: Host 26
+> Scheduling ID00000@mProjectPP to node: Host 27
+> Scheduling ID00001@mProjectPP to node: Host 28
+> Scheduling ID00002@mProjectPP to node: Host 29
+> Scheduling ID00003@mProjectPP to node: Host 30
+> Scheduling ID00004@mProjectPP to node: Host 31
+> Scheduling ID00005@mDiffFit to node: Host 32
+> Scheduling ID00006@mDiffFit to node: Host 26
+> Scheduling ID00007@mDiffFit to node: Host 27
+> Scheduling ID00008@mDiffFit to node: Host 28
+> Scheduling ID00009@mDiffFit to node: Host 29
+> Scheduling ID00010@mDiffFit to node: Host 30
+> Scheduling ID00011@mDiffFit to node: Host 31
+> Scheduling ID00012@mDiffFit to node: Host 32
+> Scheduling ID00013@mDiffFit to node: Host 26
+> Scheduling ID00014@mConcatFit to node: Host 27
+> Scheduling ID00015@mBgModel to node: Host 28
+> Scheduling ID00016@mBackground to node: Host 29
+> Scheduling ID00017@mBackground to node: Host 30
+> Scheduling ID00018@mBackground to node: Host 31
+> Scheduling ID00019@mBackground to node: Host 32
+> Scheduling ID00020@mBackground to node: Host 26
+> Scheduling ID00021@mImgTbl to node: Host 27
+> Scheduling ID00022@mAdd to node: Host 28
+> Scheduling ID00023@mShrink to node: Host 29
+> Scheduling ID00024@mJPEG to node: Host 30
+> Scheduling end to node: Host 26
+> DAX scheduled
+> Simulation end. Time: 164.052870
+
diff --git a/teshsuite/simdag/availability/linkBandwidth7.bw b/teshsuite/simdag/availability/linkBandwidth7.bw
new file mode 100644 (file)
index 0000000..34a24c3
--- /dev/null
@@ -0,0 +1,5 @@
+PERIODICITY 8.0
+1.007044263744508 6.846527733924368E7
+4.199387092709633 1.0335587797993976E8
+5.319464737378834 1.0591433767387845E7
+7.237437222882919 7.037797434537312E7
diff --git a/teshsuite/simdag/availability/simulacrum_7_hosts.xml b/teshsuite/simdag/availability/simulacrum_7_hosts.xml
new file mode 100644 (file)
index 0000000..835e312
--- /dev/null
@@ -0,0 +1,225 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+ <AS  id="AS0"  routing="Full">
+  <host id="Host 26" power="3.300140519709234E9" />
+  <host id="Host 27" power="3.867398877553016E9" />
+  <host id="Host 28" power="1.6522665718098645E9" />
+  <host id="Host 29" power="1.0759376792481766E9" />
+  <host id="Host 30" power="2.4818410475340424E9" />
+  <host id="Host 31" power="1.773869555571436E9" />
+  <host id="Host 32" power="1.7843609176927505E9" />
+
+  <link id="l152" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l153" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l154" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l155" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l156" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l157" bandwidth="1.25E8"  latency="1.0E-4" />
+  <link id="l159" bandwidth="1.25E8" bandwidth_file="linkBandwidth7.bw"  latency="1.0E-4" />
+  <link id="l160" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l161" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l162" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l163" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l164" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l165" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l166" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l167" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l168" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l169" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l170" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l171" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l172" bandwidth="1.25E8" latency="1.0E-4" />
+  <link id="l173" bandwidth="1.25E8" latency="1.0E-4" />
+
+  <route symmetrical="NO" src="Host 26" dst="Host 27">
+    <link_ctn id="l155"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 26" dst="Host 28">
+    <link_ctn id="l155"/>
+    <link_ctn id="l154"/>
+    <link_ctn id="l156"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 26" dst="Host 29">
+    <link_ctn id="l152"/>
+    <link_ctn id="l157"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 26" dst="Host 30">
+    <link_ctn id="l152"/>
+    <link_ctn id="l161"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 26" dst="Host 31">
+    <link_ctn id="l166"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 26" dst="Host 32">
+    <link_ctn id="l152"/>
+    <link_ctn id="l169"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 26">
+    <link_ctn id="l155"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 28">
+    <link_ctn id="l154"/>
+    <link_ctn id="l156"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 29">
+    <link_ctn id="l159"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 30">
+    <link_ctn id="l162"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 31">
+    <link_ctn id="l167"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 27" dst="Host 32">
+    <link_ctn id="l154"/>
+    <link_ctn id="l170"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 26">
+    <link_ctn id="l156"/>
+    <link_ctn id="l154"/>
+    <link_ctn id="l155"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 27">
+    <link_ctn id="l156"/>
+    <link_ctn id="l154"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 29">
+    <link_ctn id="l160"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 30">
+    <link_ctn id="l163"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 31">
+    <link_ctn id="l163"/>
+    <link_ctn id="l168"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 28" dst="Host 32">
+    <link_ctn id="l156"/>
+    <link_ctn id="l170"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 26">
+    <link_ctn id="l157"/>
+    <link_ctn id="l152"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 27">
+    <link_ctn id="l159"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 28">
+    <link_ctn id="l160"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 30">
+    <link_ctn id="l164"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 31">
+    <link_ctn id="l159"/>
+    <link_ctn id="l167"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 29" dst="Host 32">
+    <link_ctn id="l171"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 26">
+    <link_ctn id="l161"/>
+    <link_ctn id="l152"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 27">
+    <link_ctn id="l162"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 28">
+    <link_ctn id="l163"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 29">
+    <link_ctn id="l164"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 31">
+    <link_ctn id="l168"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 30" dst="Host 32">
+    <link_ctn id="l172"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 26">
+    <link_ctn id="l166"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 27">
+    <link_ctn id="l167"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 28">
+    <link_ctn id="l168"/>
+    <link_ctn id="l163"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 29">
+    <link_ctn id="l167"/>
+    <link_ctn id="l159"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 30">
+    <link_ctn id="l168"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 31" dst="Host 32">
+    <link_ctn id="l173"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 26">
+    <link_ctn id="l169"/>
+    <link_ctn id="l152"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 27">
+    <link_ctn id="l170"/>
+    <link_ctn id="l154"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 28">
+    <link_ctn id="l170"/>
+    <link_ctn id="l156"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 29">
+    <link_ctn id="l171"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 30">
+    <link_ctn id="l172"/>
+  </route>
+
+  <route symmetrical="NO" src="Host 32" dst="Host 31">
+    <link_ctn id="l173"/>
+  </route>
+
+</AS>
+</platform>
+