1 /* Copyright (c) 2006-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"
13 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_seq_access,
14 "Logging specific to this SimDag example");
16 int main(int argc, char **argv)
18 const char *platform_file;
19 const SD_workstation_t *workstations;
20 SD_task_t taskA, taskB, taskC;
21 SD_workstation_t workstation_list[2];
22 double computation_amount[2];
23 double communication_amount[4] = { 0 };
25 SD_workstation_t w1, w2;
27 /* SD initialization */
30 /* xbt_log_control_set("sd.thres=debug"); */
32 xbt_assert(argc > 1, "Usage: %s platform_file\n"
33 "\nExample: %s two_clusters.xml", argv[0], argv[0]);
35 /* creation of the environment */
36 platform_file = argv[1];
37 SD_create_environment(platform_file);
39 /* Change the access mode of the workstations */
40 workstations = SD_workstation_get_list();
44 /* creation of the tasks and their dependencies */
45 taskA = SD_task_create_comp_seq("Task A", NULL, 2e9);
46 taskB = SD_task_create_comm_e2e("Task B", NULL, 2e9);
47 taskC = SD_task_create_comp_seq("Task C", NULL, 1e9);
48 TRACE_category ("taskA");
49 TRACE_category ("taskB");
50 TRACE_category ("taskC");
51 TRACE_sd_set_task_category (taskA, "taskA");
52 TRACE_sd_set_task_category (taskB, "taskB");
53 TRACE_sd_set_task_category (taskC, "taskC");
55 /* scheduling parameters */
56 workstation_list[0] = w1;
57 workstation_list[1] = w2;
58 computation_amount[0] = SD_task_get_amount(taskA);
59 computation_amount[1] = SD_task_get_amount(taskB);
61 communication_amount[1] = SD_task_get_amount(taskC);
62 communication_amount[2] = 0.0;
64 SD_task_schedule(taskA, 1, &w1,
65 &(computation_amount[0]), SD_SCHED_NO_COST, rate);
66 SD_task_schedule(taskB, 2, workstation_list,
67 SD_SCHED_NO_COST, communication_amount, rate);
68 SD_task_schedule(taskC, 1, &w1,
69 &(computation_amount[1]), SD_SCHED_NO_COST, rate);
71 /* let's launch the simulation! */
74 XBT_DEBUG("Destroying tasks...");
76 SD_task_destroy(taskA);
77 SD_task_destroy(taskB);
78 SD_task_destroy(taskC);
80 XBT_DEBUG("Tasks destroyed. Exiting SimDag...");