Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Biggest commit ever (SIMIX2): the user processes can now run in parallel
[simgrid.git] / src / simix / smurf_private.h
1 /* Copyright (c) 2007, 2008, 2009, 2010. 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 _SIMIX_SMURF_PRIVATE_H
8 #define _SIMIX_SMURF_PRIVATE_H
9
10 /********************************* Requests ***********************************/
11 typedef enum {
12   REQ_HOST_GET_BY_NAME,
13   REQ_HOST_GET_NAME,
14   REQ_HOST_GET_PROPERTIES,
15   REQ_HOST_GET_SPEED,
16   REQ_HOST_GET_AVAILABLE_SPEED,
17   REQ_HOST_GET_STATE,
18   REQ_HOST_GET_DATA,
19   REQ_HOST_SET_DATA,
20   REQ_HOST_EXECUTE,
21   REQ_HOST_PARALLEL_EXECUTE,
22   REQ_HOST_EXECUTION_DESTROY,
23   REQ_HOST_EXECUTION_CANCEL,
24   REQ_HOST_EXECUTION_GET_REMAINS,
25   REQ_HOST_EXECUTION_GET_STATE,
26   REQ_HOST_EXECUTION_SET_PRIORITY,
27   REQ_HOST_EXECUTION_WAIT,
28   REQ_PROCESS_CREATE,
29   REQ_PROCESS_KILL,
30   REQ_PROCESS_CHANGE_HOST,
31   REQ_PROCESS_SUSPEND,
32   REQ_PROCESS_RESUME,
33   REQ_PROCESS_COUNT,
34   REQ_PROCESS_GET_DATA,
35   REQ_PROCESS_SET_DATA,
36   REQ_PROCESS_GET_HOST,
37   REQ_PROCESS_GET_NAME,
38   REQ_PROCESS_IS_SUSPENDED,
39   REQ_PROCESS_GET_PROPERTIES,
40   REQ_PROCESS_SLEEP,
41   REQ_RDV_CREATE,
42   REQ_RDV_DESTROY,
43   REQ_RDV_GEY_BY_NAME,
44   REQ_RDV_COMM_COUNT_BY_HOST,
45   REQ_RDV_GET_HEAD,
46   REQ_COMM_ISEND,
47   REQ_COMM_IRECV,
48   REQ_COMM_DESTROY,
49   REQ_COMM_CANCEL,
50   REQ_COMM_WAITANY,
51   REQ_COMM_WAIT,
52   REQ_COMM_TEST,
53   REQ_COMM_GET_REMAINS,
54   REQ_COMM_GET_STATE,
55   REQ_COMM_GET_DATA,
56   REQ_COMM_GET_SRC_BUFF,
57   REQ_COMM_GET_DST_BUFF,
58   REQ_COMM_GET_SRC_BUFF_SIZE,
59   REQ_COMM_GET_DST_BUFF_SIZE,
60   REQ_COMM_GET_SRC_PROC,
61   REQ_COMM_GET_DST_PROC,
62 #ifdef HAVE_LATENCY_BOUND_TRACKING
63   REQ_COMM_IS_LATENCY_BOUNDED,
64 #endif
65   REQ_MUTEX_INIT,
66   REQ_MUTEX_DESTROY,
67   REQ_MUTEX_LOCK,
68   REQ_MUTEX_TRYLOCK,
69   REQ_MUTEX_UNLOCK,
70   REQ_COND_INIT,
71   REQ_COND_DESTROY,
72   REQ_COND_SIGNAL,
73   REQ_COND_WAIT,
74   REQ_COND_WAIT_TIMEOUT,
75   REQ_COND_BROADCAST,
76   REQ_SEM_INIT,
77   REQ_SEM_DESTROY,
78   REQ_SEM_RELEASE,
79   REQ_SEM_WOULD_BLOCK,
80   REQ_SEM_ACQUIRE,
81   REQ_SEM_ACQUIRE_TIMEOUT,
82   REQ_SEM_GET_CAPACITY
83 } e_smx_req_t;
84
85 typedef struct s_smx_req {
86   s_xbt_swag_hookup_t state_hookup;
87   e_smx_req_t call;
88   smx_process_t issuer;
89
90   union {
91
92     struct {
93       const char *name;
94       smx_host_t result;
95     } host_get_by_name;
96
97     struct {
98       smx_host_t host;
99       const char* result;
100     } host_get_name;
101
102     struct {
103       smx_host_t host;
104       xbt_dict_t result;
105     } host_get_properties;
106
107     struct {
108       smx_host_t host;
109       double result;
110     } host_get_speed;
111
112     struct {
113       smx_host_t host;
114       double result;
115     } host_get_available_speed;
116
117     struct {
118       smx_host_t host;
119       int result;
120     } host_get_state;
121
122     struct {
123       smx_host_t host;
124       void* result;
125     } host_get_data;
126
127     struct {
128       smx_host_t host;
129       void* data;
130     } host_set_data;
131
132     struct {
133       const char* name;
134       smx_host_t host;
135       double computation_amount;
136       smx_action_t result;
137     } host_execute;
138
139     struct {
140       const char *name;
141       int host_nb;
142       smx_host_t *host_list;
143       double *computation_amount;
144       double *communication_amount;
145       double amount;
146       double rate;
147       smx_action_t result;
148     } host_parallel_execute;
149
150     struct {
151       smx_action_t execution;
152     } host_execution_destroy;
153
154     struct {
155       smx_action_t execution;
156     } host_execution_cancel;
157
158     struct {
159       smx_action_t execution;
160       double result;
161     } host_execution_get_remains;
162
163     struct {
164       smx_action_t execution;
165       e_smx_state_t result;
166     } host_execution_get_state;
167
168     struct {
169       smx_action_t execution;
170       double priority;
171     } host_execution_set_priority;
172
173     struct {
174       smx_action_t execution;
175     } host_execution_wait;
176
177     struct {
178       const char *name;
179       xbt_main_func_t code;
180       void *data;
181       const char *hostname;
182       int argc;
183       char **argv;
184       xbt_dict_t properties;
185       smx_process_t result;
186     } process_create;
187
188     struct {
189       smx_process_t process;
190     } process_kill;
191
192     struct {
193       smx_process_t process;
194       const char *source;
195       const char *dest;
196     } process_change_host;
197
198     struct {
199       smx_process_t process;
200     } process_suspend;
201
202     struct {
203       smx_process_t process;
204     } process_resume;
205
206     struct {
207       int result;
208     } process_count;
209
210     struct {
211       smx_process_t process;
212       void* result;
213     } process_get_data;
214
215     struct {
216       smx_process_t process;
217       void* data;
218     } process_set_data;
219
220     struct {
221       smx_process_t process;
222       smx_host_t result;
223     } process_get_host;
224
225     struct {
226       smx_process_t process;
227       const char *result;
228     } process_get_name;
229
230     struct {
231       smx_process_t process;
232       int result;
233     } process_is_suspended;
234
235     struct {
236       smx_process_t process;
237       xbt_dict_t result;
238     } process_get_properties;
239
240     struct {
241       double duration;
242       e_smx_state_t result;
243     } process_sleep;
244
245     struct {
246       const char *name;
247       smx_rdv_t result;
248     } rdv_create;
249
250     struct {
251       smx_rdv_t rdv;
252     } rdv_destroy;
253
254     struct {
255       const char* name;
256       smx_rdv_t result;
257     } rdv_get_by_name;
258     
259     struct {
260       smx_rdv_t rdv;
261       smx_host_t host;
262       unsigned int result; 
263     } rdv_comm_count_by_host;
264
265     struct {
266       smx_rdv_t rdv;
267       smx_action_t result;
268     } rdv_get_head;
269  
270     struct {
271       smx_rdv_t rdv;
272       double task_size;
273       double rate;
274       void *src_buff;
275       size_t src_buff_size;
276       void *data;
277       smx_action_t result;      
278     } comm_isend;
279
280     struct {
281       smx_rdv_t rdv;
282       void *dst_buff;
283       size_t *dst_buff_size;
284       smx_action_t result;
285     } comm_irecv;
286
287     struct {
288       smx_action_t comm;
289     } comm_destroy;
290
291     struct {
292       smx_action_t comm;
293     } comm_cancel;
294  
295     struct {
296       xbt_dynar_t comms;
297       unsigned int result;
298     } comm_waitany;
299  
300     struct {
301       smx_action_t comm;
302       double timeout;
303     } comm_wait;
304
305     struct {
306       smx_action_t comm;
307       int result;
308     } comm_test;
309
310     struct {
311       smx_action_t comm;
312       double result;
313     } comm_get_remains;
314  
315     struct {
316       smx_action_t comm;
317       e_smx_state_t result;
318     } comm_get_state;
319  
320     struct {
321       smx_action_t comm;
322       void *result;    
323     } comm_get_data;
324  
325     struct {
326       smx_action_t comm;
327       void *result;
328     } comm_get_src_buff;
329  
330     struct {
331       smx_action_t comm;
332       void *result;
333     } comm_get_dst_buff;
334     
335     struct {
336       smx_action_t comm;
337       size_t result;
338     } comm_get_src_buff_size;
339     
340     struct {
341       smx_action_t comm;
342       size_t result;
343     } comm_get_dst_buff_size;
344     
345     struct {
346       smx_action_t comm;
347       smx_process_t result;
348     } comm_get_src_proc;
349     
350     struct {
351       smx_action_t comm;
352       smx_process_t result;
353     } comm_get_dst_proc;
354
355 #ifdef HAVE_LATENCY_BOUND_TRACKING
356     struct {
357       smx_action_t comm;
358       int result;
359     } comm_is_latency_bounded;
360 #endif
361
362     struct {
363       smx_mutex_t result;
364     } mutex_init;
365
366     struct {
367       smx_mutex_t mutex;
368     } mutex_lock;
369
370     struct {
371       smx_mutex_t mutex;
372       int result;
373     } mutex_trylock;
374
375     struct {
376       smx_mutex_t mutex;
377     } mutex_unlock;
378
379     struct {
380       smx_mutex_t mutex;
381     } mutex_destroy;
382
383     struct {
384       smx_cond_t result;
385     } cond_init;
386
387     struct {
388       smx_cond_t cond;
389     } cond_destroy;
390
391     struct {
392       smx_cond_t cond;
393     } cond_signal;
394
395     struct {
396       smx_cond_t cond;
397       smx_mutex_t mutex;
398     } cond_wait;
399
400     struct {
401       smx_cond_t cond;
402       smx_mutex_t mutex;
403       double timeout;
404     } cond_wait_timeout;
405
406     struct {
407       smx_cond_t cond;
408     } cond_broadcast;
409
410     struct {
411       int capacity;
412       smx_sem_t result;
413     } sem_init;
414
415     struct {
416       smx_sem_t sem;
417     } sem_destroy;
418
419     struct {
420       smx_sem_t sem;
421     } sem_release;
422
423     struct {
424       smx_sem_t sem;
425       int result;
426     } sem_would_block;
427
428     struct {
429       smx_sem_t sem;
430     } sem_acquire;
431
432     struct {
433       smx_sem_t sem;
434       double timeout;
435     } sem_acquire_timeout;
436
437     struct {
438       smx_sem_t sem;
439       int result;
440     } sem_get_capacity;
441   };
442 } s_smx_req_t, *smx_req_t;
443
444 /******************************** General *************************************/
445
446 void SIMIX_request_init(void);
447 void SIMIX_request_destroy(void);
448 void SIMIX_request_push(smx_req_t);
449 smx_req_t SIMIX_request_pop(void);
450 void SIMIX_request_answer(smx_req_t);
451 void SIMIX_request_pre(smx_req_t);
452 void SIMIX_request_post(smx_action_t);
453 int SIMIX_request_isVisible(smx_req_t req);
454 int SIMIX_request_isEnabled(smx_req_t req);
455 #endif
456