Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1748f2b42f9fe11075df5fc1949b69b088126a7c
[simgrid.git] / src / surf / workstation.c
1 /* Copyright (c) 2004, 2005, 2006, 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 #include "xbt/ex.h"
8 #include "xbt/dict.h"
9 #include "portable.h"
10 #include "surf_private.h"
11 #include "storage_private.h"
12 #include "surf/surf_resource.h"
13 #include "simgrid/sg_config.h"
14 #include "workstation_private.h"
15 #include "vm_workstation_private.h"
16 #include "cpu_cas01_private.h"
17 #include "maxmin_private.h"
18
19 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf,
20                                 "Logging specific to the SURF workstation module");
21
22 surf_model_t surf_workstation_model = NULL;
23
24
25 static void workstation_new(sg_platf_host_cbarg_t host)
26 {
27   const char *name = host->id;
28
29   /* NOTE: The properties object is NULL, because the current code uses that of
30    * that of a cpu resource. */
31   workstation_CLM03_t ws = (workstation_CLM03_t) surf_resource_new(sizeof(s_workstation_CLM03_t), surf_workstation_model, name, NULL);
32
33   ws->storage = xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
34   ws->net_elm = xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL);
35
36   XBT_DEBUG("Create ws %s with %ld mounted disks", name, xbt_dynar_length(ws->storage));
37   xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, ws);
38 }
39
40
41 static void ws_parallel_action_cancel(surf_action_t action)
42 {
43   THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
44 }
45
46 static int ws_parallel_action_free(surf_action_t action)
47 {
48   THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
49   return -1;
50 }
51
52 int ws_action_unref(surf_action_t action)
53 {
54   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
55     return surf_network_model->action_unref(action);
56   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
57     return action->model_obj->action_unref(action);
58       // previously was: Adrien/Arnaud 6 feb
59           // surf_cpu_model->action_unref(action);
60   else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
61     return ws_parallel_action_free(action);
62   else
63     DIE_IMPOSSIBLE;
64   return 0;
65 }
66
67 void ws_action_cancel(surf_action_t action)
68 {
69   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
70     surf_network_model->action_cancel(action);
71   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
72     action->model_obj->action_cancel(action);
73   else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
74     ws_parallel_action_cancel(action);
75   else
76     DIE_IMPOSSIBLE;
77   return;
78 }
79
80 static void ws_action_state_set(surf_action_t action,
81                                 e_surf_action_state_t state)
82 {
83   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
84     surf_network_model->action_state_set(action, state);
85   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
86     action->model_obj->action_state_set(action, state);
87   else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
88     surf_action_state_set(action, state);
89   else
90     DIE_IMPOSSIBLE;
91   return;
92 }
93
94
95 /* -- The callback functions at model_private -- */
96 /* These callbacks are also used for the vm workstation model. */
97 int ws_resource_used(void *resource_id)
98 {
99   /* This model does not implement parallel tasks */
100   THROW_IMPOSSIBLE;
101   return -1;
102 }
103
104
105 /* TODO: The current code would be slow due to the iteration. Later, we can
106  * make it faster. */
107 static int constraint_is_active(cpu_Cas01_t cpu_cas01)
108 {
109   surf_model_t cpu_model = cpu_cas01->generic_resource.model;
110   lmm_system_t sys = cpu_model->model_private->maxmin_system;
111   int found = 0;
112   lmm_constraint_t cnst_tmp;
113
114   xbt_swag_foreach(cnst_tmp, &sys->active_constraint_set) {
115     if (cnst_tmp == cpu_cas01->constraint) {
116       found = 1;
117       break;
118     }
119   }
120
121   return found;
122 }
123
124 /* Each VM has a dummy CPU action on the PM layer. This CPU action works as the
125  * constraint (capacity) of the VM in the PM layer. If the VM does not have any
126  * active task, the dummy CPU action must be deactivated, so that the VM does
127  * not get any CPU share in the PM layer. */
128 static void adjust_weight_of_dummy_cpu_actions(void)
129 {
130   /* iterate for all hosts including virtual machines */
131   xbt_lib_cursor_t cursor;
132   char *key;
133   void **ind_host;
134
135   xbt_lib_foreach(host_lib, cursor, key, ind_host) {
136     workstation_CLM03_t ws_clm03 = ind_host[SURF_WKS_LEVEL];
137     cpu_Cas01_t cpu_cas01 = ind_host[SURF_CPU_LEVEL];
138
139     if (!ws_clm03)
140       continue;
141     /* skip if it is not a virtual machine */
142     if (ws_clm03->generic_resource.model != surf_vm_workstation_model)
143       continue;
144     xbt_assert(cpu_cas01, "cpu-less workstation");
145
146     /* It is a virtual machine, so we can cast it to workstation_VM2013_t */
147     workstation_VM2013_t ws_vm2013 = (workstation_VM2013_t) ws_clm03;
148
149     if (constraint_is_active(cpu_cas01)) {
150       /* some tasks exist on this VM */
151       XBT_DEBUG("set the weight of the dummy CPU action on PM to 1");
152
153       /* FIXME: we shoud use lmm_update_variable_weight() ? */
154       /* FIXME: If we assgign 1.05 and 0.05, the system makes apparently wrong values. */
155       surf_action_set_priority(ws_vm2013->cpu_action, 1);
156
157     } else {
158       /* no task exits on this VM */
159       XBT_DEBUG("set the weight of the dummy CPU action on PM to 0");
160
161       surf_action_set_priority(ws_vm2013->cpu_action, 0);
162     }
163   }
164 }
165
166
167 double ws_share_resources(surf_model_t workstation_model, double now)
168 {
169   if (workstation_model->type == SURF_MODEL_TYPE_WORKSTATION)
170     adjust_weight_of_dummy_cpu_actions();
171
172   /* Invoke the share_resources() callback of the physical cpu model object and
173    * the network model objects. */
174   surf_model_t cpu_model = workstation_model->extension.workstation.cpu_model;
175   surf_model_t net_model = surf_network_model;
176
177   double min_by_cpu = cpu_model->model_private->share_resources(cpu_model, now);
178   double min_by_net = net_model->model_private->share_resources(net_model, now);
179
180   XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f",
181       workstation_model, cpu_model->name, min_by_cpu, net_model->name, min_by_net);
182
183   if (min_by_cpu >= 0.0 && min_by_net >= 0.0)
184     return min(min_by_cpu, min_by_net);
185   else if (min_by_cpu >= 0.0)
186     return min_by_cpu;
187   else if (min_by_net >= 0.0)
188     return min_by_net;
189   else
190     return min_by_cpu;  /* probably min_by_cpu == min_by_net == -1 */
191 }
192
193 void ws_update_actions_state(surf_model_t workstation_model, double now, double delta)
194 {
195   return;
196 }
197
198 void ws_update_resource_state(void *id, tmgr_trace_event_t event_type, double value, double date)
199 {
200   /* This model does not implement parallel tasks */
201   THROW_IMPOSSIBLE;
202 }
203
204 void ws_finalize(surf_model_t workstation_model)
205 {
206   surf_model_exit(workstation_model);
207   workstation_model = NULL;
208 }
209
210
211
212 surf_action_t ws_execute(void *workstation, double size)
213 {
214   surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
215   return cpu->model->extension.cpu.execute(workstation, size);
216 }
217
218 surf_action_t ws_action_sleep(void *workstation, double duration)
219 {
220   surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
221   return cpu->model->extension.cpu.sleep(workstation, duration);
222 }
223
224 void ws_action_suspend(surf_action_t action)
225 {
226   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
227     surf_network_model->suspend(action);
228   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
229     action->model_obj->suspend(action);
230   else
231     DIE_IMPOSSIBLE;
232 }
233
234 void ws_action_resume(surf_action_t action)
235 {
236   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
237     surf_network_model->resume(action);
238   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
239     action->model_obj->resume(action);
240   else
241     DIE_IMPOSSIBLE;
242 }
243
244 static int ws_action_is_suspended(surf_action_t action)
245 {
246   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
247     return surf_network_model->is_suspended(action);
248   if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
249     return action->model_obj->is_suspended(action);
250   DIE_IMPOSSIBLE;
251   return -1;
252 }
253
254 static void ws_action_set_max_duration(surf_action_t action,
255                                        double duration)
256 {
257   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
258     surf_network_model->set_max_duration(action, duration);
259   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
260     action->model_obj->set_max_duration(action, duration);
261   else
262     DIE_IMPOSSIBLE;
263 }
264
265 void ws_action_set_priority(surf_action_t action, double priority)
266 {
267   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
268     surf_network_model->set_priority(action, priority);
269   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
270     action->model_obj->set_priority(action, priority);
271   else
272     DIE_IMPOSSIBLE;
273 }
274
275 void ws_action_set_bound(surf_action_t action, double bound)
276 {
277   /* FIXME: only for CPU model object? */
278   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
279     surf_network_model->set_bound(action, bound);
280   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
281     action->model_obj->set_bound(action, bound);
282   else
283     DIE_IMPOSSIBLE;
284 }
285
286 #ifdef HAVE_TRACING
287 static void ws_action_set_category(surf_action_t action, const char *category)
288 {
289   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
290     surf_network_model->set_category(action, category);
291   else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
292     action->model_obj->set_category(action, category);
293   else
294     DIE_IMPOSSIBLE;
295 }
296 #endif
297
298 #ifdef HAVE_LATENCY_BOUND_TRACKING
299 static int ws_get_latency_limited(surf_action_t action)
300 {
301   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
302     return surf_network_model->get_latency_limited(action);
303   else
304     return 0;
305 }
306 #endif
307
308 double ws_action_get_remains(surf_action_t action)
309 {
310   if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
311     return surf_network_model->get_remains(action);
312   if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
313     return action->model_obj->get_remains(action);
314   DIE_IMPOSSIBLE;
315   return -1.0;
316 }
317
318 static surf_action_t ws_communicate(void *workstation_src,
319                                     void *workstation_dst, double size,
320                                     double rate)
321 {
322   workstation_CLM03_t src = surf_workstation_resource_priv(workstation_src);
323   workstation_CLM03_t dst = surf_workstation_resource_priv(workstation_dst);
324   return surf_network_model->extension.network.
325       communicate(src->net_elm,
326                   dst->net_elm, size, rate);
327 }
328
329 e_surf_resource_state_t ws_get_state(void *workstation)
330 {
331   surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
332   return cpu->model->extension.cpu.get_state(workstation);
333 }
334
335 double ws_get_speed(void *workstation, double load)
336 {
337   surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
338   return cpu->model->extension.cpu.get_speed(workstation, load);
339 }
340
341 static double ws_get_available_speed(void *workstation)
342 {
343   surf_resource_t cpu = ((surf_resource_t) surf_cpu_resource_priv(workstation));
344   return cpu->model->extension.cpu.get_available_speed(workstation);
345 }
346
347 static surf_action_t ws_execute_parallel_task(int workstation_nb,
348                                               void **workstation_list,
349                                               double *computation_amount,
350                                               double *communication_amount,
351                                               double rate)
352 {
353 #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
354   if ((workstation_nb == 1)
355       && (cost_or_zero(communication_amount, 0) == 0.0))
356     return ws_execute(workstation_list[0], computation_amount[0]);
357   else if ((workstation_nb == 1)
358            && (cost_or_zero(computation_amount, 0) == 0.0))
359     return ws_communicate(workstation_list[0], workstation_list[0],communication_amount[0], rate);
360   else if ((workstation_nb == 2)
361              && (cost_or_zero(computation_amount, 0) == 0.0)
362              && (cost_or_zero(computation_amount, 1) == 0.0)) {
363     int i,nb = 0;
364     double value = 0.0;
365
366     for (i = 0; i < workstation_nb * workstation_nb; i++) {
367       if (cost_or_zero(communication_amount, i) > 0.0) {
368         nb++;
369         value = cost_or_zero(communication_amount, i);
370       }
371     }
372     if (nb == 1)
373       return ws_communicate(workstation_list[0], workstation_list[1],value, rate);
374   }
375 #undef cost_or_zero
376
377   THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
378   return NULL;
379 }
380
381
382 /* returns an array of network_link_CM02_t */
383 static xbt_dynar_t ws_get_route(void *workstation_src, void *workstation_dst)
384 {
385   XBT_DEBUG("ws_get_route");
386   workstation_CLM03_t src = surf_workstation_resource_priv(workstation_src);
387   workstation_CLM03_t dst = surf_workstation_resource_priv(workstation_dst);
388   return surf_network_model->extension.
389       network.get_route(src->net_elm,
390                   dst->net_elm);
391 }
392
393 static double ws_get_link_bandwidth(const void *link)
394 {
395   return surf_network_model->extension.network.get_link_bandwidth(link);
396 }
397
398 static double ws_get_link_latency(const void *link)
399 {
400   return surf_network_model->extension.network.get_link_latency(link);
401 }
402
403 static int ws_link_shared(const void *link)
404 {
405   return surf_network_model->extension.network.link_shared(link);
406 }
407
408 static xbt_dict_t ws_get_properties(const void *ws)
409 {
410   return surf_resource_properties(surf_cpu_resource_priv(ws));
411 }
412
413 static storage_t find_storage_on_mount_list(void *workstation,const char* storage)
414 {
415   storage_t st = NULL;
416   s_mount_t mnt;
417   unsigned int cursor;
418   workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);
419   xbt_dynar_t storage_list = ws->storage;
420
421   XBT_DEBUG("Search for storage name '%s' on '%s'",storage,ws->generic_resource.name);
422   xbt_dynar_foreach(storage_list,cursor,mnt)
423   {
424     XBT_DEBUG("See '%s'",mnt.name);
425     if(!strcmp(storage,mnt.name)){
426       st = mnt.id;
427       break;
428     }
429   }
430   if(!st) xbt_die("Can't find mount '%s' for '%s'",storage,ws->generic_resource.name);
431   return st;
432 }
433
434 static surf_action_t ws_action_open(void *workstation, const char* mount, const char* path, const char* mode)
435 {
436   storage_t st = find_storage_on_mount_list(workstation, mount);
437   XBT_DEBUG("OPEN on disk '%s'",st->generic_resource.name);
438   surf_model_t model = st->generic_resource.model;
439   return model->extension.storage.open(st, mount, path, mode);
440 }
441
442 static surf_action_t ws_action_close(void *workstation, surf_file_t fp)
443 {
444   storage_t st = find_storage_on_mount_list(workstation, fp->storage);
445   XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
446   surf_model_t model = st->generic_resource.model;
447   return model->extension.storage.close(st, fp);
448 }
449
450 static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
451 {
452   storage_t st = find_storage_on_mount_list(workstation, stream->storage);
453   XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
454   surf_model_t model = st->generic_resource.model;
455   return model->extension.storage.read(st, ptr, (double)size, nmemb, stream);
456 }
457
458 static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
459 {
460   storage_t st = find_storage_on_mount_list(workstation, stream->storage);
461   XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
462   surf_model_t model = st->generic_resource.model;
463   return model->extension.storage.write(st,  ptr, size, nmemb, stream);
464 }
465
466 static surf_action_t ws_action_stat(void *workstation, surf_file_t stream)
467 {
468   storage_t st = find_storage_on_mount_list(workstation, stream->storage);
469   XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name);
470   surf_model_t model = st->generic_resource.model;
471   return model->extension.storage.stat(st,  stream);
472 }
473
474 static surf_action_t ws_action_unlink(void *workstation, surf_file_t stream)
475 {
476   storage_t st = find_storage_on_mount_list(workstation, stream->storage);
477   XBT_DEBUG("UNLINK on disk '%s'",st->generic_resource.name);
478   surf_model_t model = st->generic_resource.model;
479   return model->extension.storage.unlink(st,  stream);
480 }
481
482 static surf_action_t ws_action_ls(void *workstation, const char* mount, const char *path)
483 {
484   XBT_DEBUG("LS on mount '%s' and file '%s'",mount, path);
485   storage_t st = find_storage_on_mount_list(workstation, mount);
486   surf_model_t model = st->generic_resource.model;
487   return model->extension.storage.ls(st, path);
488 }
489
490 void ws_get_params(void *ws, ws_params_t params)
491 {
492   workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
493   memcpy(params, &ws_clm03->params, sizeof(s_ws_params_t));
494 }
495
496 void ws_set_params(void *ws, ws_params_t params)
497 {
498   workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
499   /* may check something here. */
500   memcpy(&ws_clm03->params, params, sizeof(s_ws_params_t));
501 }
502
503 static xbt_dynar_t ws_get_vms(void *pm)
504 {
505   xbt_dynar_t dyn = xbt_dynar_new(sizeof(smx_host_t), NULL);
506
507   /* iterate for all hosts including virtual machines */
508   xbt_lib_cursor_t cursor;
509   char *key;
510   void **ind_host;
511   xbt_lib_foreach(host_lib, cursor, key, ind_host) {
512     workstation_CLM03_t ws_clm03 = ind_host[SURF_WKS_LEVEL];
513     if (!ws_clm03)
514       continue;
515     /* skip if it is not a virtual machine */
516     if (ws_clm03->generic_resource.model != surf_vm_workstation_model)
517       continue;
518
519     /* It is a virtual machine, so we can cast it to workstation_VM2013_t */
520     workstation_VM2013_t ws_vm2013 = (workstation_VM2013_t) ws_clm03;
521     if (pm == ws_vm2013->sub_ws)
522       xbt_dynar_push(dyn, &ws_vm2013->sub_ws);
523   }
524
525   return dyn;
526 }
527
528
529 static void surf_workstation_model_init_internal(void)
530 {
531   surf_model_t model = surf_model_init();
532
533   model->name = "Workstation";
534   model->type = SURF_MODEL_TYPE_WORKSTATION;
535   model->action_unref     = ws_action_unref;
536   model->action_cancel    = ws_action_cancel;
537   model->action_state_set = ws_action_state_set;
538
539   model->model_private->resource_used         = ws_resource_used;
540   model->model_private->share_resources       = ws_share_resources;
541   model->model_private->update_actions_state  = ws_update_actions_state;
542   model->model_private->update_resource_state = ws_update_resource_state;
543   model->model_private->finalize              = ws_finalize;
544
545   model->suspend          = ws_action_suspend;
546   model->resume           = ws_action_resume;
547   model->is_suspended     = ws_action_is_suspended;
548   model->set_max_duration = ws_action_set_max_duration;
549   model->set_priority     = ws_action_set_priority;
550   model->set_bound        = ws_action_set_bound;
551   #ifdef HAVE_TRACING
552   model->set_category     = ws_action_set_category;
553   #endif
554   model->get_remains      = ws_action_get_remains;
555   #ifdef HAVE_LATENCY_BOUND_TRACKING
556   model->get_latency_limited = ws_get_latency_limited;
557   #endif
558
559   /* For VM support, we have a surf cpu model object for each workstation model
560    * object. The physical workstation model object has the cpu model object of
561    * the physical machine layer. */
562   xbt_assert(surf_cpu_model_pm);
563   model->extension.workstation.cpu_model = surf_cpu_model_pm;
564
565   model->extension.workstation.execute   = ws_execute;
566   model->extension.workstation.sleep     = ws_action_sleep;
567   model->extension.workstation.get_state = ws_get_state;
568   model->extension.workstation.get_speed = ws_get_speed;
569   model->extension.workstation.get_available_speed = ws_get_available_speed;
570
571   model->extension.workstation.communicate           = ws_communicate;
572   model->extension.workstation.get_route             = ws_get_route;
573   model->extension.workstation.execute_parallel_task = ws_execute_parallel_task;
574   model->extension.workstation.get_link_bandwidth    = ws_get_link_bandwidth;
575   model->extension.workstation.get_link_latency      = ws_get_link_latency;
576   model->extension.workstation.link_shared           = ws_link_shared;
577   model->extension.workstation.get_properties        = ws_get_properties;
578
579   model->extension.workstation.open   = ws_action_open;
580   model->extension.workstation.close  = ws_action_close;
581   model->extension.workstation.read   = ws_action_read;
582   model->extension.workstation.write  = ws_action_write;
583   model->extension.workstation.stat   = ws_action_stat;
584   model->extension.workstation.unlink = ws_action_unlink;
585   model->extension.workstation.ls     = ws_action_ls;
586
587   model->extension.workstation.get_params = ws_get_params;
588   model->extension.workstation.set_params = ws_set_params;
589   model->extension.workstation.get_vms    = ws_get_vms;
590
591   surf_workstation_model = model;
592 }
593
594 void surf_workstation_model_init_current_default(void)
595 {
596   xbt_cfg_setdefault_int(_sg_cfg_set, "network/crosstraffic", 1);
597   surf_cpu_model_init_Cas01();
598   surf_network_model_init_LegrandVelho();
599
600   /* surf_cpu_mode_pm and surf_network_model must be initialized in advance. */
601   xbt_assert(surf_cpu_model_pm);
602   xbt_assert(surf_network_model);
603   surf_workstation_model_init_internal();
604
605   xbt_dynar_push(model_list, &surf_workstation_model);
606   xbt_dynar_push(model_list_invoke, &surf_workstation_model);
607   sg_platf_host_add_cb(workstation_new);
608 }
609
610 void surf_workstation_model_init_compound()
611 {
612   xbt_assert(surf_cpu_model_pm, "No CPU model defined yet!");
613   xbt_assert(surf_network_model, "No network model defined yet!");
614
615   surf_workstation_model_init_internal();
616   xbt_dynar_push(model_list, &surf_workstation_model);
617   xbt_dynar_push(model_list_invoke, &surf_workstation_model);
618   sg_platf_host_add_cb(workstation_new);
619 }