1 /* simple test trying to load a DAX file. */
3 /* Copyright (c) 2009 Da SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "simdag/simdag.h"
14 XBT_LOG_NEW_DEFAULT_CATEGORY(test,
15 "Logging specific to this SimDag example");
18 int main(int argc, char **argv) {
23 /* initialisation of SD */
26 /* Check our arguments */
28 INFO1("Usage: %s platform_file dax_file", argv[0]);
29 INFO1("example: %s ../sd_platform.xml Montage_50.xml", argv[0]);
33 /* creation of the environment */
34 SD_create_environment(argv[1]);
36 /* load the DAX file */
37 dax=SD_daxload(argv[2]);
39 /* Display all the tasks */
40 INFO0("------------------- Display all tasks of the loaded DAG ---------------------------");
41 xbt_dynar_foreach(dax,cursor,task) {
45 FILE *out = fopen("dax.dot","w");
46 fprintf(out,"digraph A {\n");
47 xbt_dynar_foreach(dax,cursor,task) {
48 SD_task_dotty(task,out);
53 /* Schedule them all on the first workstation */
54 INFO0("------------------- Schedule tasks ---------------------------");
55 const SD_workstation_t *ws_list = SD_workstation_get_list();
56 xbt_dynar_foreach(dax,cursor,task) {
57 if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ)
58 SD_task_schedulel(task,1,ws_list[0]);
61 INFO0("------------------- Run the schedule ---------------------------");
63 INFO0("------------------- Produce the trace file---------------------------");
64 xbt_dynar_foreach(dax,cursor,task) {
65 int kind = SD_task_get_kind(task);
66 SD_workstation_t *wsl = SD_task_get_workstation_list(task);
68 case SD_TASK_COMP_SEQ:
69 INFO4("[%f] %s compute %f # %s",SD_task_get_start_time(task),
70 SD_workstation_get_name(wsl[0]),SD_task_get_amount(task),
71 SD_task_get_name(task));
73 case SD_TASK_COMM_E2E:
74 INFO5("[%f] %s send %s %f # %s",SD_task_get_start_time(task),
75 SD_workstation_get_name(wsl[0]),SD_workstation_get_name(wsl[1]),
76 SD_task_get_amount(task), SD_task_get_name(task));
77 INFO5("[%f] %s recv %s %f # %s",SD_task_get_start_time(task),
78 SD_workstation_get_name(wsl[1]),SD_workstation_get_name(wsl[0]),
79 SD_task_get_amount(task), SD_task_get_name(task));
82 xbt_die(bprintf("Task %s is of unknown kind %d",SD_task_get_name(task),SD_task_get_kind(task)));