Exemplo n.º 1
0
int main(int argc, char **argv)
{
  xbt_dynar_t dax;
  unsigned int cursor;
  SD_task_t task;

  /* SD initialization */
  SD_init(&argc, argv);

  /* Check our arguments */
  xbt_assert(argc > 2, "Usage: %s platform_file dax_file [jedule_file]\n"
       "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", argv[0], argv[0]);

  char *last = strrchr(argv[2], '.');
  char * tracefilename = bprintf("%.*s.trace",(int) (last == NULL ? strlen(argv[2]):last - argv[2]), argv[2]);
  if (argc == 4)
    tracefilename = xbt_strdup(argv[3]);

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* load the DAX file */
  dax = SD_daxload(argv[2]);
  if (!dax){
    XBT_ERROR("A problem occurred during DAX parsing (cycle or syntax). Do not continue this test");
    free(tracefilename);
    SD_exit();
    exit(255);
  }

  /* Display all the tasks */
  XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dax, cursor, task) {
    SD_task_dump(task);
  }
Exemplo n.º 2
0
int main(int argc, char **argv)
{
  xbt_dynar_t dot;
  unsigned int cursor;
  SD_task_t task;

  /* initialization of SD */
  SD_init(&argc, argv);

  /* Check our arguments */
  xbt_assert(argc > 2, "Usage: %s platform_file dot_file [trace_file]"
             "example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0], argv[0]);

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* load the DOT file */
  dot = SD_dotload(argv[2]);
  if(dot == NULL){
    XBT_CRITICAL("No dot loaded. Do you have a cycle in your graph?");
    SD_exit();
    exit(2);
  }

  char *tracefilename;
  char *last = strrchr(argv[2], '.');
  tracefilename = bprintf("%.*s.trace", (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),argv[2]);
  if (argc == 4) 
    tracefilename = xbt_strdup(argv[3]);

  /* Display all the tasks */
  XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dot, cursor, task) {
    SD_task_dump(task);
  }
Exemplo n.º 3
0
/* simple test trying to load a Parallel Task Graph (PTG) as a DOT file.    */
int main(int argc, char **argv){
  xbt_dynar_t dot;
  unsigned int cursor;
  SD_task_t task;

  /* initialization of SD */
  SD_init(&argc, argv);

  /* Check our arguments */
  if (argc < 2) {
    XBT_INFO("Usage: %s platform_file dot_file ", argv[0]);
    XBT_INFO("example: %s ../2clusters.xml ptg.dot", argv[0]);
    exit(1);
  }

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* load the DOT file */
  dot = SD_PTG_dotload(argv[2]);
  if(dot == NULL){
    SD_exit();
    xbt_die("No dot load may be you have a cycle in your graph");
  }

  /* Display all the tasks */
  XBT_INFO
      ("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dot, cursor, task) {
    SD_task_dump(task);
  }
Exemplo n.º 4
0
static void dump_res()
{
  unsigned int cursor;
  SD_task_t task;
  xbt_dynar_foreach(result, cursor, task) {
    XBT_INFO("Task %d", cursor);
    SD_task_dump(task);
  }
Exemplo n.º 5
0
int main(int argc, char **argv)
{
  xbt_dynar_t dax, changed;
  unsigned int cursor;
  SD_task_t task;

  /* initialisation of SD */
  SD_init(&argc, argv);

  /* Check our arguments */
  if (argc < 3) {
    XBT_INFO("Usage: %s platform_file dax_file [trace_file]", argv[0]);
    XBT_INFO
        ("example: %s ../sd_platform.xml Montage_50.xml Montage_50.mytrace",
         argv[0]);
    exit(1);
  }
  char *tracefilename;
  if (argc == 3) {
    char *last = strrchr(argv[2], '.');

    tracefilename =
        bprintf("%.*s.trace",
                (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),
                argv[2]);
  } else {
    tracefilename = xbt_strdup(argv[3]);
  }

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* load the DAX file */
  dax = SD_daxload(argv[2]);
  if (!dax){
    XBT_ERROR("A problem occurred during DAX parsing (cycle or syntax). Do not continue this test");
    free(tracefilename);
    SD_exit();
    exit(255);
  }

  /* Display all the tasks */
  XBT_INFO
      ("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dax, cursor, task) {
    SD_task_dump(task);
  }
Exemplo n.º 6
0
int main(int argc, char **argv)
{
  xbt_dynar_t dot, changed;
  unsigned int cursor;
  SD_task_t task;

  /* initialization of SD */
  SD_init(&argc, argv);

  /* Check our arguments */
  if (argc < 3) {
    XBT_INFO("Usage: %s platform_file dot_file [trace_file]", argv[0]);
    XBT_INFO("example: %s ../2clusters.xml dag.dot dag.mytrace", argv[0]);
    exit(1);
  }

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* load the DOT file  and schedule tasks */
  dot = SD_dotload_with_sched(argv[2]);
  if(!dot){
    XBT_CRITICAL("The dot file with the provided scheduling is wrong, more information with the option : --log=sd_dotparse.thres:verbose");
    SD_exit();
    exit(2);
  }

  char *tracefilename;
  if (argc == 3) {
    char *last = strrchr(argv[2], '.');

    tracefilename =
        bprintf("%.*s.trace",
            (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),
            argv[2]);
  } else {
    tracefilename = xbt_strdup(argv[3]);
  }

  /* Display all the tasks */
  XBT_INFO
  ("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dot, cursor, task) {
    SD_task_dump(task);
  }
Exemplo n.º 7
0
int main(int argc, char **argv)
{
  xbt_dynar_t dot;
  unsigned int cursor;
  SD_task_t task, *dot_as_array=NULL;

  /* SD initialization */
  SD_init(&argc, argv);

  /* Check our arguments */
  xbt_assert(argc > 1, "Usage: %s dot_file", argv[0]);

  /* load the DOT file */
  dot = SD_dotload(argv[1]);

  /* Display all the tasks */
  XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------");
  xbt_dynar_foreach(dot, cursor, task) {
      SD_task_dump(task);
    }
Exemplo n.º 8
0
int main(int argc, char **argv)
{
  double computation_amount[1];
  double communication_amount[2] = { 0 };
  sg_host_t hosts[1];

  /* initialization of SD */
  SD_init(&argc, argv);

  /* creation of the environment */
  SD_create_environment(argv[1]);

  /* creation of a single task that will poorly fail when the workstation will stop */
  XBT_INFO("First test: COMP_SEQ task");
  SD_task_t task = SD_task_create_comp_seq("Poor task", NULL, 2e10);
  SD_task_watch(task, SD_FAILED);
  SD_task_watch(task, SD_DONE);

  XBT_INFO("Schedule task '%s' on 'Faulty Host'", SD_task_get_name(task));

  SD_task_schedulel(task, 1, sg_host_by_name("Faulty Host"));

  xbt_dynar_t tasks = SD_simulate(-1.0);
  xbt_dynar_free(&tasks);

  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 task '%s' and reschedule it on the 'Safe Host'", SD_task_get_name(task));
  SD_task_unschedule(task);
  SD_task_schedulel(task, 1, sg_host_by_name("Safe Host"));

  XBT_INFO("Run the simulation again");
  tasks = SD_simulate(-1.0);
  xbt_dynar_free(&tasks);

  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);
  task=NULL;

  XBT_INFO("Second test: NON TYPED task");

  task = SD_task_create("Poor parallel task", NULL, 2e10);
  SD_task_watch(task, SD_FAILED);
  SD_task_watch(task, SD_DONE);

  computation_amount[0] = 2e10;

  XBT_INFO("Schedule task '%s' on 'Faulty Host'", SD_task_get_name(task));

  hosts[0] = sg_host_by_name("Faulty Host");
  SD_task_schedule(task, 1, hosts, computation_amount, communication_amount,-1);

  tasks = SD_simulate(-1.0);
  xbt_dynar_free(&tasks);

  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 task '%s' and reschedule it on the 'Safe Host'", SD_task_get_name(task));
  SD_task_unschedule(task);

  hosts[0] = sg_host_by_name("Safe Host");

  SD_task_schedule(task, 1, hosts, computation_amount, communication_amount,-1);

  XBT_INFO("Run the simulation again");
  tasks = SD_simulate(-1.0);
  xbt_dynar_free(&tasks);

  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;
}