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"); */
33 XBT_INFO("Usage: %s platform_file", argv[0]);
34 XBT_INFO("example: %s sd_platform.xml", argv[0]);
38 /* creation of the environment */
39 platform_file = argv[1];
40 SD_create_environment(platform_file);
42 /* Change the access mode of the workstations */
43 workstations = SD_workstation_get_list();
47 /* creation of the tasks and their dependencies */
48 taskA = SD_task_create_comp_seq("Task A", NULL, 2e9);
49 taskB = SD_task_create_comm_e2e("Task B", NULL, 2e9);
50 taskC = SD_task_create_comp_seq("Task C", NULL, 1e9);
51 TRACE_category ("taskA");
52 TRACE_category ("taskB");
53 TRACE_category ("taskC");
54 TRACE_sd_set_task_category (taskA, "taskA");
55 TRACE_sd_set_task_category (taskB, "taskB");
56 TRACE_sd_set_task_category (taskC, "taskC");
58 /* scheduling parameters */
59 workstation_list[0] = w1;
60 workstation_list[1] = w2;
61 computation_amount[0] = SD_task_get_amount(taskA);
62 computation_amount[1] = SD_task_get_amount(taskB);
64 communication_amount[1] = SD_task_get_amount(taskC);
65 communication_amount[2] = 0.0;
67 SD_task_schedule(taskA, 1, &w1,
68 &(computation_amount[0]), SD_SCHED_NO_COST, rate);
69 SD_task_schedule(taskB, 2, workstation_list,
70 SD_SCHED_NO_COST, communication_amount, rate);
71 SD_task_schedule(taskC, 1, &w1,
72 &(computation_amount[1]), SD_SCHED_NO_COST, rate);
74 /* let's launch the simulation! */
77 XBT_DEBUG("Destroying tasks...");
79 SD_task_destroy(taskA);
80 SD_task_destroy(taskB);
81 SD_task_destroy(taskC);
83 XBT_DEBUG("Tasks destroyed. Exiting SimDag...");