Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SimDag Revolution: SD_workstation becomes sg_host
[simgrid.git] / examples / simdag / sd_typed_tasks_test.c
index f262166..4e29f2c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2010, 2012-2013. The SimGrid Team.
+/* Copyright (c) 2006-2010, 2012-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,7 +6,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "simdag/simdag.h"
+#include "simgrid/simdag.h"
 #include "xbt/ex.h"
 #include "xbt/log.h"
 
@@ -18,31 +18,28 @@ int main(int argc, char **argv)
   int i;
   unsigned int ctr;
   const char *platform_file;
-  const SD_workstation_t *workstations;
+  const sg_host_t *workstations;
   SD_task_t task, seq_comp1, e2e_comm, seq_comp2;
   SD_task_t par_comp1, redist, par_comp2, par_comp3;
   xbt_dynar_t changed_tasks;
 
   double computation_amount[4];
   double communication_amount[16] = { 0 };
-  SD_workstation_t workstation_list[4];
+  sg_host_t workstation_list[4];
   
   /* initialization of SD */
   SD_init(&argc, argv);
 
   /*  xbt_log_control_set("sd.thres=debug"); */
 
-  if (argc < 2) {
-    XBT_INFO("Usage: %s platform_file", argv[0]);
-    XBT_INFO("example: %s sd_platform.xml", argv[0]);
-    exit(1);
-  }
+  xbt_assert(argc > 1, "Usage: %s platform_file\n"
+            "\nExample: %s two_clusters.xml", argv[0], argv[0]);
 
   /* creation of the environment */
   platform_file = argv[1];
   SD_create_environment(platform_file);
  
-  workstations = SD_workstation_get_list();
+  workstations = sg_host_list();
 
   /* creation of some typed tasks and their dependencies */
   seq_comp1 = SD_task_create_comp_seq("Seq. comp. 1", NULL, 1e9);
@@ -90,9 +87,11 @@ int main(int argc, char **argv)
     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));
+  }
+
+  xbt_dynar_foreach(changed_tasks, ctr, task) {
     SD_task_destroy(task);
   }
-  xbt_dynar_free_container(&changed_tasks);
   SD_exit();
   return 0;
 }