1 /* Copyright (c) 2007-2012. 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 "simdag/simdag.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(incomplete, sd, "SimDag incomplete test");
14 /* SimDag Incomplete Test
16 * - Create a bunch of tasks
17 * - schedule only a subset of them (init, A and D)
18 * - run the simulation
19 * - Verify that we detect which tasks are not scheduled and show their state.
20 * The scheduled task A sends 1GB. Simulation time should be
21 * 1e9/1.25e8 + 1e-4 = 8.0001 seconds
22 * Task D is scheduled but depends on unscheduled task C.
24 int main(int argc, char **argv)
28 SD_task_t taskA, taskB, taskC, taskD;
31 const SD_workstation_t *workstation;
33 double communication_amount1 = 1e9;
36 /* initialization of SD */
39 /* creation of the environment */
40 SD_create_environment(argv[1]);
42 /* creation of the tasks and their dependencies */
43 taskInit = SD_task_create("Init", NULL, 1.0);
44 taskA = SD_task_create("Task A", NULL, 1.0);
45 taskB = SD_task_create("Task B", NULL, 1.0);
46 taskC = SD_task_create("Task C", NULL, 1.0);
47 taskD = SD_task_create("Task D", NULL, 1.0);
50 /* scheduling parameters */
52 workstation = SD_workstation_get_list();
54 SD_task_dependency_add(NULL, NULL, taskInit, taskA);
55 SD_task_dependency_add(NULL, NULL, taskInit, taskB);
56 SD_task_dependency_add(NULL, NULL, taskC, taskD);
58 /* let's launch the simulation! */
59 SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost,
61 SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
62 &communication_amount1, -1.0);
63 SD_task_schedule(taskD, 1, &workstation[0], &no_cost,
64 &communication_amount1, -1.0);
67 ret = SD_simulate(-1.);
69 SD_task_destroy(taskA);
70 SD_task_destroy(taskB);
71 SD_task_destroy(taskC);
72 SD_task_destroy(taskD);
73 SD_task_destroy(taskInit);
75 XBT_INFO("Simulation time: %f", SD_get_clock());