Logo AND Algorithmique Numérique Distribuée

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