Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f73725d0c7eb1832e60933146bb8de5ca3a24491
[simgrid.git] / teshsuite / simdag / basic6.c
1 /* test scheduling 2 tasks at the same time without artificial dependencies */
2
3 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include "simdag/simdag.h"
12 #include "xbt/log.h"
13
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic6, sd, "SimDag test basic6");
15
16 int main(int argc, char **argv)
17 {
18   double comm_cost[] = { 0.0, 0.0, 0.0, 0.0 };
19   double comp_cost[] = { 1.0 };
20   SD_task_t taskA, taskB;
21   xbt_dynar_t ret;
22
23   SD_init(&argc, argv);
24   SD_create_environment(argv[1]);
25
26   taskA = SD_task_create("Task A", NULL, 1.0);
27   taskB = SD_task_create("Task B", NULL, 1.0);
28
29   SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost,
30                    comm_cost, -1.0);
31   SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost,
32                    comm_cost, -1.0);
33
34   ret = SD_simulate(-1.0);
35   xbt_assert(xbt_dynar_length(ret) == 2,
36       "I was expecting the terminaison of 2 tasks, but I got %lu instead", xbt_dynar_length(ret));
37   xbt_dynar_free(&ret);
38   SD_task_destroy(taskA);
39   SD_task_destroy(taskB);
40
41   XBT_INFO("Simulation time: %f", SD_get_clock());
42
43   SD_exit();
44   return 0;
45 }