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(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;
30 const sg_host_t *workstation;
32 double communication_amount1 = 1e9;
35 /* initialization of SD */
38 /* creation of the environment */
39 SD_create_environment(argv[1]);
41 /* creation of the tasks and their dependencies */
42 taskInit = SD_task_create("Init", NULL, 1.0);
43 taskA = SD_task_create("Task A", NULL, 1.0);
44 taskB = SD_task_create("Task B", NULL, 1.0);
45 taskC = SD_task_create("Task C", NULL, 1.0);
46 taskD = SD_task_create("Task D", NULL, 1.0);
49 /* scheduling parameters */
51 workstation = sg_host_list();
53 SD_task_dependency_add(NULL, NULL, taskInit, taskA);
54 SD_task_dependency_add(NULL, NULL, taskInit, taskB);
55 SD_task_dependency_add(NULL, NULL, taskC, taskD);
57 /* let's launch the simulation! */
58 SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
60 SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
61 &communication_amount1, -1.0);
62 SD_task_schedule(taskD, 1, &workstation[0], &no_cost,
63 &communication_amount1, -1.0);
67 SD_task_destroy(taskA);
68 SD_task_destroy(taskB);
69 SD_task_destroy(taskC);
70 SD_task_destroy(taskD);
71 SD_task_destroy(taskInit);
73 XBT_INFO("Simulation time: %f", SD_get_clock());