Logo AND Algorithmique Numérique Distribuée

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