Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Remove sg_platf_prop_cb
[simgrid.git] / src / surf / sg_platf.cpp
1 /* Copyright (c) 2006-2014. 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/misc.h"
8 #include "xbt/log.h"
9 #include "xbt/str.h"
10 #include "xbt/dict.h"
11 #include "xbt/RngStream.h"
12 #include "simgrid/platf_interface.h"
13 #include "surf/surf_routing.h"
14 #include "surf/surf.h"
15
16 #include "src/simix/smx_private.h"
17
18 #include "cpu_interface.hpp"
19 #include "host_interface.hpp"
20
21 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
22 xbt_dynar_t sg_platf_link_cb_list = NULL;   // of sg_platf_link_cb_t
23 xbt_dynar_t sg_platf_cluster_cb_list = NULL; // of sg_platf_cluster_cb_t
24 xbt_dynar_t sg_platf_cabinet_cb_list = NULL; // of sg_platf_cluster_cb_t
25 xbt_dynar_t sg_platf_postparse_cb_list = NULL; // of void_f_void_t
26
27 xbt_dynar_t sg_platf_ASroute_cb_list = NULL; // of sg_platf_ASroute_cb_t
28 xbt_dynar_t sg_platf_bypassRoute_cb_list = NULL; // of sg_platf_bypassRoute_cb_t
29 xbt_dynar_t sg_platf_bypassASroute_cb_list = NULL; // of sg_platf_bypassASroute_cb_t
30
31 xbt_dynar_t sg_platf_trace_cb_list = NULL;
32 xbt_dynar_t sg_platf_trace_connect_cb_list = NULL;
33
34 /* ***************************************** */
35 /* TUTORIAL: New TAG                         */
36
37 xbt_dynar_t sg_platf_gpu_cb_list = NULL;
38 /* ***************************************** */
39
40
41 static int surf_parse_models_setup_already_called = 0;
42
43 /* one RngStream for the platform, to respect some statistic rules */
44 static RngStream sg_platf_rng_stream = NULL;
45
46 /** Module management function: creates all internal data structures */
47 void sg_platf_init(void) {
48
49   //FIXME : Ugly, but useful...
50   if (sg_platf_gpu_cb_list)
51     return; //Already initialized, so do nothing...
52
53   sg_platf_link_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t), NULL);
54   sg_platf_cluster_cb_list = xbt_dynar_new(sizeof(sg_platf_cluster_cb_t), NULL);
55   sg_platf_cabinet_cb_list = xbt_dynar_new(sizeof(sg_platf_cabinet_cb_t), NULL);
56   sg_platf_postparse_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t),NULL);
57
58   sg_platf_ASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
59   sg_platf_bypassRoute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
60   sg_platf_bypassASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
61
62   sg_platf_trace_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_cb_t), NULL);
63   sg_platf_trace_connect_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_connect_cb_t), NULL);
64
65   /* ***************************************** */
66   /* TUTORIAL: New TAG                         */
67
68   sg_platf_gpu_cb_list = xbt_dynar_new(sizeof(sg_platf_gpu_cb_t), NULL);
69   /* ***************************************** */
70 }
71 /** Module management function: frees all internal data structures */
72 void sg_platf_exit(void) {
73   xbt_dynar_free(&sg_platf_link_cb_list);
74   xbt_dynar_free(&sg_platf_postparse_cb_list);
75   xbt_dynar_free(&sg_platf_cluster_cb_list);
76   xbt_dynar_free(&sg_platf_cabinet_cb_list);
77
78   xbt_dynar_free(&sg_platf_trace_cb_list);
79   xbt_dynar_free(&sg_platf_trace_connect_cb_list);
80
81   xbt_dynar_free(&sg_platf_ASroute_cb_list);
82   xbt_dynar_free(&sg_platf_bypassRoute_cb_list);
83   xbt_dynar_free(&sg_platf_bypassASroute_cb_list);
84
85   /* ***************************************** */
86   /* TUTORIAL: New TAG                         */
87
88   xbt_dynar_free(&sg_platf_gpu_cb_list);
89
90   /* ***************************************** */
91
92   /* make sure that we will reinit the models while loading the platf once reinited */
93   surf_parse_models_setup_already_called = 0;
94 }
95
96 void sg_platf_new_host(sg_platf_host_cbarg_t host)
97 {
98   xbt_assert(! sg_host_by_name(host->id),
99                      "Refusing to create a second host named '%s'.", host->id);
100
101   RoutingEdge *net = NULL;
102   As* current_routing = routing_get_current();
103   if (current_routing)
104     net = routing_add_host(current_routing, host);
105
106   Cpu *cpu = surf_cpu_model_pm->createCpu(
107         host->id,
108         host->power_peak,
109         host->pstate,
110         host->power_scale,
111         host->power_trace,
112         host->core_amount,
113         host->initial_state,
114         host->state_trace,
115         host->properties);
116   surf_host_model->createHost(host->id, net, cpu);
117
118   if (TRACE_is_enabled() && TRACE_needs_platform())
119     sg_instr_new_host(host);
120 }
121
122 /**
123  * \brief Add a "router" to the network element list
124  */
125 void sg_platf_new_router(sg_platf_router_cbarg_t router)
126 {
127   As* current_routing = routing_get_current();
128
129   if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
130     current_routing->p_hierarchy = SURF_ROUTING_BASE;
131   xbt_assert(!xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL),
132              "Reading a router, processing unit \"%s\" already exists",
133              router->id);
134
135   RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(router->id),
136                                             -1,
137                                             SURF_NETWORK_ELEMENT_ROUTER,
138                                             current_routing);
139   info->setId(current_routing->parsePU(info));
140   xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) info);
141   XBT_DEBUG("Having set name '%s' id '%d'", router->id, info->getId());
142   routingEdgeCreatedCallbacks(info);
143
144   if (router->coord && strcmp(router->coord, "")) {
145     unsigned int cursor;
146     char*str;
147
148     if (!COORD_ASR_LEVEL)
149       xbt_die ("To use host coordinates, please add --cfg=network/coordinates:yes to your command line");
150     /* Pre-parse the host coordinates */
151     xbt_dynar_t ctn_str = xbt_str_split_str(router->coord, " ");
152     xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);
153     xbt_dynar_foreach(ctn_str,cursor, str) {
154       double val = atof(str);
155       xbt_dynar_push(ctn,&val);
156     }
157     xbt_dynar_shrink(ctn, 0);
158     xbt_dynar_free(&ctn_str);
159     xbt_lib_set(as_router_lib, router->id, COORD_ASR_LEVEL, (void *) ctn);
160     XBT_DEBUG("Having set router coordinates for '%s'",router->id);
161   }
162
163   if (TRACE_is_enabled())
164     sg_instr_new_router(router);
165 }
166
167 void sg_platf_new_link(sg_platf_link_cbarg_t link){
168   unsigned int iterator;
169   sg_platf_link_cb_t fun;
170   xbt_dynar_foreach(sg_platf_link_cb_list, iterator, fun) {
171     fun(link);
172   }
173 }
174
175 void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster){
176   unsigned int iterator;
177   sg_platf_cluster_cb_t fun;
178   xbt_dynar_foreach(sg_platf_cluster_cb_list, iterator, fun) {
179     fun(cluster);
180   }
181 }
182 void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet){
183   unsigned int iterator;
184   sg_platf_cabinet_cb_t fun;
185   xbt_dynar_foreach(sg_platf_cabinet_cb_list, iterator, fun) {
186     fun(cabinet);
187   }
188 }
189 void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
190 {
191   xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL),
192                "Reading a storage, processing unit \"%s\" already exists", storage->id);
193
194   // Verification of an existing type_id
195 #ifndef NDEBUG
196   void* storage_type = xbt_lib_get_or_null(storage_type_lib, storage->type_id,ROUTING_STORAGE_TYPE_LEVEL);
197 #endif
198   xbt_assert(storage_type,"Reading a storage, type id \"%s\" does not exists", storage->type_id);
199
200   XBT_DEBUG("ROUTING Create a storage name '%s' with type_id '%s' and content '%s'",
201       storage->id,
202       storage->type_id,
203       storage->content);
204
205   xbt_lib_set(storage_lib,
206       storage->id,
207       ROUTING_STORAGE_LEVEL,
208       (void *) xbt_strdup(storage->type_id));
209
210   void* stype = xbt_lib_get_or_null(storage_type_lib,
211                                     storage->type_id,
212                                     ROUTING_STORAGE_TYPE_LEVEL);
213   if(!stype) xbt_die("No storage type '%s'",storage->type_id);
214
215   // if storage content is not specified use the content of storage_type if exist
216   if(!strcmp(storage->content,"") && strcmp(((storage_type_t) stype)->content,"")){
217     storage->content = ((storage_type_t) stype)->content;
218     storage->content_type = ((storage_type_t) stype)->content_type;
219     XBT_DEBUG("For disk '%s' content is empty, inherit the content (of type %s) from storage type '%s' ",
220         storage->id,((storage_type_t) stype)->content_type,
221         ((storage_type_t) stype)->type_id);
222   }
223
224   XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' "
225       "\n\t\tmodel '%s' \n\t\tcontent '%s'\n\t\tcontent_type '%s' "
226       "\n\t\tproperties '%p''\n",
227       storage->id,
228       ((storage_type_t) stype)->model,
229       ((storage_type_t) stype)->type_id,
230       storage->content,
231       storage->content_type,
232       storage->properties);
233
234   surf_storage_model->createStorage(storage->id,
235                                      ((storage_type_t) stype)->type_id,
236                                      storage->content,
237                                      storage->content_type,
238                                      storage->properties,
239                                      storage->attach);
240 }
241 void sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type){
242
243   xbt_assert(!xbt_lib_get_or_null(storage_type_lib, storage_type->id,ROUTING_STORAGE_TYPE_LEVEL),
244                "Reading a storage type, processing unit \"%s\" already exists", storage_type->id);
245
246   storage_type_t stype = xbt_new0(s_storage_type_t, 1);
247   stype->model = xbt_strdup(storage_type->model);
248   stype->properties = storage_type->properties;
249   stype->content = xbt_strdup(storage_type->content);
250   stype->content_type = xbt_strdup(storage_type->content_type);
251   stype->type_id = xbt_strdup(storage_type->id);
252   stype->size = storage_type->size;
253   stype->model_properties = storage_type->model_properties;
254
255   XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s', "
256       "content '%s', and content_type '%s'",
257       stype->type_id,
258       stype->model,
259       storage_type->content,
260       storage_type->content_type);
261
262   xbt_lib_set(storage_type_lib,
263       stype->type_id,
264       ROUTING_STORAGE_TYPE_LEVEL,
265       (void *) stype);
266 }
267 void sg_platf_new_mstorage(sg_platf_mstorage_cbarg_t mstorage)
268 {
269   THROW_UNIMPLEMENTED;
270 //  mount_t mnt = xbt_new0(s_mount_t, 1);
271 //  mnt->id = xbt_strdup(mstorage->type_id);
272 //  mnt->name = xbt_strdup(mstorage->name);
273 //
274 //  if(!mount_list){
275 //    XBT_DEBUG("Creata a Mount list for %s",A_surfxml_host_id);
276 //    mount_list = xbt_dynar_new(sizeof(char *), NULL);
277 //  }
278 //  xbt_dynar_push(mount_list,(void *) mnt);
279 //  free(mnt->id);
280 //  free(mnt->name);
281 //  xbt_free(mnt);
282 //  XBT_DEBUG("ROUTING Mount a storage name '%s' with type_id '%s'",mstorage->name, mstorage->id);
283 }
284
285 static void mount_free(void *p)
286 {
287   mount_t mnt = (mount_t) p;
288   xbt_free(mnt->name);
289 }
290
291 void sg_platf_new_mount(sg_platf_mount_cbarg_t mount){
292   // Verification of an existing storage
293 #ifndef NDEBUG
294   void* storage = xbt_lib_get_or_null(storage_lib, mount->storageId, ROUTING_STORAGE_LEVEL);
295 #endif
296   xbt_assert(storage,"Disk id \"%s\" does not exists", mount->storageId);
297
298   XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->storageId, mount->name);
299
300   s_mount_t mnt;
301   mnt.storage = surf_storage_resource_priv(surf_storage_resource_by_name(mount->storageId));
302   mnt.name = xbt_strdup(mount->name);
303
304   if(!mount_list){
305     XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id);
306     mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free);
307   }
308   xbt_dynar_push(mount_list, &mnt);
309 }
310
311 void sg_platf_new_route(sg_platf_route_cbarg_t route)
312 {
313   routing_get_current()->parseRoute(route);
314 }
315
316 void sg_platf_new_ASroute(sg_platf_route_cbarg_t ASroute) {
317   unsigned int iterator;
318   sg_platf_route_cb_t fun;
319   xbt_dynar_foreach(sg_platf_ASroute_cb_list, iterator, fun) {
320     fun(ASroute);
321   }
322 }
323 void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute) {
324   unsigned int iterator;
325   sg_platf_route_cb_t fun;
326   xbt_dynar_foreach(sg_platf_bypassRoute_cb_list, iterator, fun) {
327     fun(bypassRoute);
328   }
329 }
330 void sg_platf_new_bypassASroute(sg_platf_route_cbarg_t bypassASroute) {
331   unsigned int iterator;
332   sg_platf_route_cb_t fun;
333   xbt_dynar_foreach(sg_platf_bypassASroute_cb_list, iterator, fun) {
334     fun(bypassASroute);
335   }
336 }
337 void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) {
338   unsigned int iterator;
339   sg_platf_trace_cb_t fun;
340   xbt_dynar_foreach(sg_platf_trace_cb_list, iterator, fun) {
341     fun(trace);
342   }
343 }
344 void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) {
345   unsigned int iterator;
346   sg_platf_trace_connect_cb_t fun;
347   xbt_dynar_foreach(sg_platf_trace_connect_cb_list, iterator, fun) {
348     fun(trace_connect);
349   }
350 }
351
352 void sg_platf_new_process(sg_platf_process_cbarg_t process)
353 {
354   if (!simix_global)
355     xbt_die("Cannot create process without SIMIX.");
356
357   sg_host_t host = sg_host_by_name(process->host);
358   if (!host)
359     THROWF(arg_error, 0, "Host '%s' unknown", process->host);
360   xbt_main_func_t parse_code = SIMIX_get_registered_function(process->function);
361   xbt_assert(parse_code, "Function '%s' unknown", process->function);
362
363   double start_time = process->start_time;
364   double kill_time  = process->kill_time;
365   int auto_restart = process->on_failure == SURF_PROCESS_ON_FAILURE_DIE ? 0 : 1;
366
367   smx_process_arg_t arg = NULL;
368   smx_process_t process_created = NULL;
369
370   arg = xbt_new0(s_smx_process_arg_t, 1);
371   arg->code = parse_code;
372   arg->data = NULL;
373   arg->hostname = sg_host_get_name(host);
374   arg->argc = process->argc;
375   arg->argv = xbt_new(char *,process->argc);
376   int i;
377   for (i=0; i<process->argc; i++)
378     arg->argv[i] = xbt_strdup(process->argv[i]);
379   arg->name = xbt_strdup(arg->argv[0]);
380   arg->kill_time = kill_time;
381   arg->properties = current_property_set;
382   if (!sg_host_simix(host)->boot_processes) {
383     sg_host_simix(host)->boot_processes = xbt_dynar_new(sizeof(smx_process_arg_t), _SIMIX_host_free_process_arg);
384   }
385   xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
386
387   if (start_time > SIMIX_get_clock()) {
388     arg = xbt_new0(s_smx_process_arg_t, 1);
389     arg->name = (char*)(process->argv)[0];
390     arg->code = parse_code;
391     arg->data = NULL;
392     arg->hostname = sg_host_get_name(host);
393     arg->argc = process->argc;
394     arg->argv = (char**)(process->argv);
395     arg->kill_time = kill_time;
396     arg->properties = current_property_set;
397
398     XBT_DEBUG("Process %s(%s) will be started at time %f", arg->name,
399            arg->hostname, start_time);
400     SIMIX_timer_set(start_time, [](void* arg) {
401       SIMIX_process_create_from_wrapper((smx_process_arg_t) arg);
402     }, arg);
403   } else {                      // start_time <= SIMIX_get_clock()
404     XBT_DEBUG("Starting Process %s(%s) right now", process->argv[0], sg_host_get_name(host));
405
406     if (simix_global->create_process_function)
407       process_created = simix_global->create_process_function(
408                                             (char*)(process->argv)[0],
409                                             parse_code,
410                                             NULL,
411                                             sg_host_get_name(host),
412                                             kill_time,
413                                             process->argc,
414                                             (char**)(process->argv),
415                                             current_property_set,
416                                             auto_restart, NULL);
417     else
418       process_created = simcall_process_create((char*)(process->argv)[0], parse_code, NULL, sg_host_get_name(host), kill_time, process->argc,
419           (char**)process->argv, current_property_set,auto_restart);
420
421     /* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
422     if (!process_created) {
423       return;
424     }
425   }
426   current_property_set = NULL;
427 }
428
429 void sg_platf_route_begin (sg_platf_route_cbarg_t route){
430   route->link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
431 }
432 void sg_platf_ASroute_begin (sg_platf_route_cbarg_t ASroute){
433   ASroute->link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
434 }
435
436 void sg_platf_route_end (sg_platf_route_cbarg_t route){
437   sg_platf_new_route(route);
438 }
439 void sg_platf_ASroute_end (sg_platf_route_cbarg_t ASroute){
440   sg_platf_new_ASroute(ASroute);
441 }
442
443 void sg_platf_route_add_link (const char* link_id, sg_platf_route_cbarg_t route){
444   char *link_name = xbt_strdup(link_id);
445   xbt_dynar_push(route->link_list, &link_name);
446 }
447 void sg_platf_ASroute_add_link (const char* link_id, sg_platf_route_cbarg_t ASroute){
448   char *link_name = xbt_strdup(link_id);
449   xbt_dynar_push(ASroute->link_list, &link_name);
450 }
451
452 void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
453
454 void sg_platf_end() {
455   unsigned int iterator;
456   void_f_void_t fun;
457   xbt_dynar_foreach(sg_platf_postparse_cb_list, iterator, fun) {
458     fun();
459   }
460 }
461
462 void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
463 {
464   if (!surf_parse_models_setup_already_called) {
465     /* Initialize the surf models. That must be done after we got all config, and before we need the models.
466      * That is, after the last <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
467      *
468      * I'm not sure for <trace> and <trace_connect>, there may be a bug here
469      * (FIXME: check it out by creating a file beginning with one of these tags)
470      * but cluster and peer create ASes internally, so putting the code in there is ok.
471      *
472      * TODO, There used to be a guard protecting here against
473      * xbt_dynar_length(sg_platf_AS_begin_cb_list) because we don't want to
474      * initialize the models if we are parsing the file to get the deployment.
475      * That could happen if the same file would be used for platf and deploy:
476      * it'd contain AS tags even during the deploy parsing. Removing that guard
477      * would result of the models to get re-inited when parsing for deploy.
478      * Currently using the same file for platform and deployment is broken
479      * however. This guard will have to ba adapted in order to make this feature
480      * work again.
481      */
482     surf_parse_models_setup_already_called = 1;
483     surf_config_models_setup();
484   }
485
486   routing_AS_begin(AS);
487   if (TRACE_is_enabled())
488     sg_instr_AS_begin(AS);
489 }
490
491 void sg_platf_new_AS_end()
492 {
493   routing_AS_end();
494   if (TRACE_is_enabled())
495     sg_instr_AS_end();
496 }
497
498 /* ***************************************** */
499 /* TUTORIAL: New TAG                         */
500
501 void sg_platf_new_gpu(sg_platf_gpu_cbarg_t gpu) {
502   unsigned int iterator;
503   void_f_void_t fun;
504   xbt_dynar_foreach(sg_platf_gpu_cb_list, iterator, fun) {
505     fun();
506   }
507 }
508
509 void sg_platf_gpu_add_cb(sg_platf_gpu_cb_t fct) {
510   xbt_dynar_push(sg_platf_gpu_cb_list, &fct);
511 }
512
513 /* ***************************************** */
514
515 void sg_platf_link_add_cb(sg_platf_link_cb_t fct) {
516   xbt_dynar_push(sg_platf_link_cb_list, &fct);
517 }
518 void sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct) {
519   xbt_dynar_push(sg_platf_cluster_cb_list, &fct);
520 }
521 void sg_platf_cabinet_add_cb(sg_platf_cabinet_cb_t fct) {
522   xbt_dynar_push(sg_platf_cabinet_cb_list, &fct);
523 }
524 void sg_platf_postparse_add_cb(void_f_void_t fct) {
525   xbt_dynar_push(sg_platf_postparse_cb_list, &fct);
526 }
527 void sg_platf_ASroute_add_cb(sg_platf_route_cb_t fct) {
528   xbt_dynar_push(sg_platf_ASroute_cb_list, &fct);
529 }
530 void sg_platf_bypassRoute_add_cb(sg_platf_route_cb_t fct) {
531   xbt_dynar_push(sg_platf_bypassRoute_cb_list, &fct);
532 }
533 void sg_platf_bypassASroute_add_cb(sg_platf_route_cb_t fct) {
534   xbt_dynar_push(sg_platf_bypassASroute_cb_list, &fct);
535 }
536 void sg_platf_trace_add_cb(sg_platf_trace_cb_t fct) {
537   xbt_dynar_push(sg_platf_trace_cb_list, &fct);
538 }
539 void sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t fct) {
540   xbt_dynar_push(sg_platf_trace_connect_cb_list, &fct);
541 }
542 void sg_platf_rng_stream_init(unsigned long seed[6]) {
543   RngStream_SetPackageSeed(seed);
544   sg_platf_rng_stream = RngStream_CreateStream(NULL);
545 }
546
547 RngStream sg_platf_rng_stream_get(const char* id) {
548   RngStream stream = NULL;
549   unsigned int id_hash;
550
551   stream = RngStream_CopyStream(sg_platf_rng_stream);
552   id_hash = xbt_str_hash(id);
553   RngStream_AdvanceState(stream, 0, (long)id_hash);
554
555   return stream;
556 }