Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old $Id$ command dating from CVS
[simgrid.git] / teshsuite / simdag / basic0.c
1 /* Copyright (c) 2007, 2008 The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include "simdag/simdag.h"
9
10 int main(int argc, char **argv)
11 {
12
13   SD_task_t taskInit;
14   SD_task_t taskA;
15   SD_task_t taskB;
16
17   /* scheduling parameters */
18
19   double communication_amount1[] = { 0, 100000000, 0, 0 };
20   double communication_amount2[] = { 0, 1, 0, 0 };
21   const double no_cost[] = { 0.0, 0.0 };
22
23   /* initialisation of SD */
24   SD_init(&argc, argv);
25
26   /* creation of the environment */
27   SD_create_environment(argv[1]);
28
29   /* creation of the tasks and their dependencies */
30   taskInit = SD_task_create("Init", NULL, 1.0);
31   taskA = SD_task_create("Task Comm 1", NULL, 1.0);
32   taskB = SD_task_create("Task Comm 2", NULL, 1.0);
33
34
35
36
37   /* let's launch the simulation! */
38
39   SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost,
40                    -1.0);
41   SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost,
42                    communication_amount1, -1.0);
43   SD_task_schedule(taskB, 2, SD_workstation_get_list(), no_cost,
44                    communication_amount2, -1.0);
45
46   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
47   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
48
49   SD_simulate(-1.0);
50
51   SD_exit();
52   return 0;
53 }