1 /* Copyright (c) 2007-2012, 2014-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "simgrid/simdag.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic3, sd, "SimDag test basic3");
14 /* Basic SimDag Test 3
16 * - Create a chain of tasks (Init, A, Fin)
17 * Verify that the tasks are actually simulated in the right order.
19 int main(int argc, char **argv)
26 /* scheduling parameters */
28 double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
30 /* initialization of SD */
33 /* creation of the environment */
34 SD_create_environment(argv[1]);
36 /* creation of the tasks and their dependencies */
37 taskInit = SD_task_create("Task Init", NULL, 1.0);
38 taskA = SD_task_create("Task A", NULL, 1.0);
39 taskFin = SD_task_create("Task Fin", NULL, 1.0);
41 /* let's launch the simulation! */
42 SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost,
44 SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, no_cost,
46 SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost,
49 SD_task_dependency_add(NULL, NULL, taskInit, taskA);
50 SD_task_dependency_add(NULL, NULL, taskA, taskFin);
53 SD_task_destroy(taskInit);
54 SD_task_destroy(taskA);
55 SD_task_destroy(taskFin);
57 XBT_INFO("Simulation time: %f", SD_get_clock());