1 /*! \page faq Frequently Asked Questions
3 \htmlinclude .FAQ.doc.toc
5 \section faq_simgrid I'm new to SimGrid. I have some questions. Where should I start?
7 You are at the right place... Having a look to these
8 <a href="http://graal.ens-lyon.fr/~alegrand/articles/slides_g5k_simul.pdf">slides</a>
10 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">"obsolete" slides</a>)
11 may give you some insights on what SimGrid can help you to do and what
12 are its limitations. Then you definitely should read the \ref
13 MSG_examples. There is also a mailing list: <simgrid-user@lists.gforge.inria.fr>.
15 \subsection faq_interfaces What is the difference between MSG, SimDag, and GRAS? Do they serve the same purpose?
17 It depend on how you define "purpose", I guess ;)
19 They all allow you to build a prototype of application which you can run
20 within the simulator afterward. They all share the same simulation kernel,
21 which is the core of the SimGrid project. They differ by the way you express
24 With SimDag, you express your code as a collection of interdependent
25 parallel tasks. So, in this model, applications can be seen as a DAG of
26 tasks. This is the interface of choice for people wanting to port old
27 code designed for SimGrid v1 or v2 to the lastest framework.
29 With both GRAS and MSG, your application is seen as a set of communicating
30 processes, exchanging data by the way of messages and performing computation
33 The difference between both is that MSG is somehow easier to use, but GRAS
34 is not limitated to the simulator. Once you're done writing your GRAS code,
35 you can run your code both in the simulator or on a real platform. For this,
36 there is two implementations of the GRAS interface, one for simulation, one
37 for real execution. So, you just have to relink your code to chose one of
40 \subsection faq_generic First steps with SimGrid
42 If you decide to go for the MSG interface, please read carefully the
43 \ref MSG_examples. You'll find in \ref MSG_ex_master_slave a very
44 simple consisting of a master (that owns a bunch of tasks and
45 distributes them) , some slaves (that process tasks whenever they
46 receive one) and some forwarder agents (that simply pass the tasks
47 they receive to some slaves).
49 If you decide to go for the GRAS interface, you should definitively
50 read the \ref GRAS_tut. The first section constitutes an introduction
51 to the tool and presents the model we use. The second section
52 constitutes a complete step-by-step tutorial building a distributed
53 application from the begining and exemplifying most of the GRAS
54 features in the process. The last section groups some HOWTOS
55 highlighting a given feature of the framework in a more concise way.
57 If you decide to go for another interface, I'm afraid your only sources
58 of information will be the source code and the mailing lists...
60 \subsection faq_visualization Visualizing and analyzing the results
62 It is sometime convenient to "see" how the agents are behaving. If you
63 like colors, you can use <tt>tools/MSG_visualization/colorize.pl </tt>
64 as a filter to your MSG outputs. It works directly with INFO. Beware,
65 INFO() prints on stderr. Do not forget to redirect if you want to
66 filter (e.g. with bash):
68 ./msg_test small_platform.xml small_deployment.xml 2>&1 | ../../tools/MSG_visualization/colorize.pl
71 We also have a more graphical output. Have a look at MSG_paje_output(). It
72 generates an input to <a href="http://www-id.imag.fr/Logiciels/paje/">Paje</a>.
75 <a href="Paje_MSG_screenshot.jpg"><img src="Paje_MSG_screenshot_thn.jpg"></a>
79 Vizualization with Paje can be seen as a kind of postmortem
80 analysis. However, as soon as you start playing with big simulations,
81 you'll realize that processing such output is kind of tricky. There is
82 so much generic informations that it is hard to find the information
85 As a matter of fact, loging really depends on simulations (e.g. what
86 kind of events is important...). That is why we do not propose a big
87 dump of your whole simulation (it would slow everything down) but give
88 you neat tools to structure you logs. Have a look at \ref XBT_log. In
89 fact, rather than a post-mortem analysis, you may want to do it on the
90 fly. The process you are running can do whatever you want. Have you
91 thought about adding a global structure where you directly compute the
92 informations that are really important rather than writing everything
93 down and then processing huge files?
95 \subsection faq_C Argh! Do I really have to code in C?
97 Up until now, there is no binding for other languages. If you use C++,
98 you should be able to use the SimGrid library as a standard C library
99 and everything should work fine (simply <i>link</i> against this
100 library; recompiling SimGrid with a C++ compiler won't work and it
101 wouldn't help if you could).
103 In fact, we are currently working on Java bindings of MSG to allow
104 all the undergrad students of the world to use this tool. This is a
105 little more tricky than I would have expected, but the work is moving
106 fast forward [2006/05/13]. More languages are evaluated, but for now,
107 we do not feel a real demand for any other language. Please speak up!
109 \section faq_installation Installing the SimGrid library
111 Many people have been asking me questions on how to use SimGrid. Quite
112 often, the questions were not really about SimGrid but on the
113 installation process. This section is intended to help people that are
114 not familiar with compiling C files under UNIX. If you follow these
115 instructions and still have some troubles, drop an e-mail to
116 <simgrid-user@lists.gforge.inria.fr>.
118 \subsection faq_compiling Compiling SimGrid from an archive
120 First of all, you need to download the latest version of SimGrid from
121 <a href="http://gforge.inria.fr/frs/?group_id=12">here</a>.
122 Suppose you have uncompressed SimGrid in some temporary location of
123 your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
124 simplest way to use SimGrid is to install it in your home
125 directory. Change your directory to
126 <tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
128 \verbatim./configure --prefix=$HOME
133 If at some point, something fails, check the section "\ref
134 faq_trouble_compil". If it does not help, you can report this problem to the
135 list but, please, avoid sending a laconic mail like "There is a problem. Is it
136 okay?". Send the config.log file which is automatically generated by
137 configure. Try to capture both the standard output and the error output of the
138 <tt>make</tt> command with <tt>script</tt>. There is no way for us to help you
139 without the relevant bits of information.
141 Now, the following directory should have been created :
143 \li <tt>/home/joe/doc/simgrid/html/</tt>
144 \li <tt>/home/joe/lib/</tt>
145 \li <tt>/home/joe/include/</tt>
147 SimGrid is not a binary, it is a library. Both a static and a dynamic
148 version are available. Here is what you can find if you try a <tt>ls
151 \verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
154 Thus, there is two ways to link your program with SimGrid:
155 \li Either you use the static version, e.g
156 \verbatim gcc libsimgrid.a -o MainProgram MainProgram.c
158 In this case, all the SimGrid functions are directly
159 included in <tt>MainProgram</tt> (hence a bigger binary).
160 \li Either you use the dynamic version (the preferred method)
161 \verbatim gcc -lsimgrid -o MainProgram MainProgram.c
163 In this case, the SimGrid functions are not included in
164 <tt>MainProgram</tt> and you need to set your environment
165 variable in such a way that <tt>libsimgrid.so</tt> will be
166 found at runtime. This can be done by adding the following
167 line in your .bashrc (if you use bash and if you have
168 installed the SimGrid libraries in your home directory):
169 \verbatim export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
173 \subsection faq_compiling_svn Compiling SimGrid from the SVN
175 The project development takes place in the svn, where all changes are
176 commited when they happen. Then every once in a while, we make sure that the
177 code quality meets our standard and release an archive from the code in the
178 SVN. We afterward go back to the development in the SVN. So, if you need a
179 recently added feature and can afford some little problem with the stability
180 of the lastest features, you may want to use the SVN version instead of a
183 For that, you first need to get the "simgrid" module from
184 <a href="http://gforge.inria.fr/scm/?group_id=12">here</a>.
186 You won't find any <tt>configure</tt> and a few other things
187 (<tt>Makefile.in</tt>'s, documentation, ...) will be missing as well. The
188 reason for that is that all these files have to be regenerated using the
189 latest versions of <tt>autoconf</tt>, <tt>libtool</tt>, <tt>automake</tt>
190 (>1.9) and <tt>doxygen</tt> (>1.4). To generate the <tt>configure</tt> and
191 the <tt>Makefile.in</tt>'s, you just have to launch the <tt>bootstrap</tt>
192 command that resides in the top of the source tree. Then just follow the
193 instructions of Section \ref faq_compiling.
195 We insist on the fact that you really need the latest versions of
196 autoconf, automake and libtool. Doing this step on exotic architectures/systems
197 (i.e. anything different from a recent linux distribution) may be
198 ... uncertain. If you need to compile the SVN version on a machine where all these
199 dependencies are not met, the easiest is to do <tt>make dist</tt> in the SVN
200 dir of another machine where all dependencies are met. It will create an
201 archive you may deploy on other sites just as a regular stable release.
203 In summary, the following commands will checkout the SVN, regenerate the
204 configure script and friends, configure SimGrid and build it.
206 \verbatim svn checkout svn://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk simgrid
209 ./configure --enable-maintainer-mode --prefix=<where to install SimGrid>
212 Then, if you want to install SimGrid on the current box, just do:
213 \verbatim make install \endverbatim
215 If you want to build an snapshot of the SVN to deploy it on another box (for
216 example because the other machine don't have the autotools), do:
217 \verbatim make dist \endverbatim
219 Moreover, you should never call the autotools manually since you must run
220 them in a specific order with specific arguments. Most of the times, the
221 makefiles will automatically call the tools for you. When it's not possible
222 (such as the first time you checkout the SVN), use the ./bootstrap command
223 to call them explicitely.
226 \subsection faq_setting_MSG Setting up your own MSG code
228 Do not build your simulator by modifying the SimGrid examples. Go
229 outside the SimGrid source tree and create your own working directory
230 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
232 Suppose your simulation has the following structure (remember it is
233 just an example to illustrate a possible way to compile everything;
234 feel free to organize it as you want).
236 \li <tt>sched.h</tt>: a description of the core of the
237 scheduler (i.e. which functions are can be used by the
238 agents). For example we could find the following functions
239 (master, forwarder, slave).
241 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
242 implementing the core of the scheduler. Most of these
243 functions use the MSG functions defined in section \ref
246 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
247 the MSG initialization (MSG_global_init()), the platform
248 creation (e.g. with MSG_create_environment()), the
249 deployment phase (e.g. with MSG_function_register() and
250 MSG_launch_application()) and the call to
253 To compile such a program, we suggest to use the following
254 Makefile. It is a generic Makefile that we have used many times with
255 our students when we teach the C language.
259 masterslave: masterslave.o sched.o
261 INSTALL_PATH = $$HOME
263 PEDANTIC_PARANOID_FREAK = -O0 -Wshadow -Wcast-align \
264 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
265 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
266 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
267 -Wpointer-arith -Wwrite-strings -finline-functions
268 REASONABLY_CAREFUL_DUDE = -Wall
269 NO_PRAYER_FOR_THE_WICKED = -w -O2
270 WARNINGS = $(REASONABLY_CAREFUL_DUDE)
271 CFLAGS = -g $(WARNINGS)
273 INCLUDES = -I$(INSTALL_PATH)/include
274 DEFS = -L$(INSTALL_PATH)/lib/
275 LDADD = -lm -lsimgrid
279 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
282 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
285 rm -f $(BIN_FILES) *.o *~
291 The first two lines indicates what should be build when typing make
292 (<tt>masterslave</tt>) and of which files it is to be made of
293 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
294 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
295 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
296 the static version, remove the <tt>-lsimgrid</tt> and add a
297 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
298 after the <tt>LIBS = </tt>.
300 More generally, if you have never written a Makefile by yourself, type
301 in a terminal : <tt>info make</tt> and read the introduction. The
302 previous example should be enough for a first try but you may want to
303 perform some more complex compilations...
305 \subsection faq_setting_GRAS Setting up your own GRAS code
307 If you use the GRAS interface instead of the MSG one, then previous section
308 is not the better source of information. Instead, you should check the GRAS
309 tutorial in general, and the \ref GRAS_tut_tour_setup in particular.
311 \subsection faq_crosscompile Cross-compiling a Windows DLL of SimGrid from linux
313 At the moment, we do not distribute Windows pre-compiled version of SimGrid
314 because the support for this platform is still experimental. We know that
315 some parts of the GRAS environment do not work, and we think that the others
316 environments (MSG and SD) have good chances to work, but we didn't test
317 ourselves. This section explains how we generate the SimGrid DLL so that you
318 can build it for yourself. First of all, you need to have a version more
319 recent than 3.1 (ie, a SVN version as time of writting).
321 In order to cross-compile the package to windows from linux, you need to
322 install mingw32 (minimalist gnu win32). On Debian, you can do so by
323 installing the packages mingw32 (compiler), mingw32-binutils (linker and
324 so), mingw32-runtime.
326 You can use the VPATH support of configure to compile at the same time for
327 linux and windows without dupplicating the source nor cleaning the tree
328 between each. Just run bootstrap (if you use the SVN) to run the autotools.
329 Then, create a linux and a win directories. Then, type:
330 \verbatim cd linux; ../configure --srcdir=.. <usual configure flags>; make; cd ..
331 cd win; ../configure --srcdir=.. --host=i586-mingw32msvc <flags>; make; cd ..
333 The trick to VPATH builds is to call configure from another directory,
334 passing it an extra --srcdir argument to tell it where all the sources are.
335 It will understand you want to use VPATH. Then, the trick to cross-compile
336 is simply to add a --host argument specifying the target you want to build
337 for. The i586-mingw32msvc string is what you have to pass to use the mingw32
338 environment as distributed in Debian.
340 After that, you can run all make targets from both directories, and test
341 easily that what you change for one arch does not break the other one.
343 It is possible that this VPATH build thing breaks from time to time in the
344 SVN since it's quite fragile, but it's granted to work in any released
345 version. If you experience problems, drop us a mail.
347 Another possible source of issue is that at the moment, building the
348 examples request to use the gras_stub_generator tool, which is a compiled
349 program, not a script. In cross-compilation, you need to cross-execute with
350 wine for example, which is not really pleasant. We are working on this, but
351 in the meanwhile, simply don't build the examples in cross-compilation
352 (<tt>cd src</tt> before running make).
354 Program (cross-)compiled with mingw32 do request an extra DLL at run-time to be
355 usable. For example, if you want to test your build with wine, you should do
356 the following to put this library where wine looks for DLLs.
358 cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz ~/.wine/c/windows/system/
359 gunzip ~/.wine/c/windows/system/mingwm10.dll.gz
362 The DLL is builded in src/.libs, and installed in the <i>prefix</i>/bin directory
363 when you run make install.
365 If you want to use it in a native project on windows, you need to use
366 simgrid.dll and mingwm10.dll. For each DLL, you need to build .def file
367 under linux (listing the defined symbols), and convert it into a .lib file
368 under windows (specifying this in a way that windows compilers like). To
369 generate the def files, run (under linux):
370 \verbatim echo "LIBRARY libsimgrid-0.dll" > simgrid.def
371 echo EXPORTS >> simgrid.def
372 nm libsimgrid-0.dll | grep ' T _' | sed 's/.* T _//' >> simgrid.def
373 nm libsimgrid-0.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> simgrid.def
375 echo "LIBRARY mingwm10.dll" > mingwm10.def
376 echo EXPORTS >> mingwm10.def
377 nm mingwm10.dll | grep ' T _' | sed 's/.* T _//' >> mingwm10.def
378 nm mingwm10.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> mingwm10.def
381 To create the import .lib files, use the <tt>lib</tt> windows tool (from
382 MSVC) the following way to produce simgrid.lib and mingwm10.lib
383 \verbatim lib /def:simgrid.def
384 lib /def:mingwm10.def
387 If you happen to use Borland C Builder, the right command line is the
388 following (note that you don't need any file.def to get this working).
389 \verbatim implib simgrid.lib libsimgrid-0.dll
390 implib mingwm10.lib mingwm10.dll
393 Then, set the following parameters in Visual C++ 2005:
394 Linker -> Input -> Additional dependencies = simgrid.lib mingwm10.lib
396 Just in case you wonder how to generate a DLL from libtool in another
397 project, we added -no-undefined to any lib*_la_LDFLAGS variables so that
398 libtool accepts to generate a dynamic library under windows. Then, to make
399 it true, we pass any dependencies (such as -lws2 under windows or -lpthread
400 on need) on the linking line. Passing such deps is a good idea anyway so
401 that they get noted in the library itself, avoiding the users to know about
402 our dependencies and put them manually on their compilation line. Then we
403 added the AC_LIBTOOL_WIN32_DLL macro just before AC_PROG_LIBTOOL in the
404 configure.ac. It means that we exported any symbols which need to be.
405 Nowadays, functions get automatically exported, so we don't need to load our
406 header files with tons of __declspec(dllexport) cruft. We only need to do so
407 for data, but there is no public data in SimGrid so we are good.
409 \section faq_howto Feature related questions
411 \subsection faq_MIA "Could you please add (your favorite feature here) to SimGrid?"
413 Here is the deal. The whole SimGrid project (MSG, SURF, GRAS, ...) is
414 meant to be kept as simple and generic as possible. We cannot add
415 functions for everybody's need when these functions can easily be
416 built from the ones already in the API. Most of the time, it is
417 possible and when it was not possible we always have upgraded the API
418 accordingly. When somebody asks us a question like "How to do that?
419 Is there a function in the API to simply do this?", we're always glad
420 to answer and help. However if we don't need this code for our own
421 need, there is no chance we're going to write it... it's your job! :)
422 The counterpart to our answers is that once you come up with a neat
423 implementation of this feature (task duplication, RPC, thread
424 synchronization, ...), you should send it to us and we will be glad to
425 add it to the distribution. Thus, other people will take advantage of
426 it (and we don't have to answer this question again and again ;).
428 You'll find in this section a few "Missing In Action" features. Many
429 people have asked about it and we have given hints on how to simply do
430 it with MSG. Feel free to contribute...
432 \subsection faq_MIA_MSG MSG features
434 \subsubsection faq_MIA_examples I want some more complex MSG examples!
436 Many people have come to ask me a more complex example and each time,
437 they have realized afterward that the basics were in the previous three
440 Of course they have often been needing more complex functions like
441 MSG_process_suspend(), MSG_process_resume() and
442 MSG_process_isSuspended() (to perform synchronization), or
443 MSG_task_Iprobe() and MSG_process_sleep() (to avoid blocking
444 receptions), or even MSG_process_create() (to design asynchronous
445 communications or computations). But the examples are sufficient to
448 We know. We should add some more examples, but not really some more
449 complex ones... We should add some examples that illustrate some other
450 functionalities (like how to simply encode asynchronous
451 communications, RPC, process migrations, thread synchronization, ...)
452 and we will do it when we will have a little bit more time. We have
453 tried to document the examples so that they are understandable. Tell
454 us if something is not clear and once again feel free to participate!
457 \subsubsection faq_MIA_taskdup Missing in action: MSG Task duplication/replication
459 There is no task duplication in MSG. When you create a task, you can
460 process it or send it somewhere else. As soon as a process has sent
461 this task, he doesn't have this task anymore. It's gone. The receiver
462 process has got the task. However, you could decide upon receiving to
463 create a "copy" of a task but you have to handle by yourself the
464 semantic associated to this "duplication".
466 As we already told, we prefer keeping the API as simple as
467 possible. This kind of feature is rather easy to implement by users
468 and the semantic you associate really depends on people. Having a
469 *generic* task duplication mechanism is not that trivial (in
470 particular because of the data field). That is why I would recommand
471 that you write it by yourself even if I can give you advice on how to
474 You have the following functions to get informations about a task:
475 MSG_task_get_name(), MSG_task_get_compute_duration(),
476 MSG_task_get_remaining_computation(), MSG_task_get_data_size(),
477 and MSG_task_get_data().
479 You could use a dictionnary (#xbt_dict_t) of dynars (#xbt_dynar_t). If
480 you still don't see how to do it, please come back to us...
482 \subsubsection faq_MIA_asynchronous I want to do asynchronous communications in MSG
484 Up until now, there is no asynchronous communications in MSG. However,
485 you can create as many process as you want so you should be able to do
486 whatever you want... I've written a queue module to help implementing
487 some asynchronous communications at low cost (creating thousands of
488 process only to handle communications may be problematic in term of
489 performance at some point). I'll add it in the distribution asap.
491 \subsubsection faq_MIA_thread_synchronization I need to synchronize my MSG processes
493 You obviously cannot use pthread_mutexes of pthread_conds. The best
494 thing would be to propose similar structures. Unfortunately, we
495 haven't found time to do it yet. However you can try to play with
496 MSG_process_suspend() and MSG_process_resume(). You can even do some
497 synchronization with fake communications (using MSG_task_get(),
498 MSG_task_put() and MSG_task_Iprobe()).
500 \subsubsection faq_MIA_host_load Where is the get_host_load function hidden in MSG?
502 There is no such thing because its semantic wouldn't be really
503 clear. Of course, it is something about the amount of host throughput,
504 but there is as many definition of "host load" as people asking for
505 this function. First, you have to remember that resource availability
506 may vary over time, which make any load notion harder to define.
508 It may be instantaneous value or an average one. Moreover it may be only the
509 power of the computer, or may take the background load into account, or may
510 even take the currently running tasks into account. In some SURF models,
511 communications have an influence on computational power. Should it be taken
514 First of all, it's near to impossible to predict the load beforehands in the
515 simulator since it depends on too much parameters (background load
516 variation, bandwidth sharing algorithmic complexity) some of them even being
517 not known beforehands (other task starting at the same time). So, getting
518 this information is really hard (just like in real life). It's not just that
519 we want MSG to be as painful as real life. But as it is in some way
520 realistic, we face some of the same problems as we would face in real life.
522 How would you do it for real? The most common option is to use something
523 like NWS that performs active probes. The best solution is probably to do
524 the same within MSG, as in next code snippet. It is very close from what you
525 would have to do out of the simulator, and thus gives you information that
526 you could also get in real settings to not hinder the realism of your
530 double get_host_load() {
531 m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
532 double date = MSG_get_clock();
534 MSG_task_execute(task);
535 date = MSG_get_clock() - date;
536 MSG_task_destroy(task);
541 Of course, it may not match your personal definition of "host load". In this
542 case, please detail what you mean on the mailing list, and we will extend
543 this FAQ section to fit your taste if possible.
545 \subsubsection faq_MIA_communication_time How can I get the *real* communication time?
547 Communications are synchronous and thus if you simply get the time
548 before and after a communication, you'll only get the transmission
549 time and the time spent to really communicate (it will also take into
550 account the time spent waiting for the other party to be
551 ready). However, getting the *real* communication time is not really
552 hard either. The following solution is a good starting point.
557 m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
558 calloc(1,sizeof(double)));
559 *((double*) task->data) = MSG_get_clock();
560 MSG_task_put(task, slaves[i % slaves_count], PORT_22);
561 INFO0("Send completed");
566 m_task_t task = NULL;
569 time1 = MSG_get_clock();
570 a = MSG_task_get(&(task), PORT_22);
571 time2 = MSG_get_clock();
572 if(time1<*((double *)task->data))
573 time1 = *((double *) task->data);
574 INFO1("Communication time : \"%f\" ", time2-time1);
576 MSG_task_destroy(task);
581 \subsection faq_MIA_SimDag SimDag related questions
583 \subsubsection faq_SG_comm Implementing communication delays between tasks.
585 A classic question of SimDag newcommers is about how to express a
586 communication delay between tasks. The thing is that in SimDag, both
587 computation and communication are seen as tasks. So, if you want to
588 model a data dependency between two DAG tasks t1 and t2, you have to
589 create 3 SD_tasks: t1, t2 and c and add dependencies in the following
593 SD_task_dependency_add(NULL, NULL, t1, c);
594 SD_task_dependency_add(NULL, NULL, c, t2);
597 This way task t2 cannot start before the termination of communication c
598 which in turn cannot start before t1 ends.
600 When creating task c, you have to associate an amount of data (in bytes)
601 corresponding to what has to be sent by t1 to t2.
603 Finally to schedule the communication task c, you have to build a list
604 comprising the workstations on which t1 and t2 are scheduled (w1 and w2
605 for example) and build a communication matrix that should look like
608 \subsubsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
610 Distributed is somehow "contagious". If you start making distributed
611 decisions, there is no way to handle DAGs directly anymore (unless I
612 am missing something). You have to encode your DAGs in term of
613 communicating process to make the whole scheduling process
614 distributed. Here is an example of how you could do that. Assume T1
615 has to be done before T2.
618 int your_agent(int argc, char *argv[] {
620 T1 = MSG_task_create(...);
621 T2 = MSG_task_create(...);
625 if(cond) MSG_task_execute(T1);
627 if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
630 /* do something else */
636 If you decide that the distributed part is not that much important and that
637 DAG is really the level of abstraction you want to work with, then you should
638 give a try to \ref SD_API.
640 \subsection faq_MIA_generic Generic features
642 \subsubsection faq_more_processes Increasing the amount of simulated processes
644 Here are a few tricks you can apply if you want to increase the amount
645 of processes in your simulations.
647 - <b>A few thousands of simulated processes</b> (soft tricks)\n
648 SimGrid can use either pthreads library or the UNIX98 contextes. On
649 most systems, the number of pthreads is limited and then your
650 simulation may be limited for a stupid reason. This is especially
651 true with the current linux pthreads, and I cannot get more than
652 2000 simulated processes with pthreads on my box. The UNIX98
653 contexts allow me to raise the limit to 25,000 simulated processes
655 The <tt>--with-context</tt> option of the <tt>./configure</tt>
656 script allows you to choose between UNIX98 contextes
657 (<tt>--with-context=ucontext</tt>) and the pthread version
658 (<tt>--with-context=pthread</tt>). The default value is ucontext
659 when the script detect a working UNIX98 context implementation. On
660 Windows boxes, the provided value is discarded and an adapted
661 version is picked up.\n\n
662 We experienced some issues with contextes on some rare systems
663 (solaris 8 and lower or old alpha linuxes comes to mind). The main
664 problem is that the configure script detect the contextes as being
665 functional when it's not true. If you happen to use such a system,
666 switch manually to the pthread version, and provide us with a good
667 patch for the configure script so that it is done automatically ;)
669 - <b>Hundred thousands of simulated processes</b> (hard-core tricks)\n
670 As explained above, SimGrid can use UNIX98 contextes to represent
671 and handle the simulated processes. Thanks to this, the main
672 limitation to the number of simulated processes becomes the
673 available memory.\n\n
674 Here are some tricks I had to use in order to run a token ring
675 between 25,000 processes on my laptop (1Gb memory, 1.5Gb swap).\n
676 - First of all, make sure your code runs for a few hundreds
677 processes before trying to push the limit. Make sure it's
678 valgrind-clean, ie that valgrind does not report neither memory
679 error nor memory leaks. Indeed, numerous simulated processes
680 result in *fat* simulation hindering debugging.
681 - It was really boring to write 25,000 entries in the deployment
682 file, so I wrote a little script
683 <tt>examples/gras/mutual_exclusion/simple_token/make_deployment.pl</tt>, which you may
684 want to adapt to your case. You could also think about hijacking
685 the SURFXML parser (have look at \ref faq_flexml_bypassing).
686 - The deployment file became quite big, so I had to do what is in
687 the FAQ entry \ref faq_flexml_limit
688 - Each UNIX98 context has its own stack entry. As debugging this is
689 quite hairly, the default value is a bit overestimated so that
690 user don't get into trouble about this. You want to tune this
691 size to increse the number of processes. This is the
692 <tt>STACK_SIZE</tt> define in
693 <tt>src/xbt/xbt_context_sysv.c</tt>, which is 128kb by default.
694 Reduce this as much as you can, but be warned that if this value
695 is too low, you'll get a segfault. The token ring example, which
696 is quite simple, runs with 40kb stacks.
697 - You may tweak the logs to reduce the stack size further. When
698 logging something, we try to build the string to display in a
699 char array on the stack. The size of this array is constant (and
700 equal to XBT_LOG_BUFF_SIZE, defined in include/xbt/log/h). If the
701 string is too large to fit this buffer, we move to a dynamically
702 sized buffer. In which case, we have to traverse one time the log
703 event arguments to compute the size we need for the buffer,
704 malloc it, and traverse the argument list again to do the actual
706 The idea here is to move XBT_LOG_BUFF_SIZE to 1, forcing the logs
707 to use a dynamic array each time. This allows us to lower further
708 the stack size at the price of some performance loss...\n
709 This allowed me to run the reduce the stack size to ... 4k. Ie,
710 on my 1Gb laptop, I can run more than 250,000 processes!
712 \subsubsection faq_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid?
714 No, there is no native support for batch schedulers and none is
715 planned because this is a very specific need (and doing it in a
716 generic way is thus very hard). However some people have implemented
717 their own batch schedulers. Vincent Garonne wrote one during his PhD
718 and put his code in the contrib directory of our SVN so that other can
719 keep working on it. You may find inspinring ideas in it.
721 \subsubsection faq_MIA_checkpointing I need a checkpointing thing
723 Actually, it depends on whether you want to checkpoint the simulation, or to
724 simulate checkpoints.
726 The first one could help if your simulation is a long standing process you
727 want to keep running even on hardware issues. It could also help to
728 <i>rewind</i> the simulation by jumping sometimes on an old checkpoint to
729 cancel recent calculations.\n
730 Unfortunately, such thing will probably never exist in SG. One would have to
731 duplicate all data structures because doing a rewind at the simulator level
732 is very very hard (not talking about the malloc free operations that might
733 have been done in between). Instead, you may be interested in the Libckpt
734 library (http://www.cs.utk.edu/~plank/plank/www/libckpt.html). This is the
735 checkpointing solution used in the condor project, for example. It makes it
736 easy to create checkpoints (at the OS level, creating something like core
737 files), and rerunning them on need.
739 If you want to simulate checkpoints instead, it means that you want the
740 state of an executing task (in particular, the progress made towards
741 completion) to be saved somewhere. So if a host (and the task executing on
742 it) fails (cf. #MSG_HOST_FAILURE), then the task can be restarted
743 from the last checkpoint.\n
745 Actually, such a thing does not exists in SimGrid either, but it's just
746 because we don't think it is fundamental and it may be done in the user code
747 at relatively low cost. You could for example use a watcher that
748 periodically get the remaining amount of things to do (using
749 MSG_task_get_remaining_computation()), or fragment the task in smaller
752 \subsection faq_platform Platform building and Dynamic resources
754 \subsubsection faq_platform_example Where can I find SimGrid platform files?
756 There is several little examples in the archive, in the examples/msg
757 directory. From time to time, we are asked for other files, but we
758 don't have any at hand right now.
760 We do have a description of the Grid'5000 platform, but because of
761 some flaws in the current formalism, this file is actually 500Mb,
762 which is ways too big to be used in the parser. We have an internship
763 currently working on xml syntax improvements which will allow to
764 reduce the size of this file and release it.
766 Once it's done, we plan to model manually other existing platforms the
767 same way we did for G5K and also release those files in some sort of
768 SimGrid platform catalog project.
770 \subsubsection faq_platform_alnem How can I automatically map an existing platform?
772 We are working on a project called ALNeM (Application-Level Network
773 Mapper) which goal is to automatically discover the topology of an
774 existing network. Its output will be a platform description file
775 following the SimGrid syntax, so everybody will get the ability to map
776 their own lab network (and contribute them to the catalog project).
777 This tool is not ready yet, but it move quite fast forward. Just stay
780 \subsubsection faq_platform_synthetic Generating synthetic but realistic platforms
782 The third possibility to get a platform file (after manual or
783 automatic mapping of real platforms) is to generate synthetic
784 platforms. Getting a realistic result is not a trivial task, and
785 moreover, nobody is really able to define what "realistic" means when
786 speaking of topology files. You can find some more thoughts on this
788 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">slides</a>.
790 If you are looking for an actual tool, there we have a little tool to
791 annotate Tiers-generated topologies. This perl-script is in
792 <tt>tools/platform_generation/</tt> directory of the SVN. Dinda et Al.
793 released a very comparable tool, and called it GridG.
795 \subsubsection faq_SURF_dynamic Expressing dynamic resource availability in platform files
797 A nice feature of SimGrid is that it enables you to seamlessly have
798 resources whose availability change over time. When you build a
799 platform, you generally declare hosts like that:
802 <host id="host A" power="100.00"/>
805 If you want the availability of "host A" to change over time, the only
806 thing you have to do is change this definition like that:
809 <host id="host A" power="100.00" availability_file="trace_A.txt" state_file="trace_A_failure.txt"/>
812 For hosts, availability files are expressed in fraction of available
813 power. Let's have a look at what "trace_A.txt" may look like:
822 At time 0, our host will deliver 100 flop/s. At time 11.0, it will
823 deliver only 50 flop/s until time 20.0 where it will will start
824 delivering 90 flop/s. Last at time 21.0 (20.0 plus the periodicity
825 1.0), we'll be back to the beginning and it will deliver 100 flop/s.
827 Now let's look at the state file:
834 A negative value means "off" while a positive one means "on". At time
835 1.0, the host is on. At time 1.0, it is turned off and at time 2.0, it
836 is turned on again until time 12 (2.0 plus the periodicity 10.0). It
837 will be turned on again at time 13.0 until time 23.0, and so on.
839 Now, let's look how the same kind of thing can be done for network
840 links. A usual declaration looks like:
843 <link id="LinkA" bandwidth="10.0" latency="0.2"/>
846 You have at your disposal the following options: bandwidth_file,
847 latency_file and state_file. The only difference with hosts is that
848 bandwidth_file and latency_file do not express fraction of available
849 power but are expressed directly in bytes per seconds and seconds.
851 \subsubsection faq_platform_multipath How to express multipath routing in platform files?
853 It is unfortunately impossible to express the fact that there is more
854 than one routing path between two given hosts. Let's consider the
855 following platform file:
858 <route src="A" dst="B">
861 <route src="B" dst="C">
864 <route src="A" dst="C">
869 Althrough it is perfectly valid, it does not mean that data traveling
870 from A to C can either go directly (using link 3) or through B (using
871 links 1 and 2). It simply means that the routing on the graph is not
872 trivial, and that data do not following the shortest path in number of
873 hops on this graph. Another way to say it is that there is no implicit
874 in these routing descriptions. The system will only use the routes you
875 declare (such as <route src="A" dst="C"><link:ctn
876 id="3"/></route>), without trying to build new routes by aggregating
879 You are also free to declare platform where the routing is not
880 symetric. For example, add the following to the previous file:
883 <route src="C" dst="A">
889 This makes sure that data from C to A go through B where data from A
890 to C go directly. Don't worry about realism of such settings since
891 we've seen ways more weird situation in real settings (in fact, that's
892 the realism of very regular platforms which is questionable, but
893 that's another story).
895 \subsubsection faq_flexml_bypassing Bypassing the XML parser with your own C functions
897 So you want to bypass the XML files parser, uh? Maybe doin some parameter
898 sweep experiments on your simulations or so? This is possible, and
899 it's not even really difficult (well. Such a brutal idea could be
900 harder to implement). Here is how it goes.
902 For this, you have to first remember that the XML parsing in SimGrid is done
903 using a tool called FleXML. Given a DTD, this gives a flex-based parser. If
904 you want to bypass the parser, you need to provide some code mimicking what
905 it does and replacing it in its interactions with the SURF code. So, let's
906 have a look at these interactions.
908 FleXML parser are close to classical SAX parsers. It means that a
909 well-formed SimGrid platform XML file might result in the following
912 - start "platform_description" with attribute version="2"
913 - start "host" with attributes id="host1" power="1.0"
915 - start "host" with attributes id="host2" power="2.0"
917 - start "link" with ...
919 - start "route" with ...
920 - start "link:ctn" with ...
923 - end "platform_description"
925 The communication from the parser to the SURF code uses two means:
926 Attributes get copied into some global variables, and a surf-provided
927 function gets called by the parser for each event. For example, the event
928 - start "host" with attributes id="host1" power="1.0"
930 let the parser do something roughly equivalent to:
932 strcpy(A_host_id,"host1");
937 In SURF, we attach callbacks to the different events by initializing the
938 pointer functions to some the right surf functions. Since there can be
939 more than one callback attached to the same event (if more than one
940 model is in use, for example), they are stored in a dynar. Example in
941 workstation_ptask_L07.c:
943 /* Adding callback functions */
944 surf_parse_reset_parser();
945 surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
946 surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
947 surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
948 surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
949 surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
950 surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
953 surf_parse_open(file);
954 xbt_assert1((!surf_parse()), "Parse error in %s", file);
958 So, to bypass the FleXML parser, you need to write your own version of the
959 surf_parse function, which should do the following:
960 - Fill the A_<tag>_<attribute> variables with the wanted values
961 - Call the corresponding STag_<tag>_fun function to simulate tag start
962 - Call the corresponding ETag_<tag>_fun function to simulate tag end
963 - (do the same for the next set of values, and loop)
965 Then, tell SimGrid that you want to use your own "parser" instead of the stock one:
967 surf_parse = surf_parse_bypass_environment;
968 MSG_create_environment(NULL);
969 surf_parse = surf_parse_bypass_application;
970 MSG_launch_application(NULL);
973 A set of macros are provided at the end of
974 include/surf/surfxml_parse.h to ease the writing of the bypass
975 functions. An example of this trick is distributed in the file
976 examples/msg/masterslave/masterslave_bypass.c
978 \section faq_troubleshooting Troubleshooting
980 \subsection faq_trouble_lib_compil SimGrid compilation and installation problems
982 \subsubsection faq_trouble_lib_config ./configure fails!
984 We now only one reason for the configure to fail:
986 - <b>You are using a borken build environment</b>\n
987 If symptom is that configure complains about gcc not being able to build
988 executables, you are probably missing the libc6-dev package. Damn Ubuntu.
990 If you experience other kind of issue, please get in touch with us. We are
991 always interested in improving our portability to new systems.
993 \subsubsection faq_trouble_distcheck Dude! "make check" fails on my machine!
995 Don't assume we never run this target, because we do. Check
996 http://bob.loria.fr:8010 if you don't believe us.
998 There is several reasons which may cause the make check to fail on your
1001 - <b>You are using a borken libc (probably concerning the contextes)</b>.\n
1002 The symptom is that the "make check" fails within the examples/msg directory.\n
1003 By default, SimGrid uses something called ucontexts. This is part of the
1004 libc, but it's quite undertested. For example, some (old) versions of the
1005 glibc on alpha do not implement these functions, but provide the stubs
1006 (which return ENOSYS: not implemented). It may fool our detection mecanism
1007 and leads to segfaults. There is not much we can do to fix the bug.
1008 A workaround is to compile with --with-context=pthread to avoid
1009 ucontext completely. You'll be a bit more limitated in the number
1010 of simulated processes you can start concurently, but 5000
1011 processes is still enough for most purposes, isn't it?\n
1012 This limitation is the reason why we insist on using this piece of ...
1013 software even if it's so troublesome.\n
1014 <b>=> use --with-pthread on AMD64 architecture that do not have an
1015 ultra-recent libc.</b>
1017 - <b>There is a bug in SimGrid we aren't aware of</b>.\n
1018 If none of the above apply, please drop us a mail on the mailing list so
1019 that we can check it out. Make sure to read \ref faq_bugrepport
1022 \subsection faq_trouble_compil User code compilation problems
1024 \subsubsection faq_trouble_err_logcat "gcc: _simgrid_this_log_category_does_not_exist__??? undeclared (first use in this function)"
1026 This is because you are using the log mecanism, but you didn't created
1027 any default category in this file. You should refer to \ref XBT_log
1028 for all the details, but you simply forgot to call one of
1029 XBT_LOG_NEW_DEFAULT_CATEGORY() or XBT_LOG_NEW_DEFAULT_SUBCATEGORY().
1031 \subsubsection faq_trouble_pthreadstatic "gcc: undefinded reference to pthread_key_create"
1033 This indicates that one of the library SimGrid depends on (libpthread
1034 here) was missing on the linking command line. Dependencies of
1035 libsimgrid are expressed directly in the dynamic library, so it's
1036 quite impossible that you see this message when doing dynamic linking.
1038 If you compile your code statically (and if you use a pthread version
1039 of SimGrid -- see \ref faq_more_processes), you must absolutely
1040 specify <tt>-lpthread</tt> on the linker command line. As usual, this should
1041 come after <tt>-lsimgrid</tt> on this command line.
1043 \subsection faq_trouble_errors Runtime error messages
1045 \subsubsection faq_flexml_limit "surf_parse_lex: Assertion `next limit' failed."
1047 This is because your platform file is too big for the parser.
1049 Actually, the message comes directly from FleXML, the technology on top of
1050 which the parser is built. FleXML has the bad idea of fetching the whole
1051 document in memory before parsing it. And moreover, the memory buffer size
1052 must be determinded at compilation time.
1054 We use a value which seems big enough for our need without bloating the
1055 simulators footprints. But of course your mileage may vary. In this case,
1056 just edit src/surf/surfxml.l modify the definition of
1057 FLEXML_BUFFERSTACKSIZE. E.g.
1060 #define FLEXML_BUFFERSTACKSIZE 1000000000
1063 Then recompile and everything should be fine, provided that your version of
1064 Flex is recent enough (>= 2.5.31). If not the compilation process should
1067 A while ago, we worked on FleXML to reduce a bit its memory consumtion, but
1068 these issues remain. There is two things we should do:
1070 - use a dynamic buffer instead of a static one so that the only limit
1071 becomes your memory, not a stupid constant fixed at compilation time
1072 (maybe not so difficult).
1073 - change the parser so that it does not need to get the whole file in
1074 memory before parsing
1075 (seems quite difficult, but I'm a complete newbe wrt flex stuff).
1077 These are changes to FleXML itself, not SimGrid. But since we kinda hijacked
1078 the development of FleXML, I can grant you that any patches would be really
1079 welcome and quickly integrated.
1081 <b>Update:</b> A new version of FleXML (1.7) was released. Most of the work
1082 was done by William Dowling, who use it in his own work. The good point is
1083 that it now use a dynamic buffer, and that the memory usage was greatly
1084 improved. The downside is that William also changed some things internally,
1085 and it breaks the hack we devised to bypass the parser, as explained in
1086 \ref faq_flexml_bypassing. Indeed, this is not a classical usage of the
1087 parser, and Will didn't imagine that we may have used (and even documented)
1088 such a crude usage of FleXML. So, we now have to repare the bypassing
1089 functionnality to use the lastest FleXML version and fix the memory usage in
1092 \subsubsection faq_trouble_gras_transport GRAS spits networking error messages
1094 Gras, on real platforms, naturally use regular sockets to communicate. They
1095 are deeply hiden in the gras abstraction, but when things go wrong, you may
1096 get some weird error messages. Here are some example, with the probable
1099 - <b>Transport endpoint is not connected</b>: several processes try to open
1100 a server socket on the same port number of the same machine. This is
1101 naturally bad and each process should pick its own port number for this.\n
1102 Maybe, you just have some processes remaining from a previous experiment
1104 Killing them may help, but again if you kill -KILL them, you'll have to
1105 wait for a while: they didn't close there sockets properly and the system
1106 needs a while to notice that this port is free again.
1108 - <b>Socket closed by remote side</b>: if the remote process is not
1109 supposed to close the socket at this point, it may be dead.
1111 - <b>Connection reset by peer</b>: I found this on internet about this
1112 error. I think it's what's happening here, too:\n
1113 <i>This basically means that a network error occurred while the client was
1114 receiving data from the server. But what is really happening is that the
1115 server actually accepts the connection, processes the request, and sends
1116 a reply to the client. However, when the server closes the socket, the
1117 client believes that the connection has been terminated abnormally
1118 because the socket implementation sends a TCP reset segment telling the
1119 client to throw away the data and report an error.\n
1120 Sometimes, this problem is caused by not properly closing the
1121 input/output streams and the socket connection. Make sure you close the
1122 input/output streams and socket connection properly. If everything is
1123 closed properly, however, and the problem persists, you can work around
1124 it by adding a one-second sleep before closing the streams and the
1125 socket. This technique, however, is not reliable and may not work on all
1127 Since GRAS sockets are closed properly (repeat after me: there is no bug
1128 in GRAS), it is either that you are closing your sockets on server side
1129 before the client get a chance to read them (use gras_os_sleep() to delay
1130 the server), or the server died awfully before the client got the data.
1132 \subsubsection faq_trouble_errors_big_fat_warning I'm told that my XML files are too old.
1134 The format of the XML platform description files is sometimes
1135 improved. For example, we decided to change the units used in SimGrid
1136 from MBytes, MFlops and seconds to Bytes, Flops and seconds to ease
1137 people exchanging small messages. We also reworked the route
1138 descriptions to allow more compact descriptions.
1140 That is why the XML files are versionned using the 'version' attribute
1141 of the root tag. Currently, it should read:
1143 <platform version="2">
1146 If your files are too old, you can use the simgrid_update_xml.pl
1147 script which can be found in the tools directory of the archive.
1149 \subsection faq_trouble_valgrind Valgrind-related and other debugger issues
1151 If you don't, you really should use valgrind to debug your code, it's
1154 \subsubsection faq_trouble_vg_longjmp longjmp madness in valgrind
1156 This is when valgrind starts complaining about longjmp things, just like:
1158 \verbatim ==21434== Conditional jump or move depends on uninitialised value(s)
1159 ==21434== at 0x420DBE5: longjmp (longjmp.c:33)
1161 ==21434== Use of uninitialised value of size 4
1162 ==21434== at 0x420DC3A: __longjmp (__longjmp.S:48)
1165 This is the sign that you didn't used the exception mecanism well. Most
1166 probably, you have a <tt>return;</tt> somewhere within a <tt>TRY{}</tt>
1167 block. This is <b>evil</b>, and you must not do this. Did you read the section
1170 \subsubsection faq_trouble_vg_libc Valgrind spits tons of errors about backtraces!
1172 It may happen that valgrind, the memory debugger beloved by any decent C
1173 programmer, spits tons of warnings like the following :
1174 \verbatim ==8414== Conditional jump or move depends on uninitialised value(s)
1175 ==8414== at 0x400882D: (within /lib/ld-2.3.6.so)
1176 ==8414== by 0x414EDE9: (within /lib/tls/i686/cmov/libc-2.3.6.so)
1177 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
1178 ==8414== by 0x414F937: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
1179 ==8414== by 0x4150F4C: (within /lib/tls/i686/cmov/libc-2.3.6.so)
1180 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
1181 ==8414== by 0x415102D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
1182 ==8414== by 0x412D6B9: backtrace (in /lib/tls/i686/cmov/libc-2.3.6.so)
1183 ==8414== by 0x8076446: xbt_dictelm_get_ext (dict_elm.c:714)
1184 ==8414== by 0x80764C1: xbt_dictelm_get (dict_elm.c:732)
1185 ==8414== by 0x8079010: xbt_cfg_register (config.c:208)
1186 ==8414== by 0x806821B: MSG_config (msg_config.c:42)
1189 This problem is somewhere in the libc when using the backtraces and there is
1190 very few things we can do ourselves to fix it. Instead, here is how to tell
1191 valgrind to ignore the error. Add the following to your ~/.valgrind.supp (or
1192 create this file on need). Make sure to change the obj line according to
1193 your personnal mileage (change 2.3.6 to the actual version you are using,
1194 which you can retrieve with a simple "ls /lib/ld*.so").
1197 name: Backtrace madness
1199 obj:/lib/ld-2.3.6.so
1204 fun:__libc_dlopen_mode
1207 Then, you have to specify valgrind to use this suppression file by passing
1208 the <tt>--suppressions=$HOME/.valgrind.supp</tt> option on the command line.
1209 You can also add the following to your ~/.bashrc so that it gets passed
1210 automatically. Actually, it passes a bit more options to valgrind, and this
1211 happen to be my personnal settings. Check the valgrind documentation for
1214 \verbatim export VALGRIND_OPTS="--leak-check=yes --leak-resolution=high --num-callers=40 --tool=memcheck --suppressions=$HOME/.valgrind.supp" \endverbatim
1216 \subsubsection faq_trouble_backtraces Truncated backtraces
1218 When debugging SimGrid, it's easier to pass the
1219 --disable-compiler-optimization flag to the configure if valgrind or
1220 gdb get fooled by the optimization done by the compiler. But you
1221 should remove these flages when everything works before going in
1222 production (before launching your 1252135 experiments), or everything
1223 will run only one half of the true SimGrid potential.
1225 \subsection faq_deadlock There is a deadlock in my code!!!
1227 Unfortunately, we cannot debug every code written in SimGrid. We
1228 furthermore believe that the framework provides ways enough
1229 information to debug such informations yourself. If the textual output
1230 is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
1231 how to get a graphical one.
1233 Now, if you come up with a really simple example that deadlocks and
1234 you're absolutely convinced that it should not, you can ask on the
1235 list. Just be aware that you'll be severely punished if the mistake is
1236 on your side... We have plenty of FAQ entries to redact and new
1237 features to implement for the impenitents! ;)
1239 \subsection faq_surf_network_latency I get weird timings when I play with the latencies.
1241 OK, first of all, remember that units should be Bytes, Flops and
1242 Seconds. If you don't use such units, some SimGrid constants (e.g. the
1243 SG_TCP_CTE_GAMMA constant used in most network models) won't have the
1244 right unit and you'll end up with weird results.
1246 Here is what happens with a single transfer of size L on a link
1247 (bw,lat) when nothing else happens.
1250 0-----lat--------------------------------------------------t
1251 |-----|**** real_bw =min(bw,SG_TCP_CTE_GAMMA/(2*lat)) *****|
1254 In more complex situations, this min is the solution of a complex
1255 max-min linear system. Have a look
1256 <a href="http://lists.gforge.inria.fr/pipermail/simgrid-devel/2006-April/thread.html">here</a>
1257 and read the two threads "Bug in SURF?" and "Surf bug not
1258 fixed?". You'll have a few other examples of such computations. You
1259 can also read "A Network Model for Simulation of Grid Application" by
1260 Henri Casanova and Loris Marchal to have all the details. The fact
1261 that the real_bw is smaller than bw is easy to understand. The fact
1262 that real_bw is smaller than SG_TCP_CTE_GAMMA/(2*lat) is due to the
1263 window-based congestion mechanism of TCP. With TCP, you can't exploit
1264 your huge network capacity if you don't have a good round-trip-time
1265 because of the acks...
1267 Anyway, what you get is t=lat + L/min(bw,SG_TCP_CTE_GAMMA/(2*lat)).
1269 * if I you set (bw,lat)=(100 000 000, 0.00001), you get t = 1.00001 (you fully
1271 * if I you set (bw,lat)=(100 000 000, 0.0001), you get t = 1.0001 (you're on the
1273 * if I you set (bw,lat)=(100 000 000, 0.001), you get t = 10.001 (ouch!)
1275 This bound on the effective bandwidth of a flow is not the only thing
1276 that may make your result be unexpected. For example, two flows
1277 competing on a saturated link receive an amount of bandwidth inversely
1278 proportional to their round trip time.
1280 \subsection faq_bugrepport So I've found a bug in SimGrid. How to report it?
1282 We do our best to make sure to hammer away any bugs of SimGrid, but this is
1283 still an academic project so please be patient if/when you find bugs in it.
1284 If you do, the best solution is to drop an email either on the simgrid-user
1285 or the simgrid-devel mailing list and explain us about the issue. You can
1286 also decide to open a formal bug report using the
1287 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">relevant
1288 interface</a>. You need to login on the server to get the ability to submit
1291 We will do our best to solve any problem repported, but you need to help us
1292 finding the issue. Just telling "it segfault" isn't enough. Telling "It
1293 segfaults when running the attached simulator" doesn't really help either.
1294 You may find the following article interesting to see how to repport
1295 informative bug repports:
1296 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (it is not SimGrid
1297 specific at all, but it's full of good advices).
1299 \author Arnaud Legrand (arnaud.legrand::imag.fr)
1300 \author Martin Quinson (martin.quinson::loria.fr)