Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the use of logs in unit testing of parmap to fix supernovae
[simgrid.git] / doc / FAQ.doc
1 /*! \page faq Frequently Asked Questions
2
3 \htmlinclude .FAQ.doc.toc
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... Having a look to these
8 <a href="http://www.loria.fr/~quinson/articles/simgrid-tutorial.pdf">the tutorial slides</a> 
9 (or to these <a href="http://graal.ens-lyon.fr/~alegrand/articles/slides_g5k_simul.pdf">old slides</a>,
10 or to these
11 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">"obsolete" slides</a>)
12 may give you some insights on what SimGrid can help you to do and what
13 are its limitations. Then you definitely should read the \ref
14 MSG_examples. The \ref GRAS_tut can also help you.
15
16 If you are stuck at any point and if this FAQ cannot help you, please drop us a
17 mail to the user mailing list: <simgrid-user@lists.gforge.inria.fr>.
18
19 \subsection faq_interfaces What is the difference between MSG, SimDag, and GRAS? Do they serve the same purpose?
20
21 It depend on how you define "purpose", I guess ;)
22
23 They all allow you to build a prototype of application which you can run
24 within the simulator afterward. They all share the same simulation kernel,
25 which is the core of the SimGrid project. They differ by the way you express
26 your application.
27
28 With SimDag, you express your code as a collection of interdependent
29 parallel tasks. So, in this model, applications can be seen as a DAG of
30 tasks. This is the interface of choice for people wanting to port old
31 code designed for SimGrid v1 or v2 to the framework current version.
32
33 With both GRAS and MSG, your application is seen as a set of communicating
34 processes, exchanging data by the way of messages and performing computation
35 on their own.
36
37 The difference between both is that MSG is somehow easier to use, but GRAS
38 is not limited to the simulator. Once you're done writing your GRAS code,
39 you can run your code both in the simulator or on a real platform. For this,
40 there is two implementations of the GRAS interface, one for simulation, one
41 for real execution. So, you just have to relink your code to chose one of
42 both world. 
43
44 \subsection faq_generic First steps with SimGrid
45
46 If you decide to go for the MSG interface, please read carefully the
47 \ref MSG_examples. You'll find in \ref MSG_ex_master_slave a very
48 simple consisting of a master (that owns a bunch of tasks and
49 distributes them) , some slaves (that process tasks whenever they
50 receive one) and some forwarder agents (that simply pass the tasks
51 they receive to some slaves).
52
53 If you decide to go for the GRAS interface, you should definitively
54 read the \ref GRAS_tut. The first section constitutes an introduction
55 to the tool and presents the model we use. The second section
56 constitutes a complete step-by-step tutorial building a distributed
57 application from the beginning and exemplifying most of the GRAS
58 features in the process. The last section groups some HOWTOS
59 highlighting a given feature of the framework in a more concise way.
60
61 If you decide to go for another interface, I'm afraid your only sources
62 of information will be the source code and the mailing lists...
63
64 \subsection faq_visualization Visualizing and analyzing the results
65
66 It is sometime convenient to "see" how the agents are behaving. If you
67 like colors, you can use <tt>tools/MSG_visualization/colorize.pl </tt>
68 as a filter to your MSG outputs. It works directly with INFO. Beware,
69 INFO() prints on stderr. Do not forget to redirect if you want to
70 filter (e.g. with bash): 
71 \verbatim 
72 ./msg_test small_platform.xml small_deployment.xml 2>&1 | ../../tools/MSG_visualization/colorize.pl
73 \endverbatim
74
75 We also have a more graphical output. Have a look at section \ref faq_tracing.
76
77 \subsection faq_C Argh! Do I really have to code in C?
78
79 Up until now, there is no binding for other languages. If you use C++,
80 you should be able to use the SimGrid library as a standard C library
81 and everything should work fine (simply <i>link</i> against this
82 library; recompiling SimGrid with a C++ compiler won't work and it
83 wouldn't help if you could).
84
85 In fact, we are currently working on Java bindings of MSG to allow
86 all the undergrad students of the world to use this tool. This is a
87 little more tricky than I would have expected, but the work is moving
88 fast forward [2006/05/13]. More languages are evaluated, but for now,
89 we do not feel a real demand for any other language. Please speak up!
90
91 \section faq_cmake Installing the SimGrid library with Cmake (since V3.4)
92
93 \subsection faq_intro Some generalitty
94
95 \subsubsection faq_intro1 What is Cmake?
96
97 CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. For more information see official web site <a href="http://www.cmake.org/">here</a>.
98
99 \subsubsection faq_intro2 Why cmake?
100
101 CMake permits to developers to compil projects on different plateforms. Then many tools are embedded like ctest for making test, a link to cdash for vizualise results but also test coverage and bug reports. 
102
103 \subsubsection faq_intro3 What cmake need?
104
105 CMake needs some prerequists like :
106   \li make
107   \li c, c++ and java compiler regards to developers
108   \li ccmake for graphical used of CMake
109   \li cmake <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
110
111 \subsubsection faq_cmakeoption1 Liste of options
112
113 \verbatim
114 "cmake -D[name]=[value] ... ./"
115  
116 [name]  enable_gtnets           [value] ON/OFF or TRUE/FALSE or 1/0
117         enable_java                     ON/OFF or TRUE/FALSE or 1/0
118         enable_lua                      ON/OFF or TRUE/FALSE or 1/0
119         enable_ruby                     ON/OFF or TRUE/FALSE or 1/0
120         enable_compile_optimizations    ON/OFF or TRUE/FALSE or 1/0
121         enable_compile_warnings         ON/OFF or TRUE/FALSE or 1/0
122         enable_smpi                     ON/OFF or TRUE/FALSE or 1/0
123         enable_maintainer_mode          ON/OFF or TRUE/FALSE or 1/0
124         enable_supernovae               ON/OFF or TRUE/FALSE or 1/0
125         enable_tracing                  ON/OFF or TRUE/FALSE or 1/0
126         enable_coverage                 ON/OFF or TRUE/FALSE or 1/0
127         enable_memcheck                 ON/OFF or TRUE/FALSE or 1/0 
128         enable_model-checking           ON/OFF or TRUE/FALSE or 1/0
129         enable_doc                      ON/OFF or TRUE/FALSE or 1/0
130         gtnets_path                     <path_to_gtnets_directory>
131         prefix                          <path_to_install_directory>
132         BIBTEX2HTML                     <path_to_bibtex2html>
133         with_context                    auto/ucontext/pthread/window
134         pipol_user                      <pipol_username>         
135 \endverbatim
136                                                                                                                                                           
137 \subsubsection faq_cmakeoption2 Options explaination
138
139   \li enable_gtnets : set to true implie that user wants to use gtnets.
140
141   \li enable_java : set to true implie that user wants to add java langage into simgrid compilation.
142
143   \li enable_lua : set to true implie that user wants to add lua langage into simgrid compilation.
144
145   \li enable_ruby : set to true implie that user wants to add ruby langage into simgrid compilation.
146
147   \li enable_compile_optimizations : add flags "-O3 -finline-functions -funroll-loops -fno-strict-aliasing"
148
149   \li enable_compile_warnings : add flags "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror"
150
151   \li enable_smpi : Set to true if you want to use smpi lib. Actually on simgrid v3.4.1 Mac doesn't support lib smpi.
152
153   \li enable_maintainer_mode : set to true it remakes some files. 
154
155   \li enable_supernovae : set to true make one file for each lib and compile with those generated files.
156
157   \li enable_tracing : To enable the generation of simulation traces for visualization
158
159   \li enable_coverage : When set to true this option enable code coverage by setting -fprofile-arcs -ftest-coverage flags.
160
161   \li enable_memcheck : When set to true this option enable tests for memcheck.
162
163   \li enable_model-checking : Enable the model checking when set to true.
164   
165   \li enable_doc : Generate the documentation for simgrid with make command. (You can also make the doc manually with command : make html)
166
167   \li gtnets_path : Path to gtnets install directory (ex /usr)
168
169   \li prefix : Path where are installed lib/ doc/ and include/ directories (ex /usr/local)
170
171   \li BIBTEX2HTML : Path where is installed bibtex2html.
172
173   \li with context : specify which context the user wants to use.
174   
175   \li pipol_user : specify your pipol username if you want to use the pipol-remote command.
176
177 \subsubsection faq_cmakeoption3 Initialisation
178
179 Those options are initialized the first time you launch "cmake ." whithout specified option.
180
181 \verbatim
182 enable_gtnets                   on
183 enable_lua                      on
184 enable_ruby                     on
185 enable_java                     off
186 enable_compile_optimizations    off
187 enable_compile_warnings         off
188 enable_smpi                     on
189 enable_maintainer_mode          off
190 enable_supernovae               off
191 enable_tracing                  off
192 enable_coverage                 off
193 enable_memcheck                 off
194 enable_model-checking           off
195 enable_doc                      off
196
197 gtnets_path                     null
198 prefix                          null
199 BIBTEX2HTML                     null
200 with_context                    auto
201 pipol_user                      null
202 \endverbatim
203
204 \subsubsection faq_cmakeoption4 Option's cache and how to reset?
205
206 When options have been set they are keep into a cache file named "CMakeCache.txt". So if you want 
207 reset values you just delete this file located to the project directory.
208
209 \subsection faq_cmakecompilation Cmake compilation
210
211 \subsubsection faq_cmakecompilation1 With command line.
212
213 \verbatim
214 cmake -D[name]=[value] ... ./
215 make
216 \endverbatim
217
218 \subsubsection faq_cmakecompilation2 With ccmake tool.
219
220 \verbatim
221 "ccmake ./"
222 \endverbatim
223 Then follow instructions.
224
225 \subsubsection faq_cmakecompilation2bis Build out of source.
226
227 As cmake generate many files used for compilation, we recommand to make a build directory.
228 For examples you can make :
229
230 \verbatim
231 "navarrop@caraja:~/Developments$ cd simgrid/"
232 "navarrop@caraja:~/Developments/simgrid$ mkdir build_directory"
233 "navarrop@caraja:~/Developments/simgrid$ cd build_directory/"
234 "navarrop@caraja:~/Developments/simgrid/build_directory$ cmake ../"
235 "navarrop@caraja:~/Developments/simgrid/build_directory$ make"
236 \endverbatim
237
238 Or complety out of sources :
239
240 \verbatim
241 "navarrop@caraja:~/Developments$ mkdir build_dir"
242 "navarrop@caraja:~/Developments$ cd build_dir/"
243 "navarrop@caraja:~/Developments/build_dir$ cmake ../simgrid/"
244 "navarrop@caraja:~/Developments/build_dir$ make"
245 \endverbatim
246
247 Those two kind of compilation permit to delete files created by compilation easier.
248
249 \subsubsection faq_cmakecompilation3 Resume of command line
250
251  \li CMake
252 \verbatim
253 cmake <path>            configure the project
254 make                    build all targets
255 make VERBOSE=1          build all targets and print build command lines
256 make check              test all targets and summarize
257 make dist               make the distrib
258 make distcheck          check the dist (make + make dist + make check) 
259 make install            install the project (doc/ lib/ include/)
260 make uninstall          uninstall the project (doc/ lib/ include/)
261 make clean              clean all targets
262 make java-clean         clean files created by java option
263 make doc-clean          clean files created for making doc
264 make supernovae-clean   clean supernovae files
265 make maintainer-clean   clean maintainer files
266 make all-clean          execute the 5 upper clean command
267 make html               Create simgrid documentation
268 \endverbatim
269
270 When the project have been succesfully compiling and build you can make tests.
271
272  \li CTest
273 \verbatim
274 ctest                   launch only tests
275 ctest -D Continuous
276 ctest -D Continuous(Start|Update|Configure|Build)
277 ctest -D Continuous(Test|Coverage|MemCheck|Submit)
278 ctest -D Experimental
279 ctest -D Experimental(Start|Update|Configure|Build)
280 ctest -D Experimental(Test|Coverage|MemCheck|Submit)
281 ctest -D Nightly                                
282 ctest -D Nightly(Start|Update|Configure|Build)
283 ctest -D Nightly(Test|Coverage|MemCheck|Submit)
284 ctest -D NightlyMemoryCheck
285 \endverbatim
286
287 If you want to test before make a commit you can simply make "ctest -D Experimental" and then you can visualize results submitted into Cdash. <a href="http://cdash.inria.fr/CDash/index.php?project=Simgrid">(Go to Cdash site)</a>.
288
289 \subsubsection faq_cmakecompilation5 Examples for different mode.
290
291 \li Mode maintainer
292
293 cmake -Denable_maintainer_mode=on ./
294 \verbatim 
295 -- lookign for config.h
296 with_context auto change to ucontext
297 GIT_DATE        : 2010-05-04~09-59-15
298 GIT_VERSION     : 53ec816
299 GIT_SVN_VERSION : 7669
300
301 Configuration of package `simgrid' (revision 7669) on arch (=4):
302              BUILDNAME :        UCONTEXT
303              SITE      :        Linux_2.6.31-21-generic_x86_64
304              Release   :        simgrid-3.4~rev7669
305
306          Compiler: c++ :        /usr/bin/c++
307                 version:        c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
308          Compiler: c   :        /usr/bin/gcc
309                 version:        gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
310
311                CFlags  :        -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/include/lua5.1 -g3
312                CPPFlags:        
313                LDFlags :        -L/usr/lib/
314
315         Context backend:        ucontext
316         Compile Gtnets :        0
317         Gtnets path    :        
318         Compile Java   :        0
319         Compile Lua    :        1
320         Compile Ruby   :        1
321
322         Compile Smpi   :        ON
323         Maintainer mode:        ON
324         Supernovae mode:        OFF
325         Tracing mode   :        OFF
326
327         Simgrid dependencies:   -lm -lruby1.8 -module -ldl -llua5.1 -lrt
328         Gras dependencies   :   -lm -lpthread -lrt
329         Smpi dependencies   :   
330
331         INSTALL_PREFIX:         /usr/local
332
333 -- Configuring done
334 -- Generating done
335 -- Build files have been written to: /home/navarrop/Developments/simgrid
336 \endverbatim
337
338 \li Mode supernovae
339
340 cmake -Dsupernovae=on ./
341 \verbatim 
342 -- lookign for config.h
343 with_context auto change to ucontext
344 GIT_DATE        : 2010-05-04~09-59-15
345 GIT_VERSION     : 53ec816
346 GIT_SVN_VERSION : 7669
347
348 Configuration of package `simgrid' (revision 7669) on arch (=4):
349              BUILDNAME :        SUPERNOVAE
350              SITE      :        Linux_2.6.31-21-generic_x86_64
351              Release   :        simgrid-3.4~rev7669
352
353          Compiler: c++ :        /usr/bin/c++
354                 version:        c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
355          Compiler: c   :        /usr/bin/gcc
356                 version:        gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
357
358                CFlags  :        -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/include/lua5.1 -g3
359                CPPFlags:        
360                LDFlags :        -L/usr/lib/
361
362         Context backend:        ucontext
363         Compile Gtnets :        0
364         Gtnets path    :        
365         Compile Java   :        0
366         Compile Lua    :        1
367         Compile Ruby   :        1
368
369         Compile Smpi   :        ON
370         Maintainer mode:        OFF
371         Supernovae mode:        OFF
372         Tracing mode   :        OFF
373
374         Simgrid dependencies:   -lm -lruby1.8 -module -ldl -llua5.1 -lrt
375         Gras dependencies   :   -lm -lpthread -lrt
376         Smpi dependencies   :   
377
378         INSTALL_PREFIX:         /usr/local
379
380 -- Configuring done
381 -- Generating done
382 -- Build files have been written to: /home/navarrop/Developments/simgrid
383
384 \endverbatim
385
386 \li Mode GTnetS
387
388 cmake -Dgtnets_path=/home/navarrop/Bureau/usr/ ./
389 \verbatim 
390 -- lookign for config.h
391 with_context auto change to ucontext
392 GIT_DATE        : 2010-05-04~09-59-15
393 GIT_VERSION     : 53ec816
394 GIT_SVN_VERSION : 7669
395
396 Configuration of package `simgrid' (revision 7669) on arch (=4):
397              BUILDNAME :        GTNETS
398              SITE      :        Linux_2.6.31-21-generic_x86_64
399              Release   :        simgrid-3.4~rev7669
400
401          Compiler: c++ :        /usr/bin/c++
402                 version:        c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
403          Compiler: c   :        /usr/bin/gcc
404                 version:        gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
405
406                CFlags  :        -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -I/usr/lib/ruby/1.8/x86_64-linux -L/usr/lib -I/usr/include/gtnets -I/usr/include/lua5.1 -g3
407                CPPFlags:        -L/usr/lib -I/usr/include/gtnets 
408                LDFlags :        -L/usr/lib/
409
410         Context backend:        ucontext
411         Compile Gtnets :        1
412         Gtnets path    :        /usr
413         Compile Java   :        0
414         Compile Lua    :        1
415         Compile Ruby   :        1
416
417         Compile Smpi   :        ON
418         Maintainer mode:        OFF
419         Supernovae mode:        OFF
420         Tracing mode   :        OFF
421
422         Simgrid dependencies:   -lm -lruby1.8 -module -ldl -llua5.1 -lgtnets -lrt
423         Gras dependencies   :   -lm -lpthread -lrt
424         Smpi dependencies   :   
425
426         INSTALL_PREFIX:         /usr/local
427
428 -- Configuring done
429 -- Generating done
430 -- Build files have been written to: /home/navarrop/Developments/simgrid
431
432 \endverbatim
433
434 \subsection faq_cmakeinstall How to install with cmake?
435
436 \subsubsection faq_cmakeinstall1 From svn. 
437
438 \verbatim
439 cmake -Denable_maintainer_mode=on -Dprefix=/home/navarrop/Bureau/install_simgrid ./
440 make 
441 make install
442 \endverbatim
443
444 \subsubsection faq_cmakeinstall2 From a distrib
445
446 \verbatim
447 For version 3.4.1 and 3.4
448         cmake -Dprefix=/home/navarrop/Bureau/install_simgrid ./
449         make
450         make install-simgrid
451 Since version 3.5
452         cmake -Dprefix=/home/navarrop/Bureau/install_simgrid ./
453         make
454         make install
455 \endverbatim
456
457 \subsection faq_cmakehowto How to modified sources files for developers
458
459 \subsubsection faq_cmakehowto1 Add an executable or examples.
460
461 If you want make an executable you have to create a CMakeList.txt to the src directory. 
462 You must specified where to create the executable, source list, dependencies and the name of the binary.
463
464 \verbatim
465 cmake_minimum_required(VERSION 2.6)
466
467 set(EXECUTABLE_OUTPUT_PATH "./")                        
468 set(LIBRARY_OUTPUT_PATH "${CMAKE_HOME_DIRECTORY}/lib")
469
470 add_executable(get_sender get_sender.c)                                 #add_executable(<name_of_target> <src list>)
471
472 ### Add definitions for compile
473 target_link_libraries(get_sender simgrid m pthread)     #target_link_libraries(<name_of_targe> <dependencies>)
474 \endverbatim
475
476 Then you have to modified <project/directory>/buildtools/Cmake/MakeExeLib.cmake and add 
477 this line :
478 \verbatim
479 add_subdirectory(${CMAKE_HOME_DIRECTORY}/<path_where_is_CMakeList.txt>)
480 \endverbatim
481
482 \subsubsection faq_cmakehowto2 Delete/add sources to lib.
483
484 If you want modified, add or delete source files from a library you have to edit <project/directory>/buildtools/Cmake/DefinePackages.cmake
485
486 \verbatim
487 set(JMSG_JAVA_SRC
488         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgException.java
489         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/JniException.java
490         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/NativeException.java
491         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/HostNotFoundException.java
492         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ProcessNotFoundException.java
493         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Msg.java
494         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Process.java
495         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Host.java
496         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Task.java
497         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgNative.java
498         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ApplicationHandler.java
499         ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Sem.java
500 )
501 \endverbatim
502
503 \subsubsection faq_cmakehowto3 Add test
504
505 If you want modified, add or delete tests you have to edit <project/directory>/buildtools/Cmake/AddTests.cmake 
506 with this function : ADD_TEST(<name> <bin> <ARGS>)
507
508 \verbatim
509 add_test(test-simdag-1 ${CMAKE_HOME_DIRECTORY}/testsuite/simdag/sd_test --cfg=path:${CMAKE_HOME_DIRECTORY}/testsuite/simdag small_platform_variable.xml)
510 \endverbatim
511
512 \subsection faq_PIPOL Pipol-remote
513
514 Now we offer the possibility to test your local sources on pipol platforms before a commit. Of course you have to be user of pipol <a href="https://pipol.inria.fr/users/">(Account request)</a> cause you need to give your pipol_username to cmake. Here is a list of available systems :
515 \verbatim
516     amd64_kvm-linux-debian-lenny
517     amd64_kvm-linux-debian-testing
518     amd64_kvm-windows-7
519     amd64-linux-centos-5.dd.gz
520     amd64-linux-debian-etch.dd.gz
521     amd64-linux-debian-lenny.dd.gz
522     amd64-linux-debian-testing.dd.gz
523     amd64-linux-fedora-core10.dd.gz
524     amd64-linux-fedora-core11.dd.gz
525     amd64-linux-fedora-core12.dd.gz
526     amd64-linux-fedora-core13.dd.gz
527     amd64-linux-fedora-core7.dd.gz
528     amd64-linux-fedora-core8.dd.gz
529     amd64-linux-fedora-core9.dd.gz
530     amd64-linux-mandriva-2007_springs_powerpack.dd.gz
531     amd64-linux-mandriva-2009_powerpack.dd.gz
532     amd64-linux-opensuse-11.dd.gz
533     amd64-linux-redhatEL-5.0.dd.gz
534     amd64-linux-suse-LES10.dd.gz
535     amd64-linux-ubuntu-feisty.dd.gz
536     amd64-linux-ubuntu-hardy.dd.gz
537     amd64-linux-ubuntu-intrepid.dd.gz
538     amd64-linux-ubuntu-jaunty.dd.gz
539     amd64-linux-ubuntu-karmic.dd.gz
540     amd64-linux-ubuntu-lucid.dd.gz
541     amd64-unix-freebsd-7.dd.gz
542     amd64-windows-server-2003-64bits.dd.gz
543     amd64-windows-server-2008-64bits.dd.gz
544     i386_kvm-linux-debian-lenny
545     i386_kvm-linux-debian-testing
546     i386_kvm-linux-fedora-core13
547     i386_kvm-windows-xp-pro-sp3
548     i386-linux-centos-5.dd.gz
549     i386-linux-debian-etch.dd.gz
550     i386-linux-debian-lenny.dd.gz
551     i386-linux-debian-testing.dd.gz
552     i386-linux-fedora-core10.dd.gz
553     i386-linux-fedora-core11.dd.gz
554     i386-linux-fedora-core12.dd.gz
555     i386-linux-fedora-core13.dd.gz
556     i386-linux-fedora-core7.dd.gz
557     i386-linux-fedora-core8.dd.gz
558     i386-linux-fedora-core9.dd.gz
559     i386-linux-mandriva-2007_springs_powerpack.dd.gz
560     i386-linux-mandriva-2009_powerpack.dd.gz
561     i386-linux-opensuse-11.dd.gz
562     i386-linux-redhatEL-5.0.dd.gz
563     i386-linux-suse-LES10.dd.gz
564     i386-linux-ubuntu-feisty.dd.gz
565     i386-linux-ubuntu-hardy.dd.gz
566     i386-linux-ubuntu-intrepid.dd.gz
567     i386-linux-ubuntu-jaunty.dd.gz
568     i386-linux-ubuntu-karmic.dd.gz
569     i386-linux-ubuntu-lucid.dd.gz
570     i386_mac-mac-osx-server-leopard.dd.gz
571     i386-unix-freebsd-7.dd.gz
572     i386-unix-opensolaris-10.dd.gz
573     i386-unix-opensolaris-11.dd.gz
574     i386-unix-solaris-10.dd.gz
575     ia64-linux-debian-lenny.dd
576     ia64-linux-fedora-core9.dd
577     ia64-linux-redhatEL-5.0.dd
578     x86_64_mac-mac-osx-server-snow-leopard.dd.gz
579     x86_mac-mac-osx-server-snow-leopard.dd.gz
580 \endverbatim
581
582 Two kind of uses are possible : 
583 \verbatim
584 This command copy your source and execute a configure then a build and finish with tests.
585         bob@caraja:~/Developments/simgrid/tmp_build$ make <name_of_image> 
586
587 This command copy your source and execute a \"ctest -D Experimental\" and submit the result to cdash.
588         bob@caraja:~/Developments/simgrid/tmp_build$ make <name_of_image>_experimental 
589 \endverbatim    
590 All commands are resumed with :
591 \verbatim
592 bob@caraja:~/Developments/simgrid/tmp_build$ make pipol_experimental_list_images
593 bob@caraja:~/Developments/simgrid/tmp_build$ make pipol_test_list_images
594 \endverbatim
595
596 \subsection faq_cmakeExplain Explaination of sources files for cmake
597
598 \li CMakeLists.txt
599
600 Those files are the "main parts". One located at the project directory call all the cmake sources files. The others
601 are little projects called by the first for make examples.
602
603 \li CompleteInFiles.cmake
604
605 Complete all .in files and define Variables for h files
606
607 \li GenerateDoc.cmake
608
609 This file make the html documentation.
610
611 \li MakeExeLib.cmake
612
613 Here are callled all "CMakeLists.txt" for make executables and libraries.
614
615 \li PrintArgs.cmake
616
617 This file is called at the end of the build for summarize environment variables.
618
619 \li DefinePackages.cmake
620
621 Here is defined sources packages for compiling libs.
622
623 \li Flags.cmake
624
625 Defined flags which are used for compiling sources.
626
627 \li Supernovae.cmake
628
629 Here are made files for the supernovae mode.
630
631 \li Distrib.cmake
632
633 Here is defined packages for install simgrid and make a distribution.
634
635 \li MaintainerMode.cmake
636
637 Part where are generated source files for maintainer mode.
638
639 \li Option.cmake
640
641 Here are defined options and initialized values.
642
643 \li AddTests.cmake
644
645 All tests are listed.
646
647 \li CTestConfig.cmake
648
649 Properties which link tests with dashboard.
650
651 \subsection faq_cmakeList List of files added for cmake
652
653 Here is a list of files involved into cmake build (relative to project directory path) :
654 \verbatim
655
656 Cmake sources:
657         ./doc/CMakeLists.txt
658         ./buildtools/Cmake/AddTests.cmake
659         ./buildtools/Cmake/CompleteInFiles.cmake
660         ./buildtools/Cmake/CTestConfig.cmake
661         ./buildtools/Cmake/DefinePackages.cmake
662         ./buildtools/Cmake/Distrib.cmake
663         ./buildtools/Cmake/Flags.cmake
664         ./buildtools/Cmake/GenerateDocs.cmake
665         ./buildtools/Cmake/MaintainerMode.cmake
666         ./buildtools/Cmake/MakeExeLib.cmake
667         ./buildtools/Cmake/MakeExeLibWin.cmake
668         ./buildtools/Cmake/MakeJava.cmake
669         ./buildtools/Cmake/Option.cmake
670         ./buildtools/Cmake/PrintArgs.cmake
671         ./buildtools/Cmake/Supernovae.cmake
672         
673 CMakeLists for each binaries or examples:
674         ./CMakeLists.txt
675         ./src/CMakeLists.txt
676         ./teshsuite/gras/empty_main/CMakeLists.txt
677         ./teshsuite/gras/small_sleep/CMakeLists.txt
678         ./teshsuite/gras/datadesc/CMakeLists.txt
679         ./teshsuite/gras/msg_handle/CMakeLists.txt
680         ./teshsuite/simdag/CMakeLists.txt
681         ./teshsuite/simdag/partask/CMakeLists.txt
682         ./teshsuite/simdag/platforms/CMakeLists.txt
683         ./teshsuite/simdag/network/CMakeLists.txt
684         ./teshsuite/simdag/network/mxn/CMakeLists.txt
685         ./teshsuite/simdag/network/p2p/CMakeLists.txt
686         ./teshsuite/xbt/CMakeLists.txt
687         ./teshsuite/msg/CMakeLists.txt
688         ./tools/gras/CMakeLists.txt
689         ./tools/tesh/CMakeLists.txt
690         ./testsuite/simdag/CMakeLists.txt
691         ./testsuite/xbt/CMakeLists.txt
692         ./testsuite/surf/CMakeLists.txt
693         ./examples/gras/properties/CMakeLists.txt
694         ./examples/gras/ping/CMakeLists.txt
695         ./examples/gras/pmm/CMakeLists.txt
696         ./examples/gras/mmrpc/CMakeLists.txt
697         ./examples/gras/synchro/CMakeLists.txt
698         ./examples/gras/timer/CMakeLists.txt
699         ./examples/gras/mutual_exclusion/simple_token/CMakeLists.txt
700         ./examples/gras/spawn/CMakeLists.txt
701         ./examples/gras/chrono/CMakeLists.txt
702         ./examples/gras/rpc/CMakeLists.txt
703         ./examples/gras/all2all/CMakeLists.txt
704         ./examples/simdag/properties/CMakeLists.txt
705         ./examples/simdag/CMakeLists.txt
706         ./examples/simdag/metaxml/CMakeLists.txt
707         ./examples/simdag/dax/CMakeLists.txt
708         ./examples/smpi/CMakeLists.txt
709         ./examples/amok/bandwidth/CMakeLists.txt
710         ./examples/amok/saturate/CMakeLists.txt
711         ./examples/msg/priority/CMakeLists.txt
712         ./examples/msg/properties/CMakeLists.txt
713         ./examples/msg/migration/CMakeLists.txt
714         ./examples/msg/gtnets/CMakeLists.txt
715         ./examples/msg/parallel_task/CMakeLists.txt
716         ./examples/msg/trace/CMakeLists.txt
717         ./examples/msg/suspend/CMakeLists.txt
718         ./examples/msg/masterslave/CMakeLists.txt
719         ./examples/msg/actions/CMakeLists.txt
720         ./examples/msg/sendrecv/CMakeLists.txt
721 \endverbatim
722
723 \section faq_installation Installing the SimGrid library with Autotools (valid until V3.3.4)
724
725 Many people have been asking me questions on how to use SimGrid. Quite
726 often, the questions were not really about SimGrid but on the
727 installation process. This section is intended to help people that are
728 not familiar with compiling C files under UNIX. If you follow these
729 instructions and still have some troubles, drop an e-mail to
730 <simgrid-user@lists.gforge.inria.fr>.
731
732 \subsection faq_compiling Compiling SimGrid from a stable archive
733
734 First of all, you need to download the latest version of SimGrid from 
735 <a href="http://gforge.inria.fr/frs/?group_id=12">here</a>.
736 Suppose you have uncompressed SimGrid in some temporary location of
737 your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
738 simplest way to use SimGrid is to install it in your home
739 directory. Change your directory to
740 <tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
741
742 \verbatim
743 ./configure --prefix=$HOME
744 make
745 make install
746 \endverbatim
747
748 If at some point, something fails, check the section \ref faq_trouble_compil .
749 If it does not help, you can report this problem to the
750 list but, please, avoid sending a laconic mail like "There is a problem. Is it
751 okay?". Send the config.log file which is automatically generated by
752 configure. Try to capture both the standard output and the error output of the
753 <tt>make</tt> command with <tt>script</tt>. There is no way for us to help you
754 without the relevant bits of information.
755
756 Now, the following directory should have been created : 
757
758       \li <tt>/home/joe/doc/simgrid/html/</tt>
759       \li <tt>/home/joe/lib/</tt>
760       \li <tt>/home/joe/include/</tt>
761
762 SimGrid is not a binary, it is a library. Both a static and a dynamic
763 version are available. Here is what you can find if you try a <tt>ls
764 /home/joe/lib</tt>:
765
766 \verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
767 \endverbatim
768
769 Thus, there is two ways to link your program with SimGrid:
770       \li Either you use the static version, e.g 
771 \verbatim gcc libsimgrid.a -o MainProgram MainProgram.c
772 \endverbatim
773           In this case, all the SimGrid functions are directly
774           included in <tt>MainProgram</tt> (hence a bigger binary).
775       \li Either you use the dynamic version (the preferred method)
776 \verbatim gcc -lsimgrid -o MainProgram MainProgram.c
777 \endverbatim
778           In this case, the SimGrid functions are not included in
779           <tt>MainProgram</tt> and you need to set your environment
780           variable in such a way that <tt>libsimgrid.so</tt> will be
781           found at runtime. This can be done by adding the following
782           line in your .bashrc (if you use bash and if you have
783           installed the SimGrid libraries in your home directory):
784 \verbatim export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
785 \endverbatim
786
787 \subsection faq_compiling_java Java bindings don't get compiled
788
789 The configure script detects automatically whether you have the
790 softwares needed to use the Java bindings or not. At the end of the
791 configure, you can see the configuration picked by the script, which
792 should look similar to 
793 \verbatim Configuration of package simgrid' (version 3.3.4-svn) on
794 little64 (=4):
795
796          Compiler:       gcc (version: )
797          
798          CFlags:          -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -g3
799          CPPFlags:   
800          LDFlags:        
801                                    
802          Context backend: ucontext
803          Compile Java: no
804                                                          
805          Maintainer mode: no
806          Supernovae mode: yes
807 \endverbatim       
808
809 In this example, Java backends won't be compiled. 
810
811 On Debian-like systems (which includes ubuntu), you need the following
812 packages: sun-java6-jdk libgcj10-dev. If you cannot find the
813 libgcj10-dev, try another version, like libgcj9-dev (on Ubuntu before
814 9.10) or libgcj11-dev (not released yet, but certainly one day).
815 Please note that you need to activate the contrib and non-free
816 repositories in Debian, and the universe ones in Ubuntu. Java comes at
817 this price...
818
819 \subsection faq_compiling_snapshoot SimGrid development snapshots
820
821 We have very high standards on software quality, and we are reluctant releasing
822 a stable release as long as there is still some known bug in the code base. In
823 addition, we added quite an extensive test base, making sure that we correctly
824 test the most important parts of the tool. 
825
826 As an unfortunate conclusion, there may be some time between the stable
827 releases. If you want to benefit from the most recent features we introduced,
828 but don't want to take the risk of an untested version from the SVN, then
829 development snapshots are done for you. 
830
831 These are pre-releases of SimGrid that still fail some tests about features
832 that almost nobody use, or on platforms not being in our core target (which is
833 Linux, Mac, other Unixes and Windows, from the most important to the less
834 one). That means that using this development releases should be safe for most
835 users. 
836
837 These archives can be found on 
838 <a href="http://www.loria.fr/~quinson/simgrid.html">this web page</a>. Once you 
839 got the lastest archive, you can compile it just like any archive (see above).
840
841 \subsection faq_compiling_svn Compiling SimGrid from the SVN
842
843 The project development takes place in the SVN, where all changes are
844 committed when they happen. Then every once in a while, we make sure that the
845 code quality meets our standard and release an archive from the code in the
846 SVN. We afterward go back to the development in the SVN. So, if you need a
847 recently added feature and can afford some little problem with the stability
848 of the lastest features, you may want to use the SVN version instead of a
849 released one.
850
851 For that, you first need to get the "simgrid" module from
852 <a href="http://gforge.inria.fr/scm/?group_id=12">here</a>. 
853
854 You won't find any <tt>configure</tt> and a few other things
855 (<tt>Makefile.in</tt>'s, documentation, ...) will be missing as well. The
856 reason for that is that all these files have to be regenerated using the
857 latest versions of <tt>autoconf</tt>, <tt>libtool</tt>, <tt>automake</tt>
858 (>1.9) and <tt>doxygen</tt> (>1.4). To generate the <tt>configure</tt> and
859 the <tt>Makefile.in</tt>'s, you just have to launch the <tt>bootstrap</tt>
860 command that resides in the top of the source tree. Then just follow the
861 instructions of Section \ref faq_compiling.
862
863 We insist on the fact that you really need the latest versions of
864 autoconf, automake and libtool. Doing this step on exotic architectures/systems
865 (i.e. anything different from a recent linux distribution) may be
866 ... uncertain. If you need to compile the SVN version on a machine where all these
867 dependencies are not met, the easiest is to do <tt>make dist</tt> in the SVN
868 directory of another machine where all dependencies are met. It will create an
869 archive you may deploy on other sites just as a regular stable release.
870
871 In summary, the following commands will checkout the SVN, regenerate the
872 configure script and friends, configure SimGrid and build it.
873
874 \verbatim svn checkout svn://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk simgrid
875 cd simgrid
876 ./bootstrap
877 ./configure --enable-maintainer-mode --prefix=<where to install SimGrid>
878 make \endverbatim
879
880 Then, if you want to install SimGrid on the current box, just do:
881 \verbatim make install \endverbatim
882
883 If you want to build an snapshot of the SVN to deploy it on another box (for
884 example because the other machine don't have the autotools), do:
885 \verbatim make dist \endverbatim
886
887 Moreover, you should never call the autotools manually since you must run
888 them in a specific order with specific arguments. Most of the times, the
889 makefiles will automatically call the tools for you. When it's not possible
890 (such as the first time you checkout the SVN), use the ./bootstrap command
891 to call them explicitly.
892
893
894 \subsection faq_setting_MSG Setting up your own MSG code
895
896 Do not build your simulator by modifying the SimGrid examples.  Go
897 outside the SimGrid source tree and create your own working directory
898 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
899
900 Suppose your simulation has the following structure (remember it is
901 just an example to illustrate a possible way to compile everything;
902 feel free to organize it as you want).
903
904       \li <tt>sched.h</tt>: a description of the core of the
905           scheduler (i.e. which functions are can be used by the
906           agents). For example we could find the following functions
907           (master, forwarder, slave).
908
909       \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
910           implementing the core of the scheduler. Most of these
911           functions use the MSG functions defined in section \ref
912           msg_gos_functions.
913
914       \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
915           the MSG initialization (MSG_global_init()), the platform
916           creation (e.g. with MSG_create_environment()), the
917           deployment phase (e.g. with MSG_function_register() and
918           MSG_launch_application()) and the call to
919           MSG_main()).
920
921 To compile such a program, we suggest to use the following
922 Makefile. It is a generic Makefile that we have used many times with
923 our students when we teach the C language.
924
925 \verbatim
926 all: masterslave 
927 masterslave: masterslave.o sched.o
928
929 INSTALL_PATH = $$HOME
930 CC = gcc
931 PEDANTIC_PARANOID_FREAK =       -O0 -Wshadow -Wcast-align \
932                                 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
933                                 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
934                                 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
935                                 -Wpointer-arith -Wwrite-strings -finline-functions
936 REASONABLY_CAREFUL_DUDE =       -Wall
937 NO_PRAYER_FOR_THE_WICKED =      -w -O2 
938 WARNINGS =                      $(REASONABLY_CAREFUL_DUDE)
939 CFLAGS = -g $(WARNINGS)
940
941 INCLUDES = -I$(INSTALL_PATH)/include
942 DEFS = -L$(INSTALL_PATH)/lib/
943 LDADD = -lm -lsimgrid 
944 LIBS = 
945
946 %: %.o
947         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@ 
948
949 %.o: %.c
950         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
951
952 clean:
953         rm -f $(BIN_FILES) *.o *~
954 .SUFFIXES:
955 .PHONY : clean
956
957 \endverbatim
958
959 The first two lines indicates what should be build when typing make
960 (<tt>masterslave</tt>) and of which files it is to be made of
961 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
962 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
963 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
964 the static version, remove the <tt>-lsimgrid</tt> and add a
965 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
966 after the <tt>LIBS = </tt>.
967
968 More generally, if you have never written a Makefile by yourself, type
969 in a terminal : <tt>info make</tt> and read the introduction. The
970 previous example should be enough for a first try but you may want to
971 perform some more complex compilations...
972
973 \subsection faq_setting_GRAS Setting up your own GRAS code
974
975 If you use the GRAS interface instead of the MSG one, then previous section
976 is not the better source of information. Instead, you should check the GRAS
977 tutorial in general, and the \ref GRAS_tut_tour_setup in particular.
978
979 \section faq_howto Feature related questions
980
981 \subsection faq_MIA "Could you please add (your favorite feature here) to SimGrid?"
982
983 Here is the deal. The whole SimGrid project (MSG, SURF, GRAS, ...) is
984 meant to be kept as simple and generic as possible. We cannot add
985 functions for everybody's needs when these functions can easily be
986 built from the ones already in the API. Most of the time, it is
987 possible and when it was not possible we always have upgraded the API
988 accordingly. When somebody asks us a question like "How to do that?
989 Is there a function in the API to simply do this?", we're always glad
990 to answer and help. However if we don't need this code for our own
991 need, there is no chance we're going to write it... it's your job! :)
992 The counterpart to our answers is that once you come up with a neat
993 implementation of this feature (task duplication, RPC, thread
994 synchronization, ...), you should send it to us and we will be glad to
995 add it to the distribution. Thus, other people will take advantage of
996 it (and we don't have to answer this question again and again ;).
997
998 You'll find in this section a few "Missing In Action" features. Many
999 people have asked about it and we have given hints on how to simply do
1000 it with MSG. Feel free to contribute...
1001
1002 \subsection faq_MIA_MSG MSG features
1003
1004 \subsubsection faq_MIA_examples I want some more complex MSG examples!
1005
1006 Many people have come to ask me a more complex example and each time,
1007 they have realized afterward that the basics were in the previous three
1008 examples. 
1009
1010 Of course they have often been needing more complex functions like
1011 MSG_process_suspend(), MSG_process_resume() and
1012 MSG_process_isSuspended() (to perform synchronization), or
1013 MSG_task_Iprobe() and MSG_process_sleep() (to avoid blocking
1014 receptions), or even MSG_process_create() (to design asynchronous
1015 communications or computations). But the examples are sufficient to
1016 start.
1017
1018 We know. We should add some more examples, but not really some more
1019 complex ones... We should add some examples that illustrate some other
1020 functionalists (like how to simply encode asynchronous
1021 communications, RPC, process migrations, thread synchronization, ...)
1022 and we will do it when we will have a little bit more time. We have
1023 tried to document the examples so that they are understandable. Tell
1024 us if something is not clear and once again feel free to participate!
1025 :)
1026
1027 \subsubsection faq_MIA_taskdup Missing in action: MSG Task duplication/replication
1028
1029 There is no task duplication in MSG. When you create a task, you can
1030 process it or send it somewhere else. As soon as a process has sent
1031 this task, he doesn't have this task anymore. It's gone. The receiver
1032 process has got the task. However, you could decide upon receiving to
1033 create a "copy" of a task but you have to handle by yourself the
1034 semantic associated to this "duplication".
1035
1036 As we already told, we prefer keeping the API as simple as
1037 possible. This kind of feature is rather easy to implement by users
1038 and the semantic you associate really depends on people. Having a
1039 *generic* task duplication mechanism is not that trivial (in
1040 particular because of the data field). That is why I would recommand
1041 that you write it by yourself even if I can give you advice on how to
1042 do it.
1043
1044 You have the following functions to get informations about a task:
1045 MSG_task_get_name(), MSG_task_get_compute_duration(),
1046 MSG_task_get_remaining_computation(), MSG_task_get_data_size(),
1047 and MSG_task_get_data().
1048
1049 You could use a dictionary (#xbt_dict_t) of dynars (#xbt_dynar_t). If
1050 you still don't see how to do it, please come back to us...
1051
1052 \subsubsection faq_MIA_asynchronous I want to do asynchronous communications in MSG
1053
1054 In the past (version <= 3.4), there was no function to perform asynchronous communications. 
1055 It could easily be implemented by creating new process when needed though. Since version 3.5, 
1056 we have introduced the following functions:
1057  - MSG_task_isend()
1058  - MSG_task_irecv()
1059  - MSG_comm_test()
1060  - MSG_comm_wait()
1061  - MSG_comm_waitall()
1062  - MSG_comm_waitany()
1063  - MSG_comm_destroy()
1064
1065 We refer you to the description of these functions for more details on their usage as well 
1066 as to the exemple section on \ref MSG_ex_asynchronous_communications.
1067
1068 \subsubsection faq_MIA_thread_synchronization I need to synchronize my MSG processes
1069
1070 You obviously cannot use pthread_mutexes of pthread_conds since we handle every 
1071 scheduling related decision within SimGrid. 
1072
1073 In the past (version <=3.3.4) you could do it by playing with
1074 MSG_process_suspend() and MSG_process_resume() or with fake communications (using MSG_task_get(),
1075 MSG_task_put() and MSG_task_Iprobe()).
1076
1077 Since version 3.4, you can use classical synchronization structures. See page \ref XBT_synchro or simply check in
1078 include/xbt/synchro_core.h.
1079
1080 \subsubsection faq_MIA_host_load Where is the get_host_load function hidden in MSG?
1081
1082 There is no such thing because its semantic wouldn't be really
1083 clear. Of course, it is something about the amount of host throughput,
1084 but there is as many definition of "host load" as people asking for
1085 this function. First, you have to remember that resource availability
1086 may vary over time, which make any load notion harder to define.
1087
1088 It may be instantaneous value or an average one. Moreover it may be only the
1089 power of the computer, or may take the background load into account, or may
1090 even take the currently running tasks into account. In some SURF models,
1091 communications have an influence on computational power. Should it be taken
1092 into account too?
1093
1094 First of all, it's near to impossible to predict the load beforehands in the
1095 simulator since it depends on too much parameters (background load
1096 variation, bandwidth sharing algorithmic complexity) some of them even being
1097 not known beforehands (other task starting at the same time). So, getting
1098 this information is really hard (just like in real life). It's not just that
1099 we want MSG to be as painful as real life. But as it is in some way
1100 realistic, we face some of the same problems as we would face in real life.
1101
1102 How would you do it for real? The most common option is to use something
1103 like NWS that performs active probes. The best solution is probably to do
1104 the same within MSG, as in next code snippet. It is very close from what you
1105 would have to do out of the simulator, and thus gives you information that
1106 you could also get in real settings to not hinder the realism of your
1107 simulation. 
1108
1109 \verbatim
1110 double get_host_load() {
1111    m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
1112    double date = MSG_get_clock();
1113
1114    MSG_task_execute(task);
1115    date = MSG_get_clock() - date;
1116    MSG_task_destroy(task);
1117    return (0.001/date);
1118 }
1119 \endverbatim
1120
1121 Of course, it may not match your personal definition of "host load". In this
1122 case, please detail what you mean on the mailing list, and we will extend
1123 this FAQ section to fit your taste if possible.
1124
1125 \subsubsection faq_MIA_communication_time How can I get the *real* communication time?  
1126
1127 Communications are synchronous and thus if you simply get the time
1128 before and after a communication, you'll only get the transmission
1129 time and the time spent to really communicate (it will also take into
1130 account the time spent waiting for the other party to be
1131 ready). However, getting the *real* communication time is not really
1132 hard either. The following solution is a good starting point.
1133
1134 \verbatim
1135 int sender()
1136 {
1137   m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size, 
1138                                   calloc(1,sizeof(double)));
1139   *((double*) task->data) = MSG_get_clock();
1140   MSG_task_put(task, slaves[i % slaves_count], PORT_22);
1141   INFO0("Send completed");
1142   return 0;
1143 }
1144 int receiver()
1145 {
1146   m_task_t task = NULL;
1147   double time1,time2;
1148
1149   time1 = MSG_get_clock();
1150   a = MSG_task_get(&(task), PORT_22);
1151   time2 = MSG_get_clock();
1152   if(time1<*((double *)task->data))
1153      time1 = *((double *) task->data);
1154   INFO1("Communication time :  \"%f\" ", time2-time1);
1155   free(task->data);
1156   MSG_task_destroy(task);
1157   return 0;
1158 }
1159 \endverbatim
1160
1161 \subsection faq_MIA_SimDag SimDag related questions
1162
1163 \subsubsection faq_SG_comm Implementing communication delays between tasks.
1164
1165 A classic question of SimDag newcomers is about how to express a
1166 communication delay between tasks. The thing is that in SimDag, both
1167 computation and communication are seen as tasks.  So, if you want to
1168 model a data dependency between two DAG tasks t1 and t2, you have to
1169 create 3 SD_tasks: t1, t2 and c and add dependencies in the following
1170 way:
1171
1172 \verbatim
1173 SD_task_dependency_add(NULL, NULL, t1, c);
1174 SD_task_dependency_add(NULL, NULL, c, t2);
1175 \endverbatim
1176
1177 This way task t2 cannot start before the termination of communication c
1178 which in turn cannot start before t1 ends.
1179
1180 When creating task c, you have to associate an amount of data (in bytes)
1181 corresponding to what has to be sent by t1 to t2.
1182
1183 Finally to schedule the communication task c, you have to build a list
1184 comprising the workstations on which t1 and t2 are scheduled (w1 and w2
1185 for example) and build a communication matrix that should look like
1186 [0;amount ; 0; 0].
1187
1188 \subsubsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
1189
1190 Distributed is somehow "contagious". If you start making distributed
1191 decisions, there is no way to handle DAGs directly anymore (unless I
1192 am missing something). You have to encode your DAGs in term of
1193 communicating process to make the whole scheduling process
1194 distributed. Here is an example of how you could do that. Assume T1
1195 has to be done before T2.
1196
1197 \verbatim
1198  int your_agent(int argc, char *argv[] {
1199    ...
1200    T1 = MSG_task_create(...);
1201    T2 = MSG_task_create(...);
1202    ...
1203    while(1) {
1204      ...
1205      if(cond) MSG_task_execute(T1);
1206      ...
1207      if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
1208         MSG_task_execute(T2)
1209      else {
1210         /* do something else */
1211      }
1212    }
1213  }
1214 \endverbatim
1215  
1216 If you decide that the distributed part is not that much important and that
1217 DAG is really the level of abstraction you want to work with, then you should
1218 give a try to \ref SD_API.
1219
1220 \subsection faq_MIA_generic Generic features
1221
1222 \subsubsection faq_more_processes Increasing the amount of simulated processes
1223
1224 Here are a few tricks you can apply if you want to increase the amount
1225 of processes in your simulations.
1226
1227  - <b>A few thousands of simulated processes</b> (soft tricks)\n
1228    SimGrid can use either pthreads library or the UNIX98 contextes. On
1229    most systems, the number of pthreads is limited and then your
1230    simulation may be limited for a stupid reason. This is especially
1231    true with the current linux pthreads, and I cannot get more than
1232    2000 simulated processes with pthreads on my box. The UNIX98
1233    contexts allow me to raise the limit to 25,000 simulated processes
1234    on my laptop.\n\n
1235    The <tt>--with-context</tt> option of the <tt>./configure</tt>
1236    script allows you to choose between UNIX98 contextes
1237    (<tt>--with-context=ucontext</tt>) and the pthread version
1238    (<tt>--with-context=pthread</tt>). The default value is ucontext
1239    when the script detect a working UNIX98 context implementation. On
1240    Windows boxes, the provided value is discarded and an adapted
1241    version is picked up.\n\n
1242    We experienced some issues with contextes on some rare systems
1243    (solaris 8 and lower or old alpha linuxes comes to mind). The main
1244    problem is that the configure script detect the contextes as being
1245    functional when it's not true. If you happen to use such a system,
1246    switch manually to the pthread version, and provide us with a good
1247    patch for the configure script so that it is done automatically ;)
1248
1249  - <b>Hundred thousands of simulated processes</b> (hard-core tricks)\n 
1250    As explained above, SimGrid can use UNIX98 contextes to represent
1251    and handle the simulated processes. Thanks to this, the main
1252    limitation to the number of simulated processes becomes the
1253    available memory.\n\n
1254    Here are some tricks I had to use in order to run a token ring
1255    between 25,000 processes on my laptop (1Gb memory, 1.5Gb swap).\n
1256    - First of all, make sure your code runs for a few hundreds
1257      processes before trying to push the limit. Make sure it's
1258      valgrind-clean, ie that valgrind does not report neither memory
1259      error nor memory leaks. Indeed, numerous simulated processes
1260      result in *fat* simulation hindering debugging.
1261    - It was really boring to write 25,000 entries in the deployment
1262      file, so I wrote a little script
1263      <tt>examples/gras/mutual_exclusion/simple_token/make_deployment.pl</tt>, which you may
1264      want to adapt to your case. You could also think about hijacking
1265      the SURFXML parser (have look at \ref faq_flexml_bypassing).
1266    - The deployment file became quite big, so I had to do what is in
1267      the FAQ entry \ref faq_flexml_limit
1268    - Each UNIX98 context has its own stack entry. As debugging this is
1269      quite hairly, the default value is a bit overestimated so that
1270      user don't get into trouble about this. You want to tune this
1271      size to increse the number of processes. This is the
1272      <tt>STACK_SIZE</tt> define in 
1273      <tt>src/xbt/xbt_context_sysv.c</tt>, which is 128kb by default.
1274      Reduce this as much as you can, but be warned that if this value
1275      is too low, you'll get a segfault. The token ring example, which
1276      is quite simple, runs with 40kb stacks.     
1277    - You may tweak the logs to reduce the stack size further.  When
1278      logging something, we try to build the string to display in a
1279      char array on the stack. The size of this array is constant (and
1280      equal to XBT_LOG_BUFF_SIZE, defined in include/xbt/log/h). If the
1281      string is too large to fit this buffer, we move to a dynamically
1282      sized buffer. In which case, we have to traverse one time the log
1283      event arguments to compute the size we need for the buffer,
1284      malloc it, and traverse the argument list again to do the actual
1285      job.\n     
1286      The idea here is to move XBT_LOG_BUFF_SIZE to 1, forcing the logs
1287      to use a dynamic array each time. This allows us to lower further
1288      the stack size at the price of some performance loss...\n
1289      This allowed me to run the reduce the stack size to ... 4k. Ie,
1290      on my 1Gb laptop, I can run more than 250,000 processes!
1291
1292 \subsubsection faq_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid?
1293
1294 No, there is no native support for batch schedulers and none is
1295 planned because this is a very specific need (and doing it in a
1296 generic way is thus very hard). However some people have implemented
1297 their own batch schedulers. Vincent Garonne wrote one during his PhD
1298 and put his code in the contrib directory of our SVN so that other can
1299 keep working on it. You may find inspiring ideas in it.
1300
1301 \subsubsection faq_MIA_checkpointing I need a checkpointing thing
1302
1303 Actually, it depends on whether you want to checkpoint the simulation, or to
1304 simulate checkpoints. 
1305
1306 The first one could help if your simulation is a long standing process you
1307 want to keep running even on hardware issues. It could also help to
1308 <i>rewind</i> the simulation by jumping sometimes on an old checkpoint to
1309 cancel recent calculations.\n 
1310 Unfortunately, such thing will probably never exist in SG. One would have to
1311 duplicate all data structures because doing a rewind at the simulator level
1312 is very very hard (not talking about the malloc free operations that might
1313 have been done in between). Instead, you may be interested in the Libckpt
1314 library (http://www.cs.utk.edu/~plank/plank/www/libckpt.html). This is the
1315 checkpointing solution used in the condor project, for example. It makes it
1316 easy to create checkpoints (at the OS level, creating something like core
1317 files), and rerunning them on need.
1318
1319 If you want to simulate checkpoints instead, it means that you want the
1320 state of an executing task (in particular, the progress made towards
1321 completion) to be saved somewhere.  So if a host (and the task executing on
1322 it) fails (cf. #MSG_HOST_FAILURE), then the task can be restarted
1323 from the last checkpoint.\n
1324
1325 Actually, such a thing does not exists in SimGrid either, but it's just
1326 because we don't think it is fundamental and it may be done in the user code
1327 at relatively low cost. You could for example use a watcher that
1328 periodically get the remaining amount of things to do (using
1329 MSG_task_get_remaining_computation()), or fragment the task in smaller
1330 subtasks.
1331
1332 \subsection faq_platform Platform building and Dynamic resources
1333
1334 \subsubsection faq_platform_example Where can I find SimGrid platform files?
1335
1336 There is several little examples in the archive, in the examples/msg
1337 directory. From time to time, we are asked for other files, but we
1338 don't have much at hand right now. 
1339
1340 You should refer to the Platform Description Archive
1341 (http://pda.gforge.inria.fr) project to see the other platform file we
1342 have available, as well as the Simulacrum simulator, meant to generate
1343 SimGrid platforms using all classical generation algorithms.
1344
1345 \subsubsection faq_platform_alnem How can I automatically map an existing platform?
1346
1347 We are working on a project called ALNeM (Application-Level Network
1348 Mapper) which goal is to automatically discover the topology of an
1349 existing network. Its output will be a platform description file
1350 following the SimGrid syntax, so everybody will get the ability to map
1351 their own lab network (and contribute them to the catalog project).
1352 This tool is not ready yet, but it move quite fast forward. Just stay
1353 tuned.
1354
1355 \subsubsection faq_platform_synthetic Generating synthetic but realistic platforms
1356
1357 The third possibility to get a platform file (after manual or
1358 automatic mapping of real platforms) is to generate synthetic
1359 platforms. Getting a realistic result is not a trivial task, and
1360 moreover, nobody is really able to define what "realistic" means when
1361 speaking of topology files. You can find some more thoughts on this
1362 topic in these
1363 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">slides</a>.
1364
1365 If you are looking for an actual tool, there we have a little tool to
1366 annotate Tiers-generated topologies. This perl-script is in
1367 <tt>tools/platform_generation/</tt> directory of the SVN. Dinda et Al.
1368 released a very comparable tool, and called it GridG.
1369
1370 \subsubsection faq_SURF_multicore Modeling multi-core resources 
1371
1372 There is currently no native support for multi-core or SMP machines in
1373 SimGrid. We are currently working on it, but coming up with the right
1374 model is very hard: Cores share caches and bus to access memory and
1375 thus interfere with each others. Memory contention is a crucial
1376 component of multi-core modeling.
1377
1378 In the meanwhile, some user-level tricks can reveal sufficient for
1379 you. For example, you may model each core by a CPU and add some very
1380 high speed links between them. This complicates a bit the user code
1381 since you have to remember that when you assign something to a (real)
1382 host, it can be any of the (fake) hosts representing the cores of a
1383 given machine. For that, you can use the prop tag of the XML files as
1384 follows. Your code should then look at the â€˜machine’ property
1385 associated with each workstation, and run parallel tasks over all
1386 cores of the machine.
1387
1388 \verbatim
1389   <host id="machine0/core0" power="91500E6">
1390     <prop id="machine" value="machine0"/>
1391     <prop id="core" value="0"/>
1392   </host>
1393   <host id="machine0/core1" power="91500E6">
1394     <prop id="machine" value="machine0"/>
1395     <prop id="core" value="1"/>
1396 </host>
1397
1398
1399 \endverbatim
1400
1401 \subsubsection faq_SURF_dynamic Modeling dynamic resource availability 
1402
1403 A nice feature of SimGrid is that it enables you to seamlessly have
1404 resources whose availability change over time. When you build a
1405 platform, you generally declare hosts like that:
1406
1407 \verbatim
1408   <host id="host A" power="100.00"/>
1409 \endverbatim 
1410
1411 If you want the availability of "host A" to change over time, the only
1412 thing you have to do is change this definition like that:
1413
1414 \verbatim
1415   <host id="host A" power="100.00" availability_file="trace_A.txt" state_file="trace_A_failure.txt"/>
1416 \endverbatim
1417
1418 For hosts, availability files are expressed in fraction of available
1419 power. Let's have a look at what "trace_A.txt" may look like:
1420
1421 \verbatim
1422 PERIODICITY 1.0
1423 0.0 1.0
1424 11.0 0.5
1425 20.0 0.9
1426 \endverbatim
1427
1428 At time 0, our host will deliver 100 flop/s. At time 11.0, it will
1429 deliver only 50 flop/s until time 20.0 where it will will start
1430 delivering 90 flop/s. Last at time 21.0 (20.0 plus the periodicity
1431 1.0), we'll be back to the beginning and it will deliver 100 flop/s.
1432
1433 Now let's look at the state file:
1434 \verbatim
1435 PERIODICITY 10.0
1436 1.0 -1.0
1437 2.0 1.0
1438 \endverbatim
1439
1440 A negative value means "off" while a positive one means "on". At time
1441 1.0, the host is on. At time 1.0, it is turned off and at time 2.0, it
1442 is turned on again until time 12 (2.0 plus the periodicity 10.0). It
1443 will be turned on again at time 13.0 until time 23.0, and so on.
1444
1445 Now, let's look how the same kind of thing can be done for network
1446 links. A usual declaration looks like:
1447
1448 \verbatim
1449   <link id="LinkA" bandwidth="10.0" latency="0.2"/>
1450 \endverbatim
1451
1452 You have at your disposal the following options: bandwidth_file,
1453 latency_file and state_file. The only difference with hosts is that
1454 bandwidth_file and latency_file do not express fraction of available
1455 power but are expressed directly in bytes per seconds and seconds.
1456
1457 \subsubsection faq_platform_multipath How to express multipath routing in platform files?
1458
1459 It is unfortunately impossible to express the fact that there is more
1460 than one routing path between two given hosts. Let's consider the
1461 following platform file:
1462
1463 \verbatim
1464 <route src="A" dst="B">
1465    <link:ctn id="1"/>
1466 </route>
1467 <route src="B" dst="C">
1468   <link:ctn id="2"/>
1469 </route>
1470 <route src="A" dst="C">
1471   <link:ctn id="3"/>
1472 </route>
1473 \endverbatim
1474
1475 Although it is perfectly valid, it does not mean that data traveling
1476 from A to C can either go directly (using link 3) or through B (using
1477 links 1 and 2). It simply means that the routing on the graph is not
1478 trivial, and that data do not following the shortest path in number of
1479 hops on this graph. Another way to say it is that there is no implicit
1480 in these routing descriptions. The system will only use the routes you
1481 declare (such as &lt;route src="A" dst="C"&gt;&lt;link:ctn
1482 id="3"/&gt;&lt;/route&gt;), without trying to build new routes by aggregating
1483 the provided ones.
1484   
1485 You are also free to declare platform where the routing is not
1486 symmetric. For example, add the following to the previous file:
1487
1488 \verbatim
1489 <route src="C" dst="A">
1490   <link:ctn id="2"/>
1491   <link:ctn id="1"/>
1492 </route>
1493 \endverbatim
1494
1495 This makes sure that data from C to A go through B where data from A
1496 to C go directly. Don't worry about realism of such settings since
1497 we've seen ways more weird situation in real settings (in fact, that's
1498 the realism of very regular platforms which is questionable, but
1499 that's another story).
1500
1501 \subsubsection faq_flexml_bypassing Bypassing the XML parser with your own C functions
1502
1503 So you want to bypass the XML files parser, uh? Maybe doing some parameter
1504 sweep experiments on your simulations or so? This is possible, and
1505 it's not even really difficult (well. Such a brutal idea could be
1506 harder to implement). Here is how it goes.
1507
1508 For this, you have to first remember that the XML parsing in SimGrid is done
1509 using a tool called FleXML. Given a DTD, this gives a flex-based parser. If
1510 you want to bypass the parser, you need to provide some code mimicking what
1511 it does and replacing it in its interactions with the SURF code. So, let's
1512 have a look at these interactions.
1513
1514 FleXML parser are close to classical SAX parsers. It means that a
1515 well-formed SimGrid platform XML file might result in the following
1516 "events":
1517
1518   - start "platform_description" with attribute version="2"
1519   - start "host" with attributes id="host1" power="1.0"
1520   - end "host"
1521   - start "host" with attributes id="host2" power="2.0"
1522   - end "host"
1523   - start "link" with ...
1524   - end "link"
1525   - start "route" with ...
1526   - start "link:ctn" with ...
1527   - end "link:ctn"
1528   - end "route"
1529   - end "platform_description"
1530
1531 The communication from the parser to the SURF code uses two means:
1532 Attributes get copied into some global variables, and a surf-provided
1533 function gets called by the parser for each event. For example, the event
1534   - start "host" with attributes id="host1" power="1.0"
1535
1536 let the parser do something roughly equivalent to:
1537 \verbatim
1538   strcpy(A_host_id,"host1");
1539   A_host_power = 1.0;
1540   STag_host();
1541 \endverbatim
1542
1543 In SURF, we attach callbacks to the different events by initializing the
1544 pointer functions to some the right surf functions. Since there can be
1545 more than one callback attached to the same event (if more than one
1546 model is in use, for example), they are stored in a dynar. Example in
1547 workstation_ptask_L07.c:
1548 \verbatim
1549   /* Adding callback functions */
1550   surf_parse_reset_parser();
1551   surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
1552   surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
1553   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
1554   surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
1555   surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
1556   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
1557                 
1558   /* Parse the file */
1559   surf_parse_open(file);
1560   xbt_assert1((!surf_parse()), "Parse error in %s", file);
1561   surf_parse_close();
1562 \endverbatim
1563     
1564 So, to bypass the FleXML parser, you need to write your own version of the
1565 surf_parse function, which should do the following:
1566    - Fill the A_<tag>_<attribute> variables with the wanted values
1567    - Call the corresponding STag_<tag>_fun function to simulate tag start
1568    - Call the corresponding ETag_<tag>_fun function to simulate tag end
1569    - (do the same for the next set of values, and loop)
1570
1571 Then, tell SimGrid that you want to use your own "parser" instead of the stock one:
1572 \verbatim
1573   surf_parse = surf_parse_bypass_environment;
1574   MSG_create_environment(NULL);
1575   surf_parse = surf_parse_bypass_application;
1576   MSG_launch_application(NULL);
1577 \endverbatim
1578
1579 A set of macros are provided at the end of
1580 include/surf/surfxml_parse.h to ease the writing of the bypass
1581 functions. An example of this trick is distributed in the file
1582 examples/msg/masterslave/masterslave_bypass.c
1583
1584 \subsection faq_simgrid_configuration Changing SimGrid's behavior
1585
1586 A number of options can be given at runtime to change the default
1587 SimGrid behavior. In particular, you can change the default cpu and
1588 network models...
1589
1590 \subsubsection faq_simgrid_configuration_fullduplex Using Fullduplex
1591
1592 Experimental fullduplex support is now available on the svn branch. In order to fullduple to work your platform must have two links for each pair
1593 of interconnected hosts, see an example here:
1594 \verbatim
1595         simgrid_svn_sources/exemples/msg/gtnets/fullduplex-p.xml
1596 \endverbatim
1597
1598 Using fullduplex support ongoing and incoming communication flows are
1599 treated independently for most models. The exception is the LV08 model which 
1600 adds 0.05 of usage on the opposite direction for each new created flow. This 
1601 can be useful to simulate some important TCP phenomena such as ack compression. 
1602
1603 Running a fullduplex example:
1604 \verbatim
1605         cd simgrid_svn_sources/exemples/msg/gtnets
1606         ./gtnets fullduplex-p.xml fullduplex-d.xml --cfg=fullduplex:1
1607 \endverbatim
1608
1609
1610
1611
1612
1613 \subsubsection faq_simgrid_configuration_gtnets Using GTNetS
1614
1615 It is possible to use a packet-level network simulator
1616 instead of the default flow-based simulation. You may want to use such
1617 an approach if you have doubts about the validity of the default model
1618 or if you want to perform some validation experiments. At the moment,
1619 we support the GTNetS simulator (it is still rather experimental
1620 though, so leave us a message if you play with it). 
1621
1622
1623 <i>
1624 To enable GTNetS model inside SimGrid it is needed to patch the GTNetS simulator source code 
1625 and build/install it from scratch
1626 </i>
1627
1628  - <b>Download and enter the recent downloaded GTNetS directory</b>
1629
1630  \verbatim
1631  svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
1632  cd GTNetS
1633  \endverbatim
1634
1635
1636  - <b>Use the following commands to unzip and patch GTNetS package to work within SimGrid.</b>
1637
1638  \verbatim
1639  unzip gtnets-current.zip
1640  tar zxvf gtnets-current-patch.tgz 
1641  cd gtnets-current
1642  cat ../00*.patch | patch -p1
1643  \endverbatim
1644
1645   - <b>OPTIONALLY</b> you can use a patch for itanium 64bit processor family.
1646
1647   \verbatim
1648   cat ../AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch | patch -p1
1649   \endverbatim
1650
1651  - <b>Compile GTNetS</b>
1652
1653    Due to portability issues it is possible that GTNetS does not compile in your architecture. The patches furnished in SimGrid SVN repository are intended for use in Linux architecture only. Unfortunately, we do not have the time, the money, neither the manpower to guarantee GTNetS portability. We advice you to use one of GTNetS communication channel to get more help in compiling GTNetS. 
1654
1655
1656  \verbatim
1657  ln -sf Makefile.linux Makefile
1658  make depend
1659  make debug
1660  \endverbatim
1661
1662
1663  - <b>NOTE</b> A lot of warnings are expected but the application should compile
1664  just fine. If the makefile insists in compiling some QT libraries
1665  please try a make clean before asking for help.
1666
1667
1668  - <b>To compile optimized version</b>
1669
1670  \verbatim
1671  make opt
1672  \endverbatim
1673
1674
1675  - <b>Installing GTNetS</b>
1676
1677  It is important to put the full path of your libgtsim-xxxx.so file when creating the symbolic link. Replace < userhome > by some path you have write access to.
1678
1679  \verbatim
1680  ln -sf /<absolute_path>/gtnets_current/libgtsim-debug.so /<userhome>/usr/lib/libgtnets.so
1681  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/<userhome>/usr/lib/libgtnets.so
1682  mkdir /<userhome>/usr/include/gtnets
1683  cp -fr SRC/*.h /<userhome>/usr/include/gtnets
1684  \endverbatim
1685
1686
1687  - <b>Enable GTNetS support in SimGrid</b>
1688  
1689 In order to enable gtnets with simgrid you have to give where is gtnets. (path to <gtnets_path>/lib and <gtnets_path>/include)
1690
1691    \verbatim
1692    Since v3.4 (with cmake)
1693    cmake . -Dgtnets_path=/<userhome>/usr
1694    
1695    Until v3.4 (with autotools)
1696    ./configure --with-gtnets=/<userhome>/usr
1697    \endverbatim
1698
1699  - <b>Once you have followed all the instructions for compiling and
1700    installing successfully you can activate this feature at 
1701    runntime with the following options:</b>
1702
1703    \verbatim
1704    Since v3.4 (with cmake)
1705    cd simgrid
1706    make
1707    ctest -R gtnets
1708    
1709    Until v3.4 (with autotools)
1710    cd simgrid/example/msg/
1711    make
1712    make check
1713    \endverbatim
1714
1715
1716  - <b>Or try the GTNetS model dogbone example with</b>
1717
1718  \verbatim
1719  gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network_model:GTNets
1720  \endverbatim
1721
1722  
1723  A long version of this <a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS HowTo.html">HowTo</a>  it is available 
1724
1725
1726  More about GTNetS simulator at <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS Website</a>
1727
1728
1729  - <b>DISCLAIMER</b>
1730  The patches provided by us worked successfully with GTNetS found 
1731  <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>, 
1732  dated from 12th June 2008. Due to the discontinuing development of
1733  GTNetS it is impossible to precise a version number. We STRONGLY recommend you
1734  to download and install the GTNetS version found in SimGrid repository as explained above.
1735  
1736
1737
1738
1739 \subsubsection faq_simgrid_configuration_alternate_network Using alternative flow models
1740
1741 The default simgrid network model uses a max-min based approach as
1742 explained in the research report
1743 <a href="ftp://ftp.ens-lyon.fr/pub/LIP/Rapports/RR/RR2002/RR2002-40.ps.gz">A Network Model for Simulation of Grid Application</a>.
1744 Other models have been proposed and implemented since then (see for example 
1745 <a href="http://mescal.imag.fr/membres/arnaud.legrand/articles/simutools09.pdf">Accuracy Study and Improvement of Network Simulation in the SimGrid Framework</a>)
1746 and can be activated at runtime. For example:
1747 \verbatim
1748 ./mycode platform.xml deployment.xml --cfg=workstation/model:compound --cfg=network/model:LV08 -cfg=cpu/model:Cas01
1749 \endverbatim
1750
1751 Possible models for the network are currently "Constant", "CM02",
1752 "LegrandVelho", "GTNets", Reno", "Reno2", "Vegas". Others will
1753 probably be added in the future and many of the previous ones are
1754 experimental and are likely to disappear without notice... To know the
1755 list of the currently  implemented models, you should use the
1756 --help-models command line option.
1757
1758 \verbatim
1759 ./masterslave_forwarder ../small_platform.xml deployment_masterslave.xml  --help-models
1760 Long description of the workstation models accepted by this simulator:
1761   CLM03: Default workstation model, using LV08 and CM02 as network and CPU
1762   compound: Workstation model allowing you to use other network and CPU models
1763   ptask_L07: Workstation model with better parallel task modeling
1764 Long description of the CPU models accepted by this simulator:
1765   Cas01_fullupdate: CPU classical model time=size/power
1766   Cas01: Variation of Cas01_fullupdate with partial invalidation optimization of lmm system. Should produce the same values, only faster
1767   CpuTI: Variation of Cas01 with also trace integration. Should produce the same values, only faster if you use availability traces
1768 Long description of the network models accepted by this simulator:
1769   Constant: Simplistic network model where all communication take a constant time (one second)
1770   CM02: Realistic network model with lmm_solve and no correction factors
1771   LV08: Realistic network model with lmm_solve and these correction factors: latency*=10.4, bandwidth*=.92, S=8775
1772   Reno: Model using lagrange_solve instead of lmm_solve (experts only)
1773   Reno2: Model using lagrange_solve instead of lmm_solve (experts only)
1774   Vegas: Model using lagrange_solve instead of lmm_solve (experts only)
1775 \endverbatim
1776
1777 \subsection faq_tracing Tracing Simulations for Visualization
1778
1779 The trace visualization is widely used to observe and understand the behavior
1780 of parallel applications and distributed algorithms. Usually, this is done in a
1781 two-step fashion: the user instruments the application and the traces are
1782 analyzed after the end of the execution. The visualization itself can highlights
1783 unexpected behaviors, bottlenecks and sometimes can be used to correct
1784 distributed algorithms. The SimGrid team has instrumented the library
1785 in order to let users trace their simulations and analyze them. This part of the
1786 user manual explains how the tracing-related features can be enabled and used
1787 during the development of simulators using the SimGrid library.
1788
1789 \subsubsection faq_tracing_howitworks How it works
1790
1791 For now, the SimGrid library is instrumented so users can trace the <b>platform
1792 utilization</b> using the MSG, SimDAG and SMPI interface. This means that the tracing will
1793 register how much power is used for each host and how much bandwidth is used for
1794 each link of the platform. The idea with this type of tracing is to observe the
1795 overall view of resources utilization in the first place, especially the
1796 identification of bottlenecks, load-balancing among hosts, and so on.
1797
1798 The idea of the tracing facilities is to give SimGrid users to possibility to
1799 classify MSG and SimDAG tasks by category, tracing the platform utilization
1800 (hosts and links) for each of the categories. For that,
1801 the tracing interface enables the declaration of categories and a function to
1802 mark a task with a previously declared category. <em>The tasks that are not
1803 classified according to a category are not traced</em>. Even if the user
1804 does not specify any category, the simulations can still be traced in terms
1805 of resource utilization by using a special parameter that is detailed below.
1806
1807 \subsubsection faq_tracing_enabling Enabling using CMake
1808
1809 With the sources of SimGrid, it is possible to enable the tracing 
1810 using the parameter <b>-Denable_tracing=ON</b> when the cmake is executed.
1811 The section \ref faq_tracing_functions describes all the functions available
1812 when this Cmake options is activated. These functions will have no effect
1813 if SimGrid is configured without this option (they are wiped-out by the
1814 C-preprocessor).
1815
1816 \verbatim
1817 $ cmake -Denable_tracing=ON .
1818 $ make
1819 \endverbatim
1820
1821 \subsubsection faq_tracing_functions Tracing Functions
1822
1823 \li <b>\c TRACE_category (const char *category)</b>: This function should be used
1824 to define a user category. The category can be used to differentiate the tasks
1825 that are created during the simulation (for example, tasks from server1,
1826 server2, or request tasks, computation tasks, communication tasks).
1827 All resource utilization (host power and link bandwidth) will be
1828 classified according to the task category. Tasks that do not belong to a
1829 category are not traced.
1830
1831 \li <b>\c TRACE_msg_set_task_category (m_task_t task, const char *category)</b>:
1832 This function should be called after the creation of a MSG task, to define the
1833 category of that task. The first parameter \c task must contain a task that was
1834 created with the function \c MSG_task_create. The second parameter
1835 \c category must contain a category that was previously defined by the function
1836 \c TRACE_category.
1837
1838 \li <b>\c TRACE_sd_set_task_category (SD_task_t task, const char *category)</b>:
1839 This function should be called after the creation of a SimDAG task, to define the
1840 category of that task. The first parameter \c task must contain a task that was
1841 created with the function \c MSG_task_create. The second parameter
1842 \c category must contain a category that was previously defined by the function
1843 \c TRACE_category.
1844
1845 \li <b>\c TRACE_host_variable_declare (const char *variable)</b>:
1846 Declare a user variable that will be associated to hosts. A variable can
1847 be used to trace user variables such as the number of tasks in a server,
1848 the number of clients in an application, and so on.
1849
1850 \li <b>\c TRACE_host_variable_[set|add|sub] (const char *variable, double
1851 value)</b>:
1852 Set the value of a given user variable. It is important to remind that
1853 the value of this variable is always associated to the host. The host
1854 that will be used when these functions are called is the one returned by
1855 the function \c MSG_host_self().
1856
1857 \subsubsection faq_tracing_options Tracing configuration Options
1858
1859 These are the options accepted by the tracing system of SimGrid:
1860
1861 \li <b>\c 
1862 tracing
1863 </b>:
1864   It activates the tracing system and register the simulation platform
1865   in the trace file. You have to enable this option to others take effect.
1866
1867 \li <b>\c 
1868 tracing/categorized
1869 </b>:
1870   It activates the categorized resource utilization tracing. It should
1871   be enabled if tracing categories are used by this simulator.
1872
1873 \li <b>\c 
1874 tracing/uncategorized
1875 </b>:
1876   It activates the uncategorized resource utilization tracing. Use it if
1877   this simulator do not use tracing categories and resource use have to be
1878   traced.
1879
1880 \li <b>\c 
1881 tracing/platform/method
1882 </b>:
1883   It changes the way resource utilization (categorized or not) is traced
1884   inside the simulation core. Method 'a' (default) traces all updates defined
1885   by the CPU/network model of a given resource. Depending on the interface used
1886   by this simulator (MSG, SMPI, SimDAG), the default method can generate large
1887   trace files. Method 'b' tries to make smaller tracefiles using clever updates,
1888   without losing details of resource utilization. Method 'c' generates even
1889   smaller files by doing time integration during the simulation, but it loses
1890   precision. If this last method is used, the smallest timeslice used in the
1891   tracefile analysis must be bigger than the smaller resource utilization. If
1892   unsure, do not change this option.
1893
1894 \li <b>\c 
1895 tracing/filename
1896 </b>:
1897   A file with this name will be created to register the simulation. The file
1898   is in the Paje format and can be analyzed using Triva or Paje visualization
1899   tools. More information can be found in these webpages:
1900      <a href="http://triva.gforge.inria.fr/">http://triva.gforge.inria.fr/</a>
1901      <a href="http://paje.sourceforge.net/">http://paje.sourceforge.net/</a>
1902
1903 \li <b>\c 
1904 tracing/smpi
1905 </b>:
1906   This option only has effect if this simulator is SMPI-based. Traces the MPI
1907   interface and generates a trace that can be analyzed using Gantt-like
1908   visualizations. Every MPI function (implemented by SMPI) is transformed in a
1909   state, and point-to-point communications can be analyzed with arrows.
1910
1911 \li <b>\c 
1912 tracing/smpi/group
1913 </b>:
1914   This option only has effect if this simulator is SMPI-based. The processes
1915   are grouped by the hosts where they were executed.
1916
1917 \li <b>\c 
1918 tracing/msg/task
1919 </b>:
1920   This option only has effect if this simulator is MSG-based. It traces the
1921   behavior of all categorized MSG tasks, grouping them by hosts.
1922
1923 \li <b>\c 
1924 tracing/msg/process
1925 </b>:
1926   This option only has effect if this simulator is MSG-based. It traces the
1927   behavior of all categorized MSG processes, grouping them by hosts. This option
1928   can be used to track process location if this simulator has process migration.
1929
1930 \li <b>\c 
1931 tracing/msg/volume
1932 </b>:
1933   This experimental option only has effect if this simulator is MSG-based.
1934   It traces the communication volume of MSG send/receive.
1935
1936 \subsubsection faq_tracing_example Example of Instrumentation
1937
1938 A simplified example using the tracing mandatory functions.
1939
1940 \verbatim
1941 int main (int argc, char **argv)
1942 {
1943   MSG_global_init (&argc, &argv);
1944
1945   //note that TRACE_start must be called after MSG_global_init
1946   TRACE_category_with_color ("request", "1 0 0");
1947   TRACE_category_with_color ("computation", "0.3 1 0.4");
1948   TRACE_category ("finalize");
1949
1950   //(... after deployment ...)
1951
1952   m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
1953   m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
1954   m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
1955   m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
1956   TRACE_msg_set_task_category (req1, "request");
1957   TRACE_msg_set_task_category (req2, "request");
1958   TRACE_msg_set_task_category (req3, "request");
1959   TRACE_msg_set_task_category (req4, "request");
1960
1961   m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
1962   TRACE_msg_set_task_category (comp, "computation");
1963
1964   m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
1965   TRACE_msg_set_task_category (finalize, "finalize");
1966
1967   //(...)
1968
1969   MSG_clean();
1970   return 0;
1971 }
1972 \endverbatim
1973
1974 \subsubsection faq_tracing_analyzing Analyzing the SimGrid Traces
1975
1976 The SimGrid library, during an instrumented simulation, creates a trace file in
1977 the Paje file format that contains the platform utilization for the simulation
1978 that was executed. The visualization analysis of this file is performed with the
1979 visualization tool <a href="http://triva.gforge.inria.fr">Triva</a>, with
1980 special configurations tunned to SimGrid needs. This part of the documentation
1981 explains how to configure and use Triva to analyse a SimGrid trace file.
1982
1983 - <b>Installing Triva</b>: the tool is available in the INRIAGforge, 
1984 at <a href="http://triva.gforge.inria.fr">http://triva.gforge.inria.fr</a>.
1985 Use the following command to get the sources, and then check the file
1986 <i>INSTALL</i>. This file contains instructions to install
1987 the tool's dependencies in a Ubuntu/Debian Linux. The tool can also
1988 be compiled in MacOSes natively, check <i>INSTALL.mac</i> file.
1989 \verbatim
1990 $ svn checkout svn://scm.gforge.inria.fr/svn/triva
1991 $ cd triva
1992 $ cat INSTALL
1993 \endverbatim
1994
1995 - <b>Executing Triva</b>: a binary called <i>Triva</i> is available after the
1996   installation (you can execute it passing <em>--help</em> to check its
1997 options). If the triva binary is not available after following the
1998 installation instructions, you may want to execute the following command to
1999 initialize the GNUstep environment variables. We strongly recommend that you
2000 use the latest GNUstep packages, and not the packages available through apt-get
2001 in Ubuntu/Debian packaging systems. If you install GNUstep using the latest
2002 available packages, you can execute this command:
2003 \verbatim
2004 $ source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
2005 \endverbatim
2006 You should be able to see this output after the installation of triva:
2007 \verbatim
2008 $ ./Triva.app/Triva --help
2009 Usage: Triva [OPTIONS...] TRACE0 [TRACE1]
2010 Trace Analysis through Visualization
2011
2012 TimeInterval
2013     --ti_frequency {double}    Animation: frequency of updates
2014     --ti_hide                  Hide the TimeInterval window
2015     --ti_forward {double}      Animation: value to move time-slice
2016     --ti_apply                 Apply the configuration
2017     --ti_update                Update on slider change
2018     --ti_animate               Start animation
2019     --ti_start {double}        Start of time slice
2020     --ti_size {double}         Size of time slice
2021 Triva
2022     --comparison               Compare Trace Files (Experimental)
2023     --graph                    Configurable Graph
2024     --list                     Print Trace Type Hierarchy
2025     --hierarchy                Export Trace Type Hierarchy (dot)
2026     --stat                     Trace Statistics and Memory Utilization
2027     --instances                List All Trace Entities
2028     --linkview                 Link View (Experimental)
2029     --treemap                  Squarified Treemap
2030     --merge                    Merge Trace Files (Experimental)
2031     --check                    Check Trace File Integrity
2032 GraphConfiguration
2033     --gc_conf {file}           Graph Configuration in Property List Format
2034     --gc_apply                 Apply the configuration
2035     --gc_hide                  Hide the GraphConfiguration window
2036 \endverbatim
2037 Triva expects that the user choose one of the available options 
2038 (currently <em>--graph</em> or <em>--treemap</em> for a visualization analysis)
2039 and the trace file from the simulation.
2040
2041 - <b>Understanding Triva - time-slice</b>: the analysis of a trace file using
2042   the tool always takes into account the concept of the <em>time-slice</em>.
2043 This concept means that what is being visualized in the screen is always
2044 calculated considering a specific time frame, with its beggining and end
2045 timestamp. The time-slice is configured by the user and can be changed
2046 dynamically through the window called <em>Time Interval</em> that is opened
2047 whenever a trace file is being analyzed. The next figure depicts the time-slice
2048 configuration window.
2049 In the top of the window, in the space named <i>Trace Time</i>,
2050 the two fields show the beggining of the trace (which usually starts in 0) and
2051 the end (that depends on the time simulated by SimGrid). The middle of the
2052 window, in the square named <i>Time Slice Configuration</i>, contains the
2053 aspects related to the time-slice, including its <i>start</i> and its
2054 <i>size</i>. The gray rectangle in the bottom of this part indicates the 
2055 <i>current time-slice</i> that is considered for the drawings. If the checkbox 
2056 <i>Update Drawings on Sliders Change</i> is not selected, the button
2057 <i>Apply</i> must be clicked in order to inform triva that the
2058 new time-slice must be considered. The bottom part of the window, in the space
2059 indicated by the square <i>Time Slice Animation</i> can be used to advance
2060 the time-frame automatically. The user configures the amount of time that the
2061 time-frame will forward and how frequent this update will happen. Once this is
2062 configured, the user clicks the <i>Play</i> button in order to see the dynamic
2063 changes on the drawings.
2064 <center>
2065 \htmlonly
2066 <a href="triva-time_interval.png" border=0><img src="triva-time_interval.png" width="50%" border=0></a>
2067 \endhtmlonly
2068 </center>
2069 <b>Remarks:</b> when the trace has too many hosts or links, the computation to
2070 take into account a new time-slice can be expensive. When this happens, the
2071 <i>Frequency</i> parameter, but also updates caused by change on configurations
2072 when the checkbox <i>Update Drawings on Sliders
2073 Change</i> is selected will not be followed.
2074
2075 - <b>Understanding Triva - graph</b>: this part of the documention explains how
2076   to analyze the traces using the graph view of Triva, when the user executes
2077 the tool passing <em>--graph</em> as parameter. Triva opens three windows when
2078 this parameter is used: the <i>Time Interval</i> window (previously described),
2079 the <i>Graph Representation</i> window, and the <em>Graph Configuration</em>
2080 window. The Graph Representation is the window where drawings take place.
2081 Initially, it is completely white waiting for a proper graph configuration input
2082 by the user. We start the description of this type of analysis by describing the
2083 <i>Graph Configuration</i> window (depicted below). By using a particular
2084 configuration, triva
2085 can be used to customize the graph drawing according to
2086 the SimGrid trace that was created with user-specific categories. Before delving
2087 into the details of this customization, let us first explain the major parts of
2088 the graph configuration window. The buttons located in the top-right corner can
2089 be used to delete, copy and create a new configuration. The checkbox in the
2090 top-middle part of the window indicates if the configuration typed in the
2091 textfield is syntactically correct (we are using the non-XML 
2092 <a href="http://en.wikipedia.org/wiki/Property_list">Property List Format</a> to
2093 describe the configuration). The pop-up button located on the top-left corner 
2094 indicates the selected configuration (the user can have multiple graph
2095 configurations). The bottom-left text field contains the name of the current
2096 configuration (updates on this field must be followed by typing enter on the
2097 keyboard to take into account the name change). The bottom-right <em>Apply</em>
2098 button activates the current configuration, resulting on an update on the graph
2099 drawings.
2100 <center>
2101 \htmlonly
2102 <a href="triva-graph_configuration.png" border=0><img src="triva-graph_configuration.png" width="50%" border=0></a>
2103 \endhtmlonly
2104 </center>
2105 <b>Basic SimGrid Configuration</b>: The figure shows in the big textfield the
2106 basic configuration that should be used during the analysis of a SimGrid trace
2107 file. The basic logic of the configuration is as follows:
2108 \verbatim
2109 {
2110   node = (HOST);
2111   edge = (LINK);
2112 \endverbatim
2113 The nodes of the graph will be created based on the <i>node</i> parameter, which
2114 in this case is the different <em>"HOST"</em>s of the platform 
2115 used to simulate. The <i>edge</i> parameter indicates that the edges of the
2116 graph will be created based on the <em>"LINK"</em>s of the platform. After the
2117 definition of these two parameters, the configuration must detail how
2118 <em>HOST</em>s and <em>LINK</em>s should be drawn. For that, the configuration
2119 must have an entry for each of the types used. For <em>HOST</em>, as basic
2120 configuration, we have:
2121 \verbatim
2122   HOST = {
2123     size = power;
2124     scale = global;
2125   };
2126 \endverbatim
2127 The parameter <em>size</em> indicates which variable from the trace file will be
2128 used to define the size of the node HOST in the visualization. If the simulation
2129 was executed with availability traces, the size of the nodes will be changed
2130 according to these traces. The parameter <em>scale</em> indicates if the value
2131 of the variable is <em>global</em> or <em>local</em>. If it is global, the value
2132 will be relative to the power of all other hosts, if it is local, the value will
2133 be relative locally.
2134 For <em>LINK</em> we have:
2135 \verbatim
2136   LINK = {
2137     src = source;
2138     dst = destination;
2139     
2140     size = bandwidth;
2141     scale = global;
2142   };
2143 \endverbatim
2144 For the types specified in the <em>edge</em> parameter (such as <em>LINK</em>),
2145 the configuration must contain two additional parameters: <em>src</em> and
2146 <em>dst</em> that are used to properly identify which nodes this edge is
2147 connecting. The values <em>source</em> and <em>destination</em> are always present
2148 in the SimGrid trace file and should not be changed in the configuration. The
2149 parameter <em>size</em> for the LINK, in this case, is configured as the
2150 variable <em>bandwidth</em>, with a <em>global</em> scale. The scale meaning
2151 here is exactly the same used for nodes. The last parameter is the GraphViz
2152 algorithm used to calculate the position of the nodes in the graph
2153 representation.
2154 \verbatim
2155   graphviz-algorithm = neato;
2156 }
2157 \endverbatim
2158 <b>Customizing the Graph Representation</b>: triva is capable to handle
2159 a customized graph representation based on the variables present in the trace
2160 file. In the case of SimGrid, every time a category is created for tasks, two
2161 variables in the trace file are defined: one to indicate node utilization (how
2162 much power was used by that task category), and another to indicate link
2163 utilization (how much bandwidth was used by that category). For instance, if the
2164 user declares a category named <i>request</i>, there will be variables named
2165 <b>p</b><i>request</i> and a <b>b</b><i>request</i> (<b>p</b> for power and
2166 <b>b</b> for bandwidth). It is important to notice that the variable
2167 <i>prequest</i> in this case is only available for HOST, and
2168 <i>brequest</i> is only available for LINK. <b>Example</b>: suppose there are
2169 two categories for tasks: request and compute. To create a customized graph
2170 representation with a proportional separation of host and link utilization, use
2171 as configuration for HOST and LINK this:
2172 \verbatim
2173   HOST = {
2174     size = power;
2175     scale = global;
2176   
2177     sep_host = {
2178       type = separation;
2179       size = power;
2180       values = (prequest, pcomputation);
2181     };
2182   };
2183
2184   LINK = {
2185     src = source;
2186     dst = destination;
2187     size = bandwidth;
2188     scale = global;
2189
2190     sep_link = {
2191       type = separation;
2192       size = bandwidth;
2193       values = (brequest, bcomputation);
2194     };
2195   };
2196 \endverbatim
2197 Where <i>sep_host</i> contains a composition of type <i>separation</i> where
2198 its max size is the <i>power</i> of the host and the variables <i>prequest</i>
2199 and <i>pcomputation</i> are drawn proportionally to the size of the HOST. And
2200 <i>sep_link</i> is also a separation where max is defined as the
2201 <i>bandwidth</i> of the link, and the variables <i>brequest</i> and
2202 <i>bcomputation</i> are drawn proportionally within a LINK.
2203 <i>This configuration enables the analysis of resource utilization by MSG tasks,
2204 and the identification of load-balancing issues, network bottlenecks, for
2205 instance.</i> \n
2206 <b>Other compositions</b>: besides <i>separation</i>, it is possible to use
2207 other types of compositions, such as gradients, and colors, like this:
2208 \verbatim
2209     gra_host = {
2210       type = gradient;
2211       scale = global;
2212       values = (numberOfTasks);
2213     };
2214     color_host = {
2215       type = color;
2216       values = (is_server);
2217     };
2218 \endverbatim
2219 Where <i>gra_host</i> creates a gradient within a node of the graph, using a
2220 global scale and using as value a variable called <i>numberOfTasks</i>, that
2221 could be declared by the user using the optional tracing functions of SimGrid.
2222 If scale is global, the max and min value for the gradient will be equal to the
2223 max and min numberOfTasks among all hosts, and if scale is local, the max and
2224 min value based on the value of numberOfTasks locally in each host.
2225 And <i>color_host</i> composition draws a square based on a positive value of
2226 the variable <i>is_server</i>, that could also be defined by the user using the
2227 SimGrid tracing functions. \n
2228 <b>The Graph Visualization</b>: The next figure shows a graph visualization of a
2229 given time-slice of the masterslave_forwarder example (present in the SimGrid
2230 sources). The red color indicates tasks from the <i>compute</i> category. This
2231 visualization was generated with the following configuration:
2232 \verbatim
2233 {
2234   node = (HOST);
2235   edge = (LINK);
2236
2237   HOST = {
2238     size = power;
2239     scale = global;
2240   
2241     sep_host = {
2242       type = separation;
2243       size = power;
2244       values = (pcompute, pfinalize);
2245     };
2246   };
2247   LINK = {
2248     src = source;
2249     dst = destination;
2250     size = bandwidth;
2251     scale = global;
2252
2253     sep_link = {
2254       type = separation;
2255       size = bandwidth;
2256       values = (bcompute, bfinalize);
2257     };
2258   };
2259   graphviz-algorithm = neato;
2260 }
2261 \endverbatim
2262 <center>
2263 \htmlonly
2264 <a href="triva-graph_visualization.png" border=0><img src="triva-graph_visualization.png" width="50%" border=0></a>
2265 \endhtmlonly
2266 </center>
2267
2268 - <b>Understading Triva - colors</b>: An important issue when using Triva is how
2269   to define colors. To do that, we have to know which variables are defined in
2270 the trace file generated by the SimGrid library. The parameter <em>--list</em> 
2271 lists the variables for a given trace file:
2272 \verbatim
2273 $ Triva -l masterslave_forwarder.trace
2274 iFile
2275 c  platform
2276 c    HOST
2277 v     power
2278 v     is_slave
2279 v     is_master
2280 v     task_creation
2281 v     task_computation
2282 v     pcompute
2283 v     pfinalize
2284 c    LINK
2285 v     bandwidth
2286 v     latency
2287 v     bcompute
2288 v     bfinalize
2289 c  user_type
2290 \endverbatim
2291 We can see that HOST has seven variables (from power to pfinalize) and LINK has
2292 four (from bandwidth to bfinalize). To define a red color for the
2293 <i>pcompute</i> and <i>bcompute</i> (which are defined based on user category
2294 <i>compute</i>), execute:
2295 \verbatim
2296 $ defaults write Triva 'pcompute Color' '1 0 0'
2297 $ defaults write Triva 'bcompute Color' '1 0 0'
2298 \endverbatim
2299 Where the three numbers in each line are the RGB color with values from 0 to 1.
2300
2301 \subsection faq_modelchecking Model-Checking
2302 \subsubsection faq_modelchecking_howto How to use it
2303 To enable the experimental SimGrid model-checking support the program should
2304 be executed with the command line argument 
2305 \verbatim
2306 --cfg=model-check:1 
2307 \endverbatim
2308 Properties are expressed as assertions using the function
2309 \verbatim
2310 void MC_assert(int prop);
2311 \endverbatim
2312
2313 \subsection faq_binding_lua Lua Binding
2314 Most of Simgrid modules require a  good level in C programming, since simgrid is used to be as standard C library.
2315  Sometime users prefer using some kind of Â«Â easy scripts Â» or a language easier to code with, for their works,
2316  which avoid dealing with C errors, and sometime an important  gain of time.
2317 Besides Java Binding, Lua  and Ruby bindings are available since version 3.4 of Simgrid
2318 for MSG Module, and we are currenlty working on bindings for other modules.
2319
2320
2321 \subsubsection faq_binding_lua_about What is lua ?
2322 Lua is a lightweight, reflective, imperative and functional programming language,
2323  designed as a scripting language with extensible semantics as a primary goal (see official web site <a href="http://www.lua.org">here</a>).
2324 \subsubsection faq_binding_lua_why Why lua ?
2325 Lua is a fast, portable and powerful script language, quite simple to use for developpers.
2326 it combines procedural features with powerful data description facilities,
2327  by using a simple, yet powerful, mechanism of tables.
2328 Lua has a relatively simple C API compared to other scripting languages,
2329 and accordingly it provides a robust, easy to use it.
2330 \subsubsection faq_binding_lua_simgrid How to use lua in Simgrid ?
2331 Actually, the use of lua in Simgrid is quite simple, you have just to follow the same steps as coding with C in Simgird :
2332   - Coding functions coresponding to each process
2333   - loading the platforme/deployment XML file that describe the environment of simulation
2334   - and â€¦ Running the Simulation.
2335   
2336 \dontinclude lua/master_slave.lua
2337 \subsubsection faq_binding_lua_example_master_slave Master/Slave Example
2338
2339  \li Master Code
2340  \until end_of_master
2341 we mainly  use   simgrid.Task.new(task_name,computation_size,communication_size) to create our MSG Task, 
2342          then simgrid.Task.send(task,alias) to send it.
2343 we use also simgrid.Task.name(task), to get the task's name. 
2344
2345 \li Slave Code
2346 \until end_of_slave
2347 Here, we see the use of simgrid.Task.recv(alias) to receive a task with a specific alias,
2348 this function return directly the task recevied.
2349
2350 \li Set Environmenet and run application
2351 \until simgrid.clean()
2352
2353 \subsubsection faq_binding_lua_example_data Exchanging Data
2354 You can also exchange data between Process using lua. for that, you have to deal with  lua task as a table,
2355 since lua is based itself on a mechanism of tables,
2356 so you can exchange any kind of data (tables, matrix, strings,…) between process via tasks.
2357
2358 \li Sender process
2359 \verbatim 
2360   task = simgrid.Task.new("data_task",task_comp,task_comm);
2361   task['matrix'] = my_matrix;
2362   task['table'] = my_table;
2363   task['message'] = "Hello from (Lua || Simgrid ) !! "
2364   â€¦
2365   simgrid.Task.send(task,alias)
2366 \endverbatim
2367         After creating task, we associate to it various kind of data with a specific key (string in this case)
2368         to distinguish between data variables. The receiver will use this key to access easily to datas.
2369
2370
2371 \li Receiver processe
2372 \verbatim
2373   task = simgrid.Task.recv(alias);
2374   sender_matrix = task['matrix'];
2375   sender_table = task['table'];
2376   sender_message = task['message']
2377   ...
2378 \endverbatim
2379         Note that in lua, both sender and receiver share the same lua task.
2380         So that the receiver could joint data directly on the received task without sending it back.
2381         You can find  a complet example (matrix multiplication case) in the file example/lua/mult_matrix.lua. 
2382
2383
2384 \subsubsection faq_binding_lua_example_bypass Bypass XML
2385         maybe you wonder if there is a way to bypass the XML files,
2386          and describe your platform directly from the code, with lua bindings it's Possible !! how ?
2387         We provide some additional (tricky?) functions in lua that allows you to set up your own platform without using the XML files
2388      ( this can be useful for large platforms, so a simple for loop will avoid you to deal with an annoying XML File ;) )
2389      
2390
2391 \li set Routing mode
2392 \verbatim
2393    simgrid.AS.new{id="AS0",mode="Full"};
2394 \endverbatim
2395
2396 \li set Hosts
2397 \verbatim
2398   simgrid.Host.new{id="Tremblay",power=98095000};
2399   simgrid.Host.new{id="Jupiter",power=76296000};
2400   simgrid.Host.new{id="Fafard",power=76296000};
2401   simgrid.Host.new{id="Ginette",power=48492000};
2402   simgrid.Host.new{id="Bourassa",power=48492000};
2403 \endverbatim
2404   we use simgrid.Host.new{id=id_host,power=power_host} to instanciate our hosts.
2405
2406 \li set Links
2407 \verbatim
2408   for i=0,11 do
2409     simgrid.Link.new{id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087};    --  some crazy values ;)
2410   end
2411 \endverbatim
2412   we used simgrid.Link.new{id=link_id,bandwidth=bw,latency=lat} with a simple for loop to create all links we need (much easier than XML hein ?)
2413
2414 \li set Routes
2415 \verbatim
2416 -- simgrid.Route.new(src_id,des_id,links_nb,links_list)
2417    simgrid.Route.new("Tremblay","Jupiter",1,{"1"});
2418    simgrid.Route.new("Tremblay","Fafard",6,{"0","1","2","3","4","8"});
2419    simgrid.Route.new("Tremblay","Ginette",3,{"3","4","5"});
2420    simgrid.Route.new("Tremblay","Bourassa",7,{"0","1","3","2","4","6","7"});
2421
2422    simgrid.Route.new("Jupiter","Tremblay",1,{"1"});
2423    simgrid.Route.new("Jupiter","Fafard",7,{"0","1","2","3","4","8","9"});
2424    simgrid.Route.new("Jupiter","Ginette",4,{"3","4","5","9"});
2425    simgrid.Route.new("Jupiter","Bourassa",8,{"0","1","2","3","4","6","7","9"});
2426    ...
2427 \endverbatim
2428   for each host you have to specify which route to choose to access to the rest of hosts connected in the grid.
2429   
2430 \li Save platform
2431 \verbatim
2432   simgrid.register_platform();
2433 \endverbatim
2434 Don't forget to register your platform, that SURF callbacks starts their work ;)
2435
2436 \li set application
2437 \verbatim
2438    simgrid.Host.setFunction("Tremblay","Master",4,{"20","550000000","1000000","4"});
2439    simgrid.Host.setFunction("Bourassa","Slave",1,{"0"});
2440    simgrid.Host.setFunction("Jupiter","Slave",1,{"1"});
2441    simgrid.Host.setFunction("Fafard","Slave",1,{"2"});
2442    simgrid.Host.setFunction("Ginette","Slave",1,{"3"});
2443 \endverbatim
2444   you don't  need to use a deployment XML file, thanks to  simgrid.Host.setFunction(host_id,function,args_number,args_list) 
2445   you can associate functions for each host with arguments if needed .
2446
2447 \li
2448 \verbatim
2449    simgrid.register_application();
2450 \endverbatim
2451 Yes, Here too you have to resgiter your application before running the simulation.
2452
2453 the full example is distributed in the file examples/lua/master_slave_bypass.lua
2454
2455 \subsection faq_binding_ruby Ruby Binding
2456
2457
2458 \subsubsection faq_binding_ruby_simgrid Use Ruby in Simgrid
2459 Since v3.4, the use of <a href="http://ruby-lang.org">ruby</a> in simgrid is available for the MSG Module.
2460 you can find almost all MSG functionalities in Ruby code, that allows you to set up your environment, manage tasks between hosts and run the simulation.
2461
2462 \dontinclude ruby/MasterSlave.rb
2463 \subsubsection faq_binding_ruby_example Master/Slave Ruby Application
2464 for each process method(master and slave in this example), you have to associate a ruby class, that should inherit from <i>MSG::Process</i> ruby class,
2465   with a 'main' function that describe the behaviour of the process during the simulation.
2466 \li required stuff
2467 \verbatim
2468 require 'simgrid'
2469 include MSG
2470 \endverbatim
2471
2472 \li Master code
2473 \until end_of_master
2474
2475 the class MSG::Task contains methods that allows the management of the native MSG tasks.
2476 in master ruby code we used : 
2477   - <i>MSG::Task.new(task_name,compute_size,communication_size)</i> : to instanciate a new task.
2478   - <i>MSG::Task.send(mailbox)</i> : to send the task via a mailbox alias.
2479   - <i>MSG::Task.name</i> : to get the task's name.
2480
2481 \li Slave code
2482 \until end_of_slave
2483 to receive a task, we use the method <i>MSG::Task.receive(mailbox)</i> that return a MSG:Task object (received task).
2484
2485 \li Main chunk
2486 \until MSG.exit
2487
2488 - <i>MSG.createEnvironment(platform_file)</i> : set up the environment
2489 - <i>MSG.deployApplication(deployment_file)</i> : load the deployment file description.
2490 - <i>MSG.run</i> : run the simulation
2491
2492 \subsubsection faq_binding_ruby_data Exchanging data 
2493 ruby bindings provides two ways to exchange data between ruby processes.
2494 \li MSG::Task.join & MSG::Task.data \br
2495
2496   the MSG::Task class contains 2 methods that allows a data exchange between 2 process.
2497   
2498   -<i>MSG::Task.join</i> : makes possible to join any kind of ruby data within a task.
2499   \verbatim
2500    ...
2501    myTable = Array.new
2502    myTable <<1<<-2<<45<<67<<87<<76<<89<<56<<78<<3<<-4<<99
2503    # Creates and send Task With the Table inside
2504    task = MSG::Task.new("quicksort_task",taskComputeSize, taskCommunicationSize);
2505    task.join(myTable);
2506    ...
2507    task.send(mailbox);
2508    \endverbatim
2509    -<i>MSG::Task.data</i> : to access to the data contained into the task.
2510    \verbatim
2511    ...
2512    task = MSG::Task.receive(recv_mailbox.to_s)
2513    table = task.data
2514    quicksort(table,0,table.size-1)
2515    ...
2516    \endverbatim
2517 you can find a complet example illustrating the use of those methods  in file /example/ruby/Quicksort.rb
2518
2519 \li inheritence 
2520  
2521  another 'object-oriented' way to do it, is to make your own 'task' class that inherit from  MSG::Task ,
2522  and contains data you want to deal with, the only 'tricky' thing is that "the initializer" method has no effect ! 
2523  
2524  the use of some getter/setter methods would be the simple way to manage your data :)
2525  \verbatim
2526 class PingPongTask < MSG::Task
2527   # The initialize method has no effect 
2528   @time 
2529   def setTime(t)
2530     @time = t
2531   end
2532   def getTime()
2533     return @time
2534   end
2535 end
2536  \endverbatim
2537  you can find an example of use in file example/ruby/PingPong.rb
2538
2539 \section faq_troubleshooting Troubleshooting
2540
2541 \subsection faq_trouble_lib_compil SimGrid compilation and installation problems
2542
2543 \subsubsection faq_trouble_lib_config ./configure fails!
2544
2545 We know only one reason for the configure to fail:
2546
2547  - <b>You are using a broken build environment</b>\n
2548    If symptom is that configure complains about gcc not being able to build
2549    executables, you are probably missing the libc6-dev package. Damn Ubuntu.
2550
2551 If you experience other kind of issue, please get in touch with us. We are
2552 always interested in improving our portability to new systems.
2553
2554 \subsubsection faq_trouble_distcheck Dude! "make check" fails on my machine!
2555
2556 Don't assume we never run this target, because we do. Check
2557 http://bob.loria.fr:8010 if you don't believe us.
2558
2559 There is several reasons which may cause the make check to fail on your
2560 machine:
2561
2562  - <b>You are using a broken libc (probably concerning the contextes)</b>.\n
2563    The symptom is that the "make check" fails within the examples/msg directory.\n
2564    By default, SimGrid uses something called ucontexts. This is part of the
2565    libc, but it's quite undertested. For example, some (old) versions of the
2566    glibc on alpha do not implement these functions, but provide the stubs
2567    (which return ENOSYS: not implemented). It may fool our detection mechanism
2568    and leads to segfaults. There is not much we can do to fix the bug.
2569    A workaround is to compile with --with-context=pthread to avoid
2570    ucontext completely. You'll be a bit more limited in the number
2571    of simulated processes you can start concurrently, but 5000
2572    processes is still enough for most purposes, isn't it?\n
2573    This limitation is the reason why we insist on using this piece of ...
2574    software even if it's so troublesome.\n
2575    <b>=> use --with-pthread on AMD64 architecture that do not have an 
2576    ultra-recent libc.</b>
2577    
2578  - <b>There is a bug in SimGrid we aren't aware of</b>.\n
2579    If none of the above apply, please drop us a mail on the mailing list so
2580    that we can check it out. Make sure to read \ref faq_bugrepport
2581    before you do so.
2582
2583 \subsection faq_trouble_compil User code compilation problems
2584
2585 \subsubsection faq_trouble_err_logcat "gcc: _simgrid_this_log_category_does_not_exist__??? undeclared (first use in this function)"
2586
2587 This is because you are using the log mecanism, but you didn't created
2588 any default category in this file. You should refer to \ref XBT_log
2589 for all the details, but you simply forgot to call one of
2590 XBT_LOG_NEW_DEFAULT_CATEGORY() or XBT_LOG_NEW_DEFAULT_SUBCATEGORY().
2591
2592 \subsubsection faq_trouble_pthreadstatic "gcc: undefined reference to pthread_key_create"
2593
2594 This indicates that one of the library SimGrid depends on (libpthread
2595 here) was missing on the linking command line. Dependencies of
2596 libsimgrid are expressed directly in the dynamic library, so it's
2597 quite impossible that you see this message when doing dynamic linking. 
2598
2599 If you compile your code statically (and if you use a pthread version
2600 of SimGrid -- see \ref faq_more_processes), you must absolutely
2601 specify <tt>-lpthread</tt> on the linker command line. As usual, this should
2602 come after <tt>-lsimgrid</tt> on this command line.
2603
2604 \subsection faq_trouble_errors Runtime error messages
2605
2606 \subsubsection faq_flexml_limit "surf_parse_lex: Assertion `next limit' failed."
2607
2608 This is because your platform file is too big for the parser. 
2609
2610 Actually, the message comes directly from FleXML, the technology on top of
2611 which the parser is built. FleXML has the bad idea of fetching the whole
2612 document in memory before parsing it. And moreover, the memory buffer size
2613 must be determined at compilation time.
2614
2615 We use a value which seems big enough for our need without bloating the
2616 simulators footprints. But of course your mileage may vary. In this case,
2617 just edit src/surf/surfxml.l modify the definition of
2618 FLEXML_BUFFERSTACKSIZE. E.g.
2619
2620 \verbatim
2621 #define FLEXML_BUFFERSTACKSIZE 1000000000
2622 \endverbatim
2623
2624 Then recompile and everything should be fine, provided that your version of
2625 Flex is recent enough (>= 2.5.31). If not the compilation process should
2626 warn you.
2627
2628 A while ago, we worked on FleXML to reduce a bit its memory consumption, but
2629 these issues remain. There is two things we should do:
2630
2631   - use a dynamic buffer instead of a static one so that the only limit
2632     becomes your memory, not a stupid constant fixed at compilation time
2633     (maybe not so difficult).
2634   - change the parser so that it does not need to get the whole file in
2635     memory before parsing
2636     (seems quite difficult, but I'm a complete newbe wrt flex stuff).
2637
2638 These are changes to FleXML itself, not SimGrid. But since we kinda hijacked
2639 the development of FleXML, I can grant you that any patches would be really
2640 welcome and quickly integrated.
2641
2642 <b>Update:</b> A new version of FleXML (1.7) was released. Most of the work
2643 was done by William Dowling, who use it in his own work. The good point is
2644 that it now use a dynamic buffer, and that the memory usage was greatly
2645 improved. The downside is that William also changed some things internally,
2646 and it breaks the hack we devised to bypass the parser, as explained in 
2647 \ref faq_flexml_bypassing. Indeed, this is not a classical usage of the
2648 parser, and Will didn't imagine that we may have used (and even documented)
2649 such a crude usage of FleXML. So, we now have to repair the bypassing
2650 functionality to use the lastest FleXML version and fix the memory usage in
2651 SimGrid.
2652
2653 \subsubsection faq_trouble_gras_transport GRAS spits networking error messages
2654
2655 Gras, on real platforms, naturally use regular sockets to communicate. They
2656 are deeply hidden in the gras abstraction, but when things go wrong, you may
2657 get some weird error messages. Here are some example, with the probable
2658 reason:
2659
2660  - <b>Transport endpoint is not connected</b>: several processes try to open
2661    a server socket on the same port number of the same machine. This is
2662    naturally bad and each process should pick its own port number for this.\n
2663    Maybe, you just have some processes remaining from a previous experiment 
2664    on your machine.\n
2665    Killing them may help, but again if you kill -KILL them, you'll have to
2666    wait for a while: they didn't close there sockets properly and the system
2667    needs a while to notice that this port is free again.
2668
2669  - <b>Socket closed by remote side</b>: if the remote process is not
2670    supposed to close the socket at this point, it may be dead.
2671    
2672  - <b>Connection reset by peer</b>: I found this on Internet about this
2673    error. I think it's what's happening here, too:\n   
2674    <i>This basically means that a network error occurred while the client was
2675    receiving data from the server. But what is really happening is that the
2676    server actually accepts the connection, processes the request, and sends
2677    a reply to the client. However, when the server closes the socket, the
2678    client believes that the connection has been terminated abnormally
2679    because the socket implementation sends a TCP reset segment telling the
2680    client to throw away the data and report an error.\n
2681    Sometimes, this problem is caused by not properly closing the
2682    input/output streams and the socket connection. Make sure you close the
2683    input/output streams and socket connection properly. If everything is
2684    closed properly, however, and the problem persists, you can work around
2685    it by adding a one-second sleep before closing the streams and the
2686    socket. This technique, however, is not reliable and may not work on all
2687    systems.</i>\n
2688    Since GRAS sockets are closed properly (repeat after me: there is no bug
2689    in GRAS), it is either that you are closing your sockets on server side
2690    before the client get a chance to read them (use gras_os_sleep() to delay
2691    the server), or the server died awfully before the client got the data.
2692
2693 \subsubsection faq_trouble_errors_big_fat_warning I'm told that my XML files are too old.
2694
2695 The format of the XML platform description files is sometimes
2696 improved. For example, we decided to change the units used in SimGrid
2697 from MBytes, MFlops and seconds to Bytes, Flops and seconds to ease
2698 people exchanging small messages. We also reworked the route
2699 descriptions to allow more compact descriptions.
2700
2701 That is why the XML files are versionned using the 'version' attribute
2702 of the root tag. Currently, it should read:
2703 \verbatim
2704   <platform version="2">
2705 \endverbatim
2706
2707 If your files are too old, you can use the simgrid_update_xml.pl
2708 script which can be found in the tools directory of the archive.
2709
2710 \subsection faq_trouble_valgrind Valgrind-related and other debugger issues
2711
2712 If you don't, you really should use valgrind to debug your code, it's
2713 almost magic.
2714
2715 \subsubsection faq_trouble_vg_longjmp longjmp madness in valgrind
2716
2717 This is when valgrind starts complaining about longjmp things, just like:
2718
2719 \verbatim ==21434== Conditional jump or move depends on uninitialised value(s)
2720 ==21434==    at 0x420DBE5: longjmp (longjmp.c:33)
2721 ==21434==
2722 ==21434== Use of uninitialised value of size 4
2723 ==21434==    at 0x420DC3A: __longjmp (__longjmp.S:48)
2724 \endverbatim
2725
2726 This is the sign that you didn't used the exception mecanism well. Most
2727 probably, you have a <tt>return;</tt> somewhere within a <tt>TRY{}</tt>
2728 block. This is <b>evil</b>, and you must not do this. Did you read the section
2729 about \ref XBT_ex??
2730
2731 \subsubsection faq_trouble_vg_libc Valgrind spits tons of errors about backtraces!
2732
2733 It may happen that valgrind, the memory debugger beloved by any decent C
2734 programmer, spits tons of warnings like the following :
2735 \verbatim ==8414== Conditional jump or move depends on uninitialised value(s)
2736 ==8414==    at 0x400882D: (within /lib/ld-2.3.6.so)
2737 ==8414==    by 0x414EDE9: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2738 ==8414==    by 0x400B105: (within /lib/ld-2.3.6.so)
2739 ==8414==    by 0x414F937: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
2740 ==8414==    by 0x4150F4C: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2741 ==8414==    by 0x400B105: (within /lib/ld-2.3.6.so)
2742 ==8414==    by 0x415102D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
2743 ==8414==    by 0x412D6B9: backtrace (in /lib/tls/i686/cmov/libc-2.3.6.so)
2744 ==8414==    by 0x8076446: xbt_dictelm_get_ext (dict_elm.c:714)
2745 ==8414==    by 0x80764C1: xbt_dictelm_get (dict_elm.c:732)
2746 ==8414==    by 0x8079010: xbt_cfg_register (config.c:208)
2747 ==8414==    by 0x806821B: MSG_config (msg_config.c:42)
2748 \endverbatim
2749
2750 This problem is somewhere in the libc when using the backtraces and there is
2751 very few things we can do ourselves to fix it. Instead, here is how to tell
2752 valgrind to ignore the error. Add the following to your ~/.valgrind.supp (or
2753 create this file on need). Make sure to change the obj line according to
2754 your personnal mileage (change 2.3.6 to the actual version you are using,
2755 which you can retrieve with a simple "ls /lib/ld*.so").
2756
2757 \verbatim {
2758    name: Backtrace madness
2759    Memcheck:Cond
2760    obj:/lib/ld-2.3.6.so
2761    fun:dl_open_worker
2762    fun:_dl_open
2763    fun:do_dlopen
2764    fun:dlerror_run
2765    fun:__libc_dlopen_mode
2766 }\endverbatim
2767
2768 Then, you have to specify valgrind to use this suppression file by passing
2769 the <tt>--suppressions=$HOME/.valgrind.supp</tt> option on the command line.
2770 You can also add the following to your ~/.bashrc so that it gets passed
2771 automatically. Actually, it passes a bit more options to valgrind, and this
2772 happen to be my personnal settings. Check the valgrind documentation for
2773 more information.
2774
2775 \verbatim export VALGRIND_OPTS="--leak-check=yes --leak-resolution=high --num-callers=40 --tool=memcheck --suppressions=$HOME/.valgrind.supp" \endverbatim
2776
2777 \subsubsection faq_trouble_backtraces Truncated backtraces
2778
2779 When debugging SimGrid, it's easier to pass the
2780 --disable-compiler-optimization flag to the configure if valgrind or
2781 gdb get fooled by the optimization done by the compiler. But you
2782 should remove these flag when everything works before going in
2783 production (before launching your 1252135 experiments), or everything
2784 will run only one half of the true SimGrid potential.
2785
2786 \subsection faq_deadlock There is a deadlock in my code!!!
2787
2788 Unfortunately, we cannot debug every code written in SimGrid.  We
2789 furthermore believe that the framework provides ways enough
2790 information to debug such informations yourself. If the textual output
2791 is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
2792 how to get a graphical one.
2793
2794 Now, if you come up with a really simple example that deadlocks and
2795 you're absolutely convinced that it should not, you can ask on the
2796 list. Just be aware that you'll be severely punished if the mistake is
2797 on your side... We have plenty of FAQ entries to redact and new
2798 features to implement for the impenitents! ;)
2799
2800 \subsection faq_surf_network_latency I get weird timings when I play with the latencies.
2801
2802 OK, first of all, remember that units should be Bytes, Flops and
2803 Seconds. If you don't use such units, some SimGrid constants (e.g. the
2804 SG_TCP_CTE_GAMMA constant used in most network models) won't have the
2805 right unit and you'll end up with weird results.
2806
2807 Here is what happens with a single transfer of size L on a link
2808 (bw,lat) when nothing else happens.
2809
2810 \verbatim
2811 0-----lat--------------------------------------------------t
2812 |-----|**** real_bw =min(bw,SG_TCP_CTE_GAMMA/(2*lat)) *****|
2813 \endverbatim
2814
2815 In more complex situations, this min is the solution of a complex
2816 max-min linear system.  Have a look 
2817 <a href="http://lists.gforge.inria.fr/pipermail/simgrid-devel/2006-April/thread.html">here</a>
2818 and read the two threads "Bug in SURF?" and "Surf bug not
2819 fixed?". You'll have a few other examples of such computations. You
2820 can also read "A Network Model for Simulation of Grid Application" by
2821 Henri Casanova and Loris Marchal to have all the details. The fact
2822 that the real_bw is smaller than bw is easy to understand. The fact
2823 that real_bw is smaller than SG_TCP_CTE_GAMMA/(2*lat) is due to the
2824 window-based congestion mechanism of TCP. With TCP, you can't exploit
2825 your huge network capacity if you don't have a good round-trip-time
2826 because of the acks...
2827
2828 Anyway, what you get is t=lat + L/min(bw,SG_TCP_CTE_GAMMA/(2*lat)).
2829
2830   * if I you set (bw,lat)=(100 000 000, 0.00001), you get t =  1.00001 (you fully
2831 use your link)
2832   * if I you set (bw,lat)=(100 000 000, 0.0001),  you get t =  1.0001 (you're on the
2833 limit)
2834   * if I you set (bw,lat)=(100 000 000, 0.001),   you get t = 10.001  (ouch!)
2835
2836 This bound on the effective bandwidth of a flow is not the only thing
2837 that may make your result be unexpected. For example, two flows
2838 competing on a saturated link receive an amount of bandwidth inversely
2839 proportional to their round trip time.
2840
2841 \subsection faq_bugrepport So I've found a bug in SimGrid. How to report it?
2842
2843 We do our best to make sure to hammer away any bugs of SimGrid, but this is
2844 still an academic project so please be patient if/when you find bugs in it.
2845 If you do, the best solution is to drop an email either on the simgrid-user
2846 or the simgrid-devel mailing list and explain us about the issue.  You can
2847 also decide to open a formal bug report using the
2848 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">relevant
2849 interface</a>. You need to login on the server to get the ability to submit
2850 bugs. 
2851
2852 We will do our best to solve any problem repported, but you need to help us
2853 finding the issue. Just telling "it segfault" isn't enough. Telling "It
2854 segfaults when running the attached simulator" doesn't really help either.
2855 You may find the following article interesting to see how to repport
2856 informative bug repports:
2857 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (it is not SimGrid
2858 specific at all, but it's full of good advices).
2859
2860 \author Arnaud Legrand (arnaud.legrand::imag.fr)
2861 \author Martin Quinson (martin.quinson::loria.fr)
2862
2863
2864 */
2865
2866 ******************************************************************
2867 *              OLD CRUFT NOT USED ANYMORE                        *
2868 ******************************************************************
2869
2870
2871 \subsection faq_crosscompile Cross-compiling a Windows DLL of SimGrid from linux
2872
2873 At the moment, we do not distribute Windows pre-compiled version of SimGrid
2874 because the support for this platform is still experimental. We know that
2875 some parts of the GRAS environment do not work, and we think that the others
2876 environments (MSG and SD) have good chances to work, but we didn't test
2877 ourselves. This section explains how we generate the SimGrid DLL so that you
2878 can build it for yourself. First of all, you need to have a version more
2879 recent than 3.1 (ie, a SVN version as time of writting).
2880
2881 In order to cross-compile the package to windows from linux, you need to
2882 install mingw32 (minimalist gnu win32). On Debian, you can do so by
2883 installing the packages mingw32 (compiler), mingw32-binutils (linker and
2884 so), mingw32-runtime.
2885
2886 You can use the VPATH support of configure to compile at the same time for
2887 linux and windows without dupplicating the source nor cleaning the tree
2888 between each. Just run bootstrap (if you use the SVN) to run the autotools.
2889 Then, create a linux and a win directories. Then, type:
2890 \verbatim  cd linux; ../configure --srcdir=.. <usual configure flags>; make; cd ..
2891 cd win;  ../configure --srcdir=.. --host=i586-mingw32msvc <flags>; make; cd ..
2892 \endverbatim
2893 The trick to VPATH builds is to call configure from another directory,
2894 passing it an extra --srcdir argument to tell it where all the sources are.
2895 It will understand you want to use VPATH. Then, the trick to cross-compile
2896 is simply to add a --host argument specifying the target you want to build
2897 for. The i586-mingw32msvc string is what you have to pass to use the mingw32
2898 environment as distributed in Debian.
2899
2900 After that, you can run all make targets from both directories, and test
2901 easily that what you change for one arch does not break the other one. 
2902
2903 It is possible that this VPATH build thing breaks from time to time in the
2904 SVN since it's quite fragile, but it's granted to work in any released
2905 version. If you experience problems, drop us a mail. 
2906
2907 Another possible source of issue is that at the moment, building the
2908 examples request to use the gras_stub_generator tool, which is a compiled
2909 program, not a script. In cross-compilation, you need to cross-execute with
2910 wine for example, which is not really pleasant. We are working on this, but
2911 in the meanwhile, simply don't build the examples in cross-compilation
2912 (<tt>cd src</tt> before running make).
2913     
2914 Program (cross-)compiled with mingw32 do request an extra DLL at run-time to be
2915 usable. For example, if you want to test your build with wine, you should do
2916 the following to put this library where wine looks for DLLs.
2917 \verbatim 
2918 cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz ~/.wine/c/windows/system/
2919 gunzip ~/.wine/c/windows/system/mingwm10.dll.gz
2920 \endverbatim
2921
2922 The DLL is built in src/.libs, and installed in the <i>prefix</i>/bin directory
2923 when you run make install. 
2924
2925 If you want to use it in a native project on windows, you need to use 
2926 simgrid.dll and mingwm10.dll. For each DLL, you need to build .def file
2927 under linux (listing the defined symbols), and convert it into a .lib file
2928 under windows (specifying this in a way that windows compilers like). To
2929 generate the def files, run (under linux):
2930 \verbatim echo "LIBRARY libsimgrid-0.dll" > simgrid.def
2931 echo EXPORTS >> simgrid.def
2932 nm libsimgrid-0.dll | grep ' T _' | sed 's/.* T _//' >> simgrid.def
2933 nm libsimgrid-0.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> simgrid.def
2934
2935 echo "LIBRARY mingwm10.dll" > mingwm10.def
2936 echo EXPORTS >> mingwm10.def
2937 nm mingwm10.dll | grep ' T _' | sed 's/.* T _//' >> mingwm10.def
2938 nm mingwm10.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> mingwm10.def
2939 \endverbatim
2940
2941 To create the import .lib files, use the <tt>lib</tt> windows tool (from
2942 MSVC) the following way to produce simgrid.lib and mingwm10.lib
2943 \verbatim lib /def:simgrid.def
2944 lib /def:mingwm10.def
2945 \endverbatim
2946
2947 If you happen to use Borland C Builder, the right command line is the
2948 following (note that you don't need any file.def to get this working).
2949 \verbatim implib simgrid.lib libsimgrid-0.dll
2950 implib mingwm10.lib mingwm10.dll
2951 \endverbatim
2952
2953 Then, set the following parameters in Visual C++ 2005:
2954 Linker -> Input -> Additional dependencies = simgrid.lib mingwm10.lib
2955
2956 Just in case you wonder how to generate a DLL from libtool in another
2957 project, we added -no-undefined to any lib*_la_LDFLAGS variables so that
2958 libtool accepts to generate a dynamic library under windows. Then, to make
2959 it true, we pass any dependencies (such as -lws2 under windows or -lpthread
2960 on need) on the linking line. Passing such deps is a good idea anyway so
2961 that they get noted in the library itself, avoiding the users to know about
2962 our dependencies and put them manually on their compilation line. Then we
2963 added the AC_LIBTOOL_WIN32_DLL macro just before AC_PROG_LIBTOOL in the
2964 configure.ac. It means that we exported any symbols which need to be.
2965 Nowadays, functions get automatically exported, so we don't need to load our
2966 header files with tons of __declspec(dllexport) cruft. We only need to do so
2967 for data, but there is no public data in SimGrid so we are good.
2968
2969