Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a script to generate a strassen workflow (+cosmetics on other script)
[simgrid.git] / examples / simdag / metaxml / sd_meta.c
1 /*
2    See examples/platforms/metaxml.xml and examples/platforms/metaxml_platform.xml files for examples on how to use the cluster, foreach, set, route:multi, trace and trace:connect tags
3 */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include "simdag/simdag.h"
7 #include "xbt/ex.h"
8 #include "xbt/log.h"
9 #include "xbt/dynar.h"
10 #include "xbt/dict.h"
11 #include "xbt/time.h"
12
13 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
14                              "Logging specific to this SimDag example");
15
16 int main(int argc, char **argv)
17 {
18
19   const char *platform_file;
20   const SD_workstation_t *workstations;
21   int ws_nr;
22   SD_workstation_t w1 = NULL;
23   SD_workstation_t w2 = NULL;
24   const char *name1, *name2;
25   int i, j, k;
26
27   /* initialisation of SD */
28   SD_init(&argc, argv);
29
30   /*  xbt_log_control_set("sd.thres=debug"); */
31
32   if (argc < 2) {
33     INFO1("Usage: %s platform_file", argv[0]);
34     INFO1("example: %s sd_platform.xml", argv[0]);
35     exit(1);
36   }
37
38   /* creation of the environment */
39   platform_file = argv[1];
40   SD_create_environment(platform_file);
41
42   /* test the estimation functions */
43   workstations = SD_workstation_get_list();
44   ws_nr = SD_workstation_get_number();
45
46
47   /* Show routes between all workstation */
48
49   for (i = 0; i < ws_nr; i++) {
50     for (j = 0; j < ws_nr; j++) {
51       const SD_link_t *route;
52       int route_size;
53       w1 = workstations[i];
54       w2 = workstations[j];
55       name1 = SD_workstation_get_name(w1);
56       name2 = SD_workstation_get_name(w2);
57       INFO2("Route between %s and %s:", name1, name2);
58       route = SD_route_get_list(w1, w2);
59       route_size = SD_route_get_size(w1, w2);
60       for (k = 0; k < route_size; k++) {
61         INFO3("\tLink %s: latency = %f, bandwidth = %f",
62               SD_link_get_name(route[k]),
63               SD_link_get_current_latency(route[k]),
64               SD_link_get_current_bandwidth(route[k]));
65       }
66     }
67   }
68
69   SD_exit();
70   return 0;
71 }