Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #193 from Takishipp/signals
[simgrid.git] / doc / doxygen / FAQ.doc
1 /*! \page FAQ Frequently Asked Questions
2
3 @tableofcontents
4
5 \section faq_simgrid I'm new to SimGrid. I have some questions. Where should I start?
6
7 You are at the right place... To understand what you can do or
8 cannot do with SimGrid, you should read the
9 <a href="http://simgrid.gforge.inria.fr/tutorials.php">tutorial
10 slides</a> from the SimGrid's website. You may find more uptodate
11 material on the
12 <a href="http://people.irisa.fr/Martin.Quinson/blog/SimGrid/">blog of
13 Martin Quinson</a>. 
14
15 Another great source of inspiration can be found in the \ref msg_examples.
16
17 If you are stuck at any point and if this FAQ cannot help you, please drop us a
18 mail to the user mailing list: <simgrid-user@lists.gforge.inria.fr>.
19
20 \subsection faq_interfaces What is the difference between MSG and SimDag? Do they serve the same purpose?
21
22 It depend on how you define "purpose", I guess ;)
23
24 They all allow you to build a prototype of application which you can run
25 within the simulator afterward. They all share the same simulation kernel,
26 which is the core of the SimGrid project. They differ by the way you express
27 your application.
28
29 With SimDag, you express your code as a collection of interdependent
30 parallel tasks. So, in this model, applications can be seen as a DAG of
31 tasks. This is the interface of choice for people wanting to port old
32 code designed for SimGrid v1 or v2 to the framework current version.
33
34 With MSG, your application is seen as a set of communicating
35 processes, exchanging data by the way of messages and performing
36 computation on their own.
37
38 \subsection faq_visualization Visualizing and analyzing the results
39
40 It is sometime convenient to "see" how the agents are behaving. If you
41 like colors, you can use <tt>tools/MSG_visualization/colorize.pl </tt>
42 as a filter to your MSG outputs. It works directly with INFO. Beware,
43 INFO() prints on stderr. Do not forget to redirect if you want to
44 filter (e.g. with bash):
45 \verbatim
46 ./msg_test small_platform.xml small_deployment.xml 2>&1 | ../../tools/MSG_visualization/colorize.pl
47 \endverbatim
48
49 We also have a more graphical output. Have a look at section \ref options_tracing.
50
51 \subsection faq_C Argh! Do I really have to code in C?
52
53 We provide Java bindings of the MSG interface, which is the main
54 SimGrid user API.
55
56 Moreover If you use C++, you should be able to use the SimGrid library
57 as a standard C library and everything should work fine (simply
58 <i>link</i> against this library; recompiling SimGrid with a C++
59 compiler won't work and it wouldn't help if you could).
60
61 For now, we do not feel a real demand for any other language. But if
62 you think there is one, please speak up!
63
64 \section faq_howto Feature related questions
65
66 \subsection faq_MIA "Could you please add (your favorite feature here) to SimGrid?"
67
68 Here is the deal. The whole SimGrid project (MSG, SURF, ...) is
69 meant to be kept as simple and generic as possible. We cannot add
70 functions for everybody's needs when these functions can easily be
71 built from the ones already in the API. Most of the time, it is
72 possible and when it was not possible we always have upgraded the API
73 accordingly. When somebody asks us a question like "How to do that?
74 Is there a function in the API to simply do this?", we're always glad
75 to answer and help. However if we don't need this code for our own
76 need, there is no chance we're going to write it... it's your job! :)
77 The counterpart to our answers is that once you come up with a neat
78 implementation of this feature (task duplication, RPC, thread
79 synchronization, ...), you should send it to us and we will be glad to
80 add it to the distribution. Thus, other people will take advantage of
81 it (and we don't have to answer this question again and again ;).
82
83 You'll find in this section a few "Missing In Action" features. Many
84 people have asked about it and we have given hints on how to simply do
85 it with MSG. Feel free to contribute...
86
87 \subsection faq_MIA_MSG MSG features
88
89 \subsubsection faq_MIA_examples I want some more complex MSG examples!
90
91 Many people have come to ask me a more complex example and each time,
92 they have realized afterward that the basics were in the previous three
93 examples.
94
95 Of course they have often been needing more complex functions like
96 MSG_process_suspend(), MSG_process_resume() and
97 MSG_process_isSuspended() (to perform synchronization), or
98 MSG_task_Iprobe() and MSG_process_sleep() (to avoid blocking
99 receptions), or even MSG_process_create() (to design asynchronous
100 communications or computations). But the examples are sufficient to
101 start.
102
103 We know. We should add some more examples, but not really some more
104 complex ones... We should add some examples that illustrate some other
105 functionalists (like how to simply encode asynchronous
106 communications, RPC, process migrations, thread synchronization, ...)
107 and we will do it when we will have a little bit more time. We have
108 tried to document the examples so that they are understandable. Tell
109 us if something is not clear and once again feel free to participate!
110 :)
111
112 \subsubsection faq_MIA_taskdup Missing in action: MSG Task duplication/replication
113
114 There is no task duplication in MSG. When you create a task, you can
115 process it or send it somewhere else. As soon as a process has sent
116 this task, he doesn't have this task anymore. It's gone. The receiver
117 process has got the task. However, you could decide upon receiving to
118 create a "copy" of a task but you have to handle by yourself the
119 semantic associated to this "duplication".
120
121 As we already told, we prefer keeping the API as simple as
122 possible. This kind of feature is rather easy to implement by users
123 and the semantic you associate really depends on people. Having a
124 *generic* task duplication mechanism is not that trivial (in
125 particular because of the data field). That is why I would recommend
126 that you write it by yourself even if I can give you advice on how to
127 do it.
128
129 You have the following functions to get information about a task:
130 MSG_task_get_name(), MSG_task_get_compute_duration(),
131 MSG_task_get_remaining_computation(), MSG_task_get_data_size(),
132 and MSG_task_get_data().
133
134 You could use a dictionary (#xbt_dict_t) of dynars (#xbt_dynar_t). If
135 you still don't see how to do it, please come back to us...
136
137 \subsubsection faq_MIA_asynchronous I want to do asynchronous communications in MSG
138
139 You are probably looking for the following functions:
140 MSG_task_isend() and MSG_task_irecv(); 
141 MSG_comm_test(), MSG_comm_wait(), MSG_comm_waitall() and MSG_comm_waitany();
142 MSG_comm_destroy(). 
143
144 There is even a specific example section on \ref msg_ex_async .
145
146 \subsubsection faq_MIA_thread_synchronization How to synchronize my user processes?
147
148 It depends on why you want to synchronize them.  If you just want to
149 have a shared state between your processes, then you probably don't
150 need to do anything. User processes never get forcefully interrupted
151 in SimGrid (unless you explicitly request the parallel execution of
152 user processes -- see @ref options_virt_parallel).
153
154 Even if several processes are executed at the exact same time within
155 the simulation, they are linearized in reality by default: one process
156 always run in an exclusive manner, atomic, uninterrupted until it does
157 a simcall (until it ask a service from the simulation kernel). This is
158 surprising at first, but things are much easier this way, both for the
159 user (who don't have to protect her shared data) and for the kernel
160 (that avoid many synchronization issues too). Processes are executed
161 concurrently in the simulated realm, but you don't need to bother with
162 this in the real realm.
163
164 If you really need to synchronize your processes (because it's what
165 you are studying or to create an atomic section that spans over
166 several simcalls), you obviously cannot use regular synchronization
167 mechanisms (pthread_mutexes in C or the synchronized keyword in Java).
168 This is because the SimGrid kernel locks all processes and unlock them
169 one after the other when they are supposed to run, until they give the
170 control back in their simcall. If one of them gets locked by the OS 
171 before returning the control to the kernel, that's definitively a
172 deadlock.
173
174 Instead, you should use the synchronization mechanism provided by the
175 simulation kernel. This could with a SimGrid mutex, a SimGrid
176 condition variables or a SimGrid semaphore, as described in @ref
177 msg_synchro (in Java, only semaphores are available). But actually,
178 many synchronization patterns can be encoded with communication on
179 mailboxes. Typically, if you need one process to notify another one,
180 you could use a condition variable or a semphore, but sending a
181 message to a specific mailbox does the trick in most cases.
182
183 \subsubsection faq_MIA_host_load Where is the get_host_load function hidden in MSG?
184
185 There is no such thing because its semantic wouldn't be really
186 clear. Of course, it is something about the amount of host throughput,
187 but there is as many definition of "host load" as people asking for
188 this function. First, you have to remember that resource availability
189 may vary over time, which make any load notion harder to define.
190
191 It may be instantaneous value or an average one. Moreover it may be only the
192 power of the computer, or may take the background load into account, or may
193 even take the currently running tasks into account. In some SURF models,
194 communications have an influence on computational power. Should it be taken
195 into account too?
196
197 First of all, it's near to impossible to predict the load beforehand in the
198 simulator since it depends on too much parameters (background load
199 variation, bandwidth sharing algorithmic complexity) some of them even being
200 not known beforehand (other task starting at the same time). So, getting
201 this information is really hard (just like in real life). It's not just that
202 we want MSG to be as painful as real life. But as it is in some way
203 realistic, we face some of the same problems as we would face in real life.
204
205 How would you do it for real? The most common option is to use something
206 like NWS that performs active probes. The best solution is probably to do
207 the same within MSG, as in next code snippet. It is very close from what you
208 would have to do out of the simulator, and thus gives you information that
209 you could also get in real settings to not hinder the realism of your
210 simulation.
211
212 \code
213 double get_host_load() {
214    m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
215    double date = MSG_get_clock();
216
217    MSG_task_execute(task);
218    date = MSG_get_clock() - date;
219    MSG_task_destroy(task);
220    return (0.001/date);
221 }
222 \endcode
223
224 Of course, it may not match your personal definition of "host load". In this
225 case, please detail what you mean on the mailing list, and we will extend
226 this FAQ section to fit your taste if possible.
227
228 \subsubsection faq_MIA_communication_time How can I get the *real* communication time?
229
230 Communications are synchronous and thus if you simply get the time
231 before and after a communication, you'll only get the transmission
232 time and the time spent to really communicate (it will also take into
233 account the time spent waiting for the other party to be
234 ready). However, getting the *real* communication time is not really
235 hard either. The following solution is a good starting point.
236
237 \code
238 int sender()
239 {
240   m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
241                                   calloc(1,sizeof(double)));
242   *((double*) task->data) = MSG_get_clock();
243   MSG_task_put(task, slaves[i % slaves_count], PORT_22);
244   XBT_INFO("Send completed");
245   return 0;
246 }
247 int receiver()
248 {
249   m_task_t task = NULL;
250   double time1,time2;
251
252   time1 = MSG_get_clock();
253   a = MSG_task_get(&(task), PORT_22);
254   time2 = MSG_get_clock();
255   if(time1<*((double *)task->data))
256      time1 = *((double *) task->data);
257   XBT_INFO("Communication time :  \"%f\" ", time2-time1);
258   free(task->data);
259   MSG_task_destroy(task);
260   return 0;
261 }
262 \endcode
263
264 \subsection faq_MIA_SimDag SimDag related questions
265
266 \subsubsection faq_SG_comm Implementing communication delays between tasks.
267
268 A classic question of SimDag newcomers is about how to express a
269 communication delay between tasks. The thing is that in SimDag, both
270 computation and communication are seen as tasks.  So, if you want to
271 model a data dependency between two DAG tasks t1 and t2, you have to
272 create 3 SD_tasks: t1, t2 and c and add dependencies in the following
273 way:
274
275 \code
276 SD_task_dependency_add(NULL, NULL, t1, c);
277 SD_task_dependency_add(NULL, NULL, c, t2);
278 \endcode
279
280 This way task t2 cannot start before the termination of communication c
281 which in turn cannot start before t1 ends.
282
283 When creating task c, you have to associate an amount of data (in bytes)
284 corresponding to what has to be sent by t1 to t2.
285
286 Finally to schedule the communication task c, you have to build a list
287 comprising the workstations on which t1 and t2 are scheduled (w1 and w2
288 for example) and build a communication matrix that should look like
289 [0;amount ; 0; 0].
290
291 \subsubsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
292
293 Distributed is somehow "contagious". If you start making distributed
294 decisions, there is no way to handle DAGs directly anymore (unless I
295 am missing something). You have to encode your DAGs in term of
296 communicating process to make the whole scheduling process
297 distributed. Here is an example of how you could do that. Assume T1
298 has to be done before T2.
299
300 \code
301  int your_agent(int argc, char *argv[] {
302    ...
303    T1 = MSG_task_create(...);
304    T2 = MSG_task_create(...);
305    ...
306    while(1) {
307      ...
308      if(cond) MSG_task_execute(T1);
309      ...
310      if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
311         MSG_task_execute(T2)
312      else {
313         /* do something else */
314      }
315    }
316  }
317 \endcode
318
319 If you decide that the distributed part is not that much important and that
320 DAG is really the level of abstraction you want to work with, then you should
321 give a try to \ref SD_API.
322
323 \subsection faq_MIA_generic Generic features
324
325 \subsubsection faq_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid?
326
327 No, there is no native support for batch schedulers and none is
328 planned because this is a very specific need (and doing it in a
329 generic way is thus very hard). However some people have implemented
330 their own batch schedulers. Vincent Garonne wrote one during his PhD
331 and put his code in the contrib directory of our SVN so that other can
332 keep working on it. You may find inspiring ideas in it.
333
334 \subsubsection faq_MIA_checkpointing I need a checkpointing thing
335
336 Actually, it depends on whether you want to checkpoint the simulation, or to
337 simulate checkpoints.
338
339 The first one could help if your simulation is a long standing process you
340 want to keep running even on hardware issues. It could also help to
341 <i>rewind</i> the simulation by jumping sometimes on an old checkpoint to
342 cancel recent calculations.\n
343 Unfortunately, such thing will probably never exist in SG. One would have to
344 duplicate all data structures because doing a rewind at the simulator level
345 is very very hard (not talking about the malloc free operations that might
346 have been done in between). Instead, you may be interested in the Libckpt
347 library (http://www.cs.utk.edu/~plank/plank/www/libckpt.html). This is the
348 checkpointing solution used in the condor project, for example. It makes it
349 easy to create checkpoints (at the OS level, creating something like core
350 files), and rerunning them on need.
351
352 If you want to simulate checkpoints instead, it means that you want the
353 state of an executing task (in particular, the progress made towards
354 completion) to be saved somewhere.  So if a host (and the task executing on
355 it) fails (cf. #MSG_HOST_FAILURE), then the task can be restarted
356 from the last checkpoint.\n
357
358 Actually, such a thing does not exist in SimGrid either, but it's just
359 because we don't think it is fundamental and it may be done in the user code
360 at relatively low cost. You could for example use a watcher that
361 periodically get the remaining amount of things to do (using
362 MSG_task_get_remaining_computation()), or fragment the task in smaller
363 subtasks.
364
365 \subsection faq_platform Platform building and Dynamic resources
366
367 \subsubsection faq_platform_example Where can I find SimGrid platform files?
368
369 There are several little examples in the archive, in the examples/msg
370 directory. From time to time, we are asked for other files, but we
371 don't have much at hand right now.
372
373 You should refer to the Platform Description Archive
374 (http://pda.gforge.inria.fr) project to see the other platform file we
375 have available, as well as the Simulacrum simulator, meant to generate
376 SimGrid platforms using all classical generation algorithms.
377
378 \subsubsection faq_platform_alnem How can I automatically map an existing platform?
379
380 We are working on a project called ALNeM (Application-Level Network
381 Mapper) which goal is to automatically discover the topology of an
382 existing network. Its output will be a platform description file
383 following the SimGrid syntax, so everybody will get the ability to map
384 their own lab network (and contribute them to the catalog project).
385 This tool is not ready yet, but it move quite fast forward. Just stay
386 tuned.
387
388 \subsubsection faq_platform_synthetic Generating synthetic but realistic platforms
389
390 The third possibility to get a platform file (after manual or
391 automatic mapping of real platforms) is to generate synthetic
392 platforms. Getting a realistic result is not a trivial task, and
393 moreover, nobody is really able to define what "realistic" means when
394 speaking of topology files. You can find some more thoughts on this
395 topic in these
396 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">slides</a>.
397
398 If you are looking for an actual tool, there we have a little tool to
399 annotate Tiers-generated topologies. This perl-script is in
400 <tt>tools/platform_generation/</tt> directory of the SVN. Dinda et Al.
401 released a very comparable tool, and called it GridG.
402
403
404 The specified computing power will be available to up to 6 sequential
405 tasks without sharing. If more tasks are placed on this host, the
406 resource will be shared accordingly. For example, if you schedule 12
407 tasks on the host, each will get half of the computing power. Please
408 note that although sound, this model were never scientifically
409 assessed. Please keep this fact in mind when using it.
410
411
412 \subsubsection faq_platform_random Using random variable for the resource power or availability
413
414 The best way to model the resouce power using a random variable is to
415 use an availability trace that is directed by a probability
416 distribution. This can be done using the function
417 tmgr_trace_generator_value() below. The date and value generators is
418 created with one of tmgr_event_generator_new_uniform(),
419 tmgr_event_generator_new_exponential() or
420 tmgr_event_generator_new_weibull() (if you need other generators,
421 adding them to src/surf/trace_mgr.c should be quite trivial and your
422 patch will be welcomed). Once your trace is created, you have to
423 connect it to the resource with the function
424 sg_platf_new_trace_connect().
425
426 That the process is very similar if you want to model the
427 resource availability with a random variable (deciding whether it's
428 on/off instead of deciding its speed) using the function
429 tmgr_trace_generator_state() or tmgr_trace_generator_avail_unavail()
430 instead of tmgr_trace_generator_value().
431
432 Unfortunately, all this is currently lacking a proper documentation,
433 and there is even no proper example of use. You'll thus have to check
434 the header file include/simgrid/platf.h and experiment a bit by
435 yourself. The following code should be a good starting point, and
436 contributing a little clean example would be a good way to help the
437 SimGrid project.
438
439 @code
440 tmgr_trace_generator_value("mytrace",tmgr_event_generator_new_exponential(.5)
441                                      tmgr_event_generator_new_uniform(100000,9999999));
442                                      
443 sg_platf_trace_connect_cbarg_t myconnect = SG_PLATF_TRACE_CONNECT_INITIALIZER;
444 myconnect.kind = SURF_TRACE_CONNECT_KIND_BANDWIDTH;
445 myconnect.trace = "mytrace";
446 myconnect.element = "mylink";
447
448 sg_platf_trace_connect(myconnect);
449 @endcode
450
451 \section faq_troubleshooting Troubleshooting
452
453 \subsection faq_trouble_changelog The feature X stopped to work after my last update 
454
455 I guess that you want to read the ChangeLog file, that always contains
456 all the information that could be important to the users during the
457 upgrade. Actually, you may want to read it (alongside with the NEWS
458 file that highlights the most important changes) even before you
459 upgrade your copy of SimGrid, too.
460
461 We do our best to maintain the backward compatibility, but we
462 sometimes have to fix the things that are too broken. If we happen to
463 kill a feature that you were using, we are sorry. We think that you
464 should update to the new way of doing things, but if you can't afford
465 it, that's ok. Just stick to the last version that were working for
466 you, and have a pleasant day.
467
468 \subsection faq_trouble_lib_compil SimGrid compilation and installation problems
469
470 \subsubsection faq_trouble_lib_config cmake fails!
471
472 We know only one reason for the configure to fail:
473
474  - <b>You are using a broken build environment</b>\n
475    Try updating your cmake version. If symptom is that the configury
476    magic complains about gcc not being able to build executables, you
477    are probably missing the libc6-dev package. Damn Ubuntu. 
478
479 If you experience other kind of issue, please get in touch with us. We are
480 always interested in improving our portability to new systems.
481
482 \subsubsection faq_trouble_distcheck Dude! "ctest" fails on my machine!
483
484 Don't assume we never run this target, because we do. Check
485 http://cdash.inria.fr/CDash/index.php?project=Simgrid (click on
486 previous if there is no result for today: results are produced only by
487 11am, French time) and
488 https://buildd.debian.org/status/logs.php?pkg=simgrid if you don't believe us.
489
490 If it's failing on your machine in a way not experienced by the
491 autobuilders above, please drop us a mail on the mailing list so that
492 we can check it out. Make sure to read \ref faq_bugrepport before you
493 do so.
494
495 \subsection faq_trouble_compil User code compilation problems
496
497 \subsubsection faq_trouble_err_logcat "gcc: _simgrid_this_log_category_does_not_exist__??? undeclared (first use in this function)"
498
499 This is because you are using the log mechanism, but you didn't created
500 any default category in this file. You should refer to \ref XBT_log
501 for all the details, but you simply forgot to call one of
502 XBT_LOG_NEW_DEFAULT_CATEGORY() or XBT_LOG_NEW_DEFAULT_SUBCATEGORY().
503
504 \subsubsection faq_trouble_pthreadstatic "gcc: undefined reference to pthread_key_create"
505
506 This indicates that one of the library SimGrid depends on (libpthread
507 here) was missing on the linking command line. Dependencies of
508 libsimgrid are expressed directly in the dynamic library, so it's
509 quite impossible that you see this message when doing dynamic linking.
510
511 If you compile your code statically (and if you use a pthread version
512 of SimGrid), you must absolutely
513 specify <tt>-lpthread</tt> on the linker command line. As usual, this should
514 come after <tt>-lsimgrid</tt> on this command line.
515
516 \subsection faq_trouble_errors Runtime error messages
517
518 \subsubsection faq_trouble_errors_big_fat_warning I'm told that my XML files are too old.
519
520 The format of the XML platform description files is sometimes
521 improved. For example, we decided to change the units used in SimGrid
522 from MBytes, MFlops and seconds to Bytes, Flops and seconds to ease
523 people exchanging small messages. We also reworked the route
524 descriptions to allow more compact descriptions.
525
526 That is why the XML files are versionned using the 'version' attribute
527 of the root tag. Currently, it should read:
528 @verbatim
529   <platform version="4">
530 @endverbatim
531
532 If your files are too old, you can use the simgrid_update_xml.pl
533 script which can be found in the tools directory of the archive.
534
535 \subsection faq_trouble_debug Debugging SMPI applications
536
537 In order to debug SMPI programs, you can use the following options:
538
539 - <b>-wrapper 'gdb --args'</b>: this option is used to use a wrapper
540   in order to call the SMPI process. Good candidates for this options
541   are "gdb --args", "valgrind", "rr record", "strace", etc;
542
543 - <b>-foreground</b>: this options gives the debugger access to the terminal
544   which is needed in order to use an interactive debugger.
545
546 Both options are needed in order to run the SMPI process under GDB.
547
548 \subsection faq_trouble_valgrind Valgrind-related and other debugger issues
549
550 If you don't, you really should use valgrind to debug your code, it's
551 almost magic.
552
553 \subsubsection faq_trouble_vg_libc Valgrind spits tons of errors about backtraces!
554
555 It may happen that valgrind, the memory debugger beloved by any decent C
556 programmer, spits tons of warnings like the following :
557 \verbatim ==8414== Conditional jump or move depends on uninitialised value(s)
558 ==8414==    at 0x400882D: (within /lib/ld-2.3.6.so)
559 ==8414==    by 0x414EDE9: (within /lib/tls/i686/cmov/libc-2.3.6.so)
560 ==8414==    by 0x400B105: (within /lib/ld-2.3.6.so)
561 ==8414==    by 0x414F937: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
562 ==8414==    by 0x4150F4C: (within /lib/tls/i686/cmov/libc-2.3.6.so)
563 ==8414==    by 0x400B105: (within /lib/ld-2.3.6.so)
564 ==8414==    by 0x415102D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
565 ==8414==    by 0x412D6B9: backtrace (in /lib/tls/i686/cmov/libc-2.3.6.so)
566 ==8414==    by 0x8076446: xbt_dictelm_get_ext (dict_elm.c:714)
567 ==8414==    by 0x80764C1: xbt_dictelm_get (dict_elm.c:732)
568 ==8414==    by 0x8079010: xbt_cfg_register (config.c:208)
569 ==8414==    by 0x806821B: MSG_config (msg_config.c:42)
570 \endverbatim
571
572 This problem is somewhere in the libc when using the backtraces and there is
573 very few things we can do ourselves to fix it. Instead, here is how to tell
574 valgrind to ignore the error. Add the following to your ~/.valgrind.supp (or
575 create this file on need). Make sure to change the obj line according to
576 your personnal mileage (change 2.3.6 to the actual version you are using,
577 which you can retrieve with a simple "ls /lib/ld*.so").
578
579 \verbatim {
580    name: Backtrace madness
581    Memcheck:Cond
582    obj:/lib/ld-2.3.6.so
583    fun:dl_open_worker
584    fun:_dl_open
585    fun:do_dlopen
586    fun:dlerror_run
587    fun:__libc_dlopen_mode
588 }\endverbatim
589
590 Then, you have to specify valgrind to use this suppression file by passing
591 the <tt>--suppressions=$HOME/.valgrind.supp</tt> option on the command line.
592 You can also add the following to your ~/.bashrc so that it gets passed
593 automatically. Actually, it passes a bit more options to valgrind, and this
594 happen to be my personnal settings. Check the valgrind documentation for
595 more information.
596
597 \verbatim export VALGRIND_OPTS="--leak-check=yes --leak-resolution=high --num-callers=40 --tool=memcheck --suppressions=$HOME/.valgrind.supp" \endverbatim
598
599 \subsubsection faq_trouble_backtraces Truncated backtraces
600
601 When debugging SimGrid, it's easier to pass the
602 --disable-compiler-optimization flag to the configure if valgrind or
603 gdb get fooled by the optimization done by the compiler. But you
604 should remove these flag when everything works before going in
605 production (before launching your 1252135 experiments), or everything
606 will run only one half of the true SimGrid potential.
607
608 \subsection faq_deadlock There is a deadlock in my code!!!
609
610 Unfortunately, we cannot debug every code written in SimGrid.  We
611 furthermore believe that the framework provides ways enough
612 information to debug such information yourself. If the textual output
613 is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
614 how to get a graphical one.
615
616 Now, if you come up with a really simple example that deadlocks and
617 you're absolutely convinced that it should not, you can ask on the
618 list. Just be aware that you'll be severely punished if the mistake is
619 on your side... We have plenty of FAQ entries to redact and new
620 features to implement for the impenitents! ;)
621
622 \subsection faq_surf_network_latency I get weird timings when I play with the latencies.
623
624 OK, first of all, remember that units should be Bytes, Flops and
625 Seconds. If you don't use such units, some SimGrid constants (e.g. the
626 SG_TCP_CTE_GAMMA constant used in most network models) won't have the
627 right unit and you'll end up with weird results.
628
629 Here is what happens with a single transfer of size L on a link
630 (bw,lat) when nothing else happens.
631
632 \verbatim
633 0-----lat--------------------------------------------------t
634 |-----|**** real_bw =min(bw,SG_TCP_CTE_GAMMA/(2*lat)) *****|
635 \endverbatim
636
637 In more complex situations, this min is the solution of a complex
638 max-min linear system.  Have a look
639 <a href="http://lists.gforge.inria.fr/pipermail/simgrid-devel/2006-April/thread.html">here</a>
640 and read the two threads "Bug in SURF?" and "Surf bug not
641 fixed?". You'll have a few other examples of such computations. You
642 can also read "A Network Model for Simulation of Grid Application" by
643 Henri Casanova and Loris Marchal to have all the details. The fact
644 that the real_bw is smaller than bw is easy to understand. The fact
645 that real_bw is smaller than SG_TCP_CTE_GAMMA/(2*lat) is due to the
646 window-based congestion mechanism of TCP. With TCP, you can't exploit
647 your huge network capacity if you don't have a good round-trip-time
648 because of the acks...
649
650 Anyway, what you get is t=lat + L/min(bw,SG_TCP_CTE_GAMMA/(2*lat)).
651
652   * if I you set (bw,lat)=(100 000 000, 0.00001), you get t =  1.00001 (you fully
653 use your link)
654   * if I you set (bw,lat)=(100 000 000, 0.0001),  you get t =  1.0001 (you're on the
655 limit)
656   * if I you set (bw,lat)=(100 000 000, 0.001),   you get t = 10.001  (ouch!)
657
658 This bound on the effective bandwidth of a flow is not the only thing
659 that may make your result be unexpected. For example, two flows
660 competing on a saturated link receive an amount of bandwidth inversely
661 proportional to their round trip time.
662
663 \subsection faq_bugrepport So I've found a bug in SimGrid. How to report it?
664
665 We do our best to make sure to hammer away any bugs of SimGrid, but this is
666 still an academic project so please be patient if/when you find bugs in it.
667 If you do, the best solution is to drop an email either on the simgrid-user
668 or the simgrid-devel mailing list and explain us about the issue.  You can
669 also decide to open a formal bug report using the
670 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">relevant
671 interface</a>. You need to login on the server to get the ability to submit
672 bugs.
673
674 We will do our best to solve any problem repported, but you need to help us
675 finding the issue. Just telling "it segfault" isn't enough. Telling "It
676 segfaults when running the attached simulator" doesn't really help either.
677 You may find the following article interesting to see how to repport
678 informative bug repports:
679 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (it is not SimGrid
680 specific at all, but it's full of good advices).
681
682 \author Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
683
684 */