Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We switched to SVN
[simgrid.git] / examples / simdag / mixtesim / include / mixtesim_datastructures.h
1 #ifndef MIXTESIM_DATASTRUCTURES_H
2 #define MIXTESIM_DATASTRUCTURES_H
3
4 #include "simdag/simdag.h"
5 #include "mixtesim_types.h"
6
7 /* NODE structure */
8 struct _Node {
9   /* nodes that must complete before this node can start */
10   int nb_parents;
11   Node *parents; /* array of size nb_parents */
12
13   /* nodes that cannot start until this node has completed */
14   int nb_children;
15   Node *children; /* array of size nb_children */
16
17   /* index of this node in the DAG->nodes array */
18   int global_index;
19
20   node_t type;       /* node type: TRANSFER or COMMUNICATION */
21
22   double cost;       /* cost of the computation        */
23                      /* or file transfer on a resource */
24   
25   /* Pointer to the SIMGRID Task that will
26    * be used for the simulation. The abstract task should
27    * be created upon creation of this node, and will be
28    * de-allocated when SG_shutdown() is called
29    */
30   SD_task_t sd_task;
31
32   void *metadata; /* For use by the scheduling algorithms */
33 };
34
35 Node newNode();  /* Allocates memory for a node */
36 void freeNode(); /* Free memory for a node */
37 void printNode(DAG dag, Node node); /* print node info */
38
39 /* DAG structure */
40 struct _DAG {
41   Node root;    /* first node */
42   Node end;     /* last node */
43
44   /* Array of nodes, for direct access */
45   int nb_nodes;
46   Node *nodes; /* array of size nb_nodes */
47 };
48
49 DAG parseDAGFile(char *filename); /* Construct a DAG from a */
50                                   /* DAG description file   */
51 DAG newDAG(); /* allocate memory for a DAG, called by parseDAGFile() */
52 void freeDAG(DAG dag); /* free memory for a DAG */
53 void printDAG(DAG dag); /* prints DAG info */
54
55 /* /\* HOST structure *\/ */
56 /* struct _Host { */
57 /*   /\* index in the Grid->hosts array *\/ */
58 /*   int global_index; */
59
60 /*    /\* in which cluster this host is *\/ */
61 /*   int cluster; */
62
63 /*   /\* relative speed of the host *\/ */
64 /*   double rel_speed; */
65 /*   /\* Pointer to the SIMGRID Resource that will be used */
66 /*    * for the simulation. The resource should be created upon  */
67 /*    * creation of this host, and will be de-allocated when */
68 /*    * SG_shutdown() is called */
69 /*    *\/ */
70 /*   /\*  char *cpu_trace;*\/ */
71
72 /*   void *metadata; */
73
74 /*   /\*  SG_resourcesharing_t mode;*\/ */
75
76 /*   SD_workstation_t sd_host; */
77 /* }; */
78
79 /* Host newHost(); /\* Allocate memory for a host *\/ */
80 /* void freeHost(Host h); /\* free memory for a host *\/ */
81
82
83 /* /\* LINK structure *\/ */
84 /* struct _Link { */
85 /*   /\* index of this link in the Grid->links array *\/ */
86 /*   int global_index; */
87 /*   /\* Pointer to the SIMGRID Resource that will be used */
88 /*    * for the simulation. The resource shouild be created upon  */
89 /*    * creation of this host, and will be de-allocated when */
90 /*    * SG_shutdown() is called */
91 /*    *\/ */
92 /*   /\*  char *latency_trace; */
93 /*       char *bandwidth_trace;*\/ */
94
95 /*   /\*  SG_resourcesharing_t mode;*\/ */
96
97 /*   SD_link_t sd_link; */
98 /* }; */
99
100 /* Link newLink(); /\* Allocate memory for a link *\/ */
101 /* void freeLink(Link l); /\* free memory for a link *\/ */
102
103 /* GRID structure */
104 /* struct _Grid { */
105 /*   int nb_hosts; /\* Number of hosts in the Grid *\/ */
106 /*   Host *hosts;  /\* array of size nb_hosts      *\/ */
107 /*   int nb_links; /\* Number of links in the Grid *\/ */
108 /*   Link *links;  /\* array of size nb_links      *\/ */
109
110 /*   /\* connection matrix. connections[i][j] is a pointer */
111 /*    * to the network link that connects hosts of */
112 /*    * global_index i and j, that is grid->hosts[i] */
113 /*    * and grid->hosts[j]. This matrix is likely to */
114 /*    * be symetric since we probably assume that links */
115 /*    * behave the same way in both directions. Note that */
116 /*    * simulating non-bi-directional performance characteristics */
117 /*    * would not be trivial as two separate links would not */
118 /*    * model any contention between traffic going both ways */
119 /*    *\/ */
120 /*   /\*  SG_Resource **routes;*\/ */
121 /*   /\*  SD_link_t **connections;*\/ */
122 /* }; */
123
124 /* Grid parseGridFile(char *filename); /\* Creates a Grid from a *\/ */
125 /*                                     /\* Grid description file *\/ */
126 /* Grid newGrid();  /\* Allocates memory for a Grid *\/ */
127 /* void freeGrid(); /\* frees memory of a Grid. free Hosts and Links *\/ */
128 /* void printGrid(Grid grid); /\* print Grid info *\/ */
129
130
131 #endif /* MIXTESIM_DATA_STRUCTURES */