Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merging changes done by Steven, Samuel and Luka, regarding simulation of StarPU-MPI
[simgrid.git] / include / simgrid / forward.h
1 /* Copyright (c) 2004-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #ifndef SG_PLATF_TYPES_H
8 #define SG_PLATF_TYPES_H
9
10 #include <xbt.h>
11
12 #ifdef __cplusplus
13
14 namespace simgrid {
15 namespace surf {
16
17 class Cpu;
18 class RoutingEdge;
19 class As;
20 class Link;
21
22 }
23 }
24
25 typedef simgrid::surf::Cpu surf_Cpu;
26 typedef simgrid::surf::RoutingEdge surf_RoutingEdge;
27 typedef simgrid::surf::As surf_As;
28 typedef simgrid::surf::Link Link;
29
30 #else
31
32 typedef struct surf_Cpu surf_Cpu;
33 typedef struct surf_RoutingEdge surf_RoutingEdge;
34 typedef struct surf_As surf_As;
35 typedef struct Link Link;
36
37 #endif
38
39 typedef surf_Cpu *surf_cpu_t;
40 typedef surf_RoutingEdge *routing_edge_t;
41 typedef surf_RoutingEdge *sg_routing_edge_t;
42 typedef surf_As *AS_t;
43
44 // Types which are in fact dictelmt:
45
46 typedef xbt_dictelm_t sg_host_t;
47 typedef xbt_dictelm_t sg_storage_t;
48
49
50 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
51
52 typedef void *sg_routing_link_t; /* FIXME:The actual type is model-dependent so use void* instead*/
53
54 /** @ingroup SURF_interface
55 * @brief Defines whether a given resource is working or not */
56 typedef enum {
57   SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
58   SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
59 } e_surf_resource_state_t;
60
61 typedef enum {
62   SURF_LINK_FULLDUPLEX = 2,
63   SURF_LINK_SHARED = 1,
64   SURF_LINK_FATPIPE = 0
65 } e_surf_link_sharing_policy_t;
66
67 typedef enum {
68   SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4,
69   SURF_TRACE_CONNECT_KIND_POWER = 3,
70   SURF_TRACE_CONNECT_KIND_LINK_AVAIL = 2,
71   SURF_TRACE_CONNECT_KIND_BANDWIDTH = 1,
72   SURF_TRACE_CONNECT_KIND_LATENCY = 0
73 } e_surf_trace_connect_kind_t;
74
75 typedef enum {
76   SURF_PROCESS_ON_FAILURE_DIE = 1,
77   SURF_PROCESS_ON_FAILURE_RESTART = 0
78 } e_surf_process_on_failure_t;
79
80 typedef enum {
81   SURF_CLUSTER_FAT_TREE=2,
82   SURF_CLUSTER_FLAT = 1,
83   SURF_CLUSTER_TORUS = 0
84 } e_surf_cluster_topology_t;
85
86
87 /** @ingroup m_datatypes_management_details
88  * @brief Type for any simgrid size
89  */
90 typedef unsigned long long sg_size_t;
91
92 /** @ingroup m_datatypes_management_details
93  * @brief Type for any simgrid offset
94  */
95 typedef long long sg_offset_t;
96
97 /*
98  * Platform creation functions. Instead of passing 123 arguments to the creation functions
99  * (one for each possible XML attribute), we pass structures containing them all. It removes the
100  * chances of switching arguments by error, and reduce the burden when we add a new attribute:
101  * old models can just continue to ignore it without having to update their headers.
102  *
103  * It shouldn't be too costly at runtime, provided that structures living on the stack are
104  * used, instead of malloced structures.
105  */
106
107 typedef struct {
108   const char* id;
109   xbt_dynar_t speed_peak;
110   int pstate;
111   int core_amount;
112   double speed_scale;
113   tmgr_trace_t speed_trace;
114   e_surf_resource_state_t initial_state;
115   tmgr_trace_t state_trace;
116   const char* coord;
117   xbt_dict_t properties;
118 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
119
120 #define SG_PLATF_HOST_INITIALIZER { \
121     NULL, 0, 1, 1, 1., NULL, SURF_RESOURCE_ON, NULL, \
122     NULL, NULL \
123 }
124
125 typedef struct {
126   const char* id;
127   const char* link_up;
128   const char* link_down;
129 } s_sg_platf_host_link_cbarg_t, *sg_platf_host_link_cbarg_t;
130
131 #define SG_PLATF_HOST_LINK_INITIALIZER {NULL,NULL,NULL}
132
133 typedef struct {
134   const char* id;
135   const char* coord;
136 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
137
138 #define SG_PLATF_ROUTER_INITIALIZER {NULL,NULL}
139
140 typedef struct {
141   const char* id;
142   double bandwidth;
143   tmgr_trace_t bandwidth_trace;
144   double latency;
145   tmgr_trace_t latency_trace;
146   e_surf_resource_state_t state;
147   tmgr_trace_t state_trace;
148   e_surf_link_sharing_policy_t policy;
149   xbt_dict_t properties;
150 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
151
152 #define SG_PLATF_LINK_INITIALIZER {\
153   NULL, 0., NULL, 0., NULL, SURF_RESOURCE_ON, \
154   NULL, SURF_LINK_SHARED, NULL \
155 }
156
157 typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t;
158 typedef struct s_sg_platf_peer_cbarg {
159   const char* id;
160   double speed;
161   double bw_in;
162   double bw_out;
163   double lat;
164   const char* coord;
165   tmgr_trace_t availability_trace;
166   tmgr_trace_t state_trace;
167 } s_sg_platf_peer_cbarg_t;
168
169 #define SG_PLATF_PEER_INITIALIZER {NULL,0.0,0.0,0.0,0.0,NULL,NULL,NULL}
170
171 typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t;
172 typedef struct s_sg_platf_route_cbarg {
173   int symmetrical;
174   const char *src;
175   const char *dst;
176   sg_routing_edge_t gw_src;
177   sg_routing_edge_t gw_dst;
178   xbt_dynar_t link_list;
179 } s_sg_platf_route_cbarg_t;
180
181 #define SG_PLATF_ROUTE_INITIALIZER {1,NULL,NULL,NULL,NULL,NULL}
182
183 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
184 typedef struct s_sg_platf_cluster_cbarg {
185   const char* id;
186   const char* prefix;
187   const char* suffix;
188   const char* radical;
189   double speed;
190   int core_amount;
191   double bw;
192   double lat;
193   double bb_bw;
194   double bb_lat;
195   double loopback_bw;
196   double loopback_lat;
197   double limiter_link;
198   e_surf_cluster_topology_t topology;
199   const char* topo_parameters;
200   xbt_dict_t properties;
201   const char* router_id;
202   e_surf_link_sharing_policy_t sharing_policy;
203   e_surf_link_sharing_policy_t bb_sharing_policy;
204   const char* availability_trace; //don't convert to tmgr_trace_t since there is a trace per host and some rewriting is needed
205   const char* state_trace;
206 } s_sg_platf_cluster_cbarg_t;
207
208 #define SG_PLATF_CLUSTER_INITIALIZER {NULL,NULL,NULL,NULL,0.0,1 \
209   ,1.,1.,0.,0.,0.,0.,0. \
210   ,SURF_CLUSTER_FLAT,NULL,NULL,NULL, \
211   SURF_LINK_SHARED,SURF_LINK_SHARED,NULL \
212   ,NULL}
213
214 typedef struct s_sg_platf_cabinet_cbarg *sg_platf_cabinet_cbarg_t;
215 typedef struct s_sg_platf_cabinet_cbarg {
216   const char* id;
217   const char* prefix;
218   const char* suffix;
219   const char* radical;
220   double speed;
221   double bw;
222   double lat;
223 } s_sg_platf_cabinet_cbarg_t;
224
225 #define SG_PLATF_CABINET_INITIALIZER {NULL,NULL,NULL,NULL,0.0,0.0,0.0}
226
227 typedef struct {
228   const char* id;
229   const char* type_id;
230   const char* content;
231   const char* content_type;
232   xbt_dict_t properties;
233   const char* attach;
234 } s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
235
236 #define SG_PLATF_STORAGE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL}
237
238 typedef struct {
239   const char* id;
240   const char* model;
241   const char* content;
242   const char* content_type;
243   xbt_dict_t properties;
244   xbt_dict_t model_properties;
245   sg_size_t size;
246 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
247
248 #define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL}
249
250 typedef struct {
251   const char* type_id;
252   const char* name;
253 } s_sg_platf_mstorage_cbarg_t, *sg_platf_mstorage_cbarg_t;
254
255 #define SG_PLATF_MSTORAGE_INITIALIZER {NULL,NULL}
256
257 typedef struct {
258   const char* storageId;
259   const char* name;
260 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
261
262 #define SG_PLATF_MOUNT_INITIALIZER {NULL,NULL}
263
264 typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
265 typedef struct s_sg_platf_prop_cbarg {
266   const char *id;
267   const char *value;
268 } s_sg_platf_prop_cbarg_t;
269
270 #define SG_PLATF_PROP_INITIALIZER {NULL,NULL}
271
272 typedef struct s_sg_platf_trace_cbarg *sg_platf_trace_cbarg_t;
273 typedef struct s_sg_platf_trace_cbarg {
274   const char *id;
275   const char *file;
276   double periodicity;
277   const char *pc_data;
278 } s_sg_platf_trace_cbarg_t;
279
280 #define SG_PLATF_TRACE_INITIALIZER {NULL,NULL,0.0,NULL}
281
282 typedef struct s_sg_platf_trace_connect_cbarg *sg_platf_trace_connect_cbarg_t;
283 typedef struct s_sg_platf_trace_connect_cbarg {
284   e_surf_trace_connect_kind_t kind;
285   const char *trace;
286   const char *element;
287 } s_sg_platf_trace_connect_cbarg_t;
288
289 #define SG_PLATF_TRACE_CONNECT_INITIALIZER {SURF_TRACE_CONNECT_KIND_LATENCY,NULL,NULL}
290
291 typedef struct s_sg_platf_process_cbarg *sg_platf_process_cbarg_t;
292 typedef struct s_sg_platf_process_cbarg {
293   const char **argv;
294   int argc;
295   xbt_dict_t properties;
296   const char *host;
297   const char *function;
298   double start_time;
299   double kill_time;
300   e_surf_process_on_failure_t on_failure;
301 } s_sg_platf_process_cbarg_t;
302
303 #define SG_PLATF_PROCESS_INITIALIZER {NULL,0,NULL,NULL,NULL,-1.0,-1.0,SURF_PROCESS_ON_FAILURE_DIE}
304
305 typedef struct s_sg_platf_AS_cbarg *sg_platf_AS_cbarg_t;
306 typedef struct s_sg_platf_AS_cbarg {
307   const char *id;
308   int routing;
309 } s_sg_platf_AS_cbarg_t;
310
311 #define SG_PLATF_AS_INITIALIZER {NULL,0}
312
313 /** opaque structure defining a event generator for availability based on a probability distribution */
314 typedef struct probabilist_event_generator *probabilist_event_generator_t;
315
316 #endif