1 /*! \page faq Frequently Asked Questions
3 \htmlinclude .FAQ.doc.toc
5 \section faq_simgrid I'm new to SimGrid. I have some questions. Where should I start?
7 You are at the right place... Having a look to these
8 <a href="http://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>,
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.
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>.
19 \subsection faq_interfaces What is the difference between MSG, SimDag, and GRAS? Do they serve the same purpose?
21 It depend on how you define "purpose", I guess ;)
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
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.
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
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
44 \subsection faq_generic First steps with SimGrid
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).
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.
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...
64 \subsection faq_visualization Visualizing and analyzing the results
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):
72 ./msg_test small_platform.xml small_deployment.xml 2>&1 | ../../tools/MSG_visualization/colorize.pl
75 We also have a more graphical output. Have a look at section \ref faq_tracing.
77 \subsection faq_C Argh! Do I really have to code in C?
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).
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!
91 \section faq_cmake Installing the SimGrid library with Cmake (since V3.4)
93 \subsection faq_intro Some generalitty
95 \subsubsection faq_intro1 What is Cmake?
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>.
99 \subsubsection faq_intro2 Why cmake?
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.
103 \subsubsection faq_intro3 What cmake need?
105 CMake needs some prerequists like :
110 \li c, c++ and java compiler regards to developers
111 \li ccmake for graphical used of CMake
112 \li cmake <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
115 \li cmake 2.8.3 <a href="http://www.cmake.org/files/v2.8/cmake-2.8.3-win32-x86.exe">(download page)</a>
116 \li Dev-c++ <a href="http://sourceforge.net/projects/dev-cpp/files/Binaries/Dev-C%2B%2B%204.9.9.2/devcpp-4.9.9.2_nomingw_setup.exe/download">(download page)</a>
117 \li perl strawberry <a href="http://www.strawberryperl.com/download/5.12.2.0/strawberry-perl-5.12.2.0.msi">(download page)</a>
118 \li pcre-7.0 <a href="http://sourceforge.net/projects/gnuwin32/files/pcre/7.0/pcre-7.0.exe/download">(download page)</a>
119 \li Set environment variables.
122 CC to C:\Dev-Cpp\bin\gcc
123 CXX to C:\Dev-Cpp\bin\g++
124 INCLUDE to C:\Dev-Cpp\include
125 LIB to C:\Dev-Cpp\lib
126 PCRE_LIBRARY_PATH to C:\
127 PATH to C:\Dev-Cpp\bin
130 \subsubsection faq_cmakeoption1 Liste of options
133 "cmake -D[name]=[value] ... ./"
135 [name] enable_gtnets [value] ON/OFF or TRUE/FALSE or 1/0
136 enable_java ON/OFF or TRUE/FALSE or 1/0
137 enable_lua ON/OFF or TRUE/FALSE or 1/0
138 enable_ruby ON/OFF or TRUE/FALSE or 1/0
139 enable_compile_optimizations ON/OFF or TRUE/FALSE or 1/0
140 enable_compile_warnings ON/OFF or TRUE/FALSE or 1/0
141 enable_smpi ON/OFF or TRUE/FALSE or 1/0
142 enable_maintainer_mode ON/OFF or TRUE/FALSE or 1/0
143 enable_supernovae ON/OFF or TRUE/FALSE or 1/0
144 enable_tracing ON/OFF or TRUE/FALSE or 1/0
145 enable_coverage ON/OFF or TRUE/FALSE or 1/0
146 enable_memcheck ON/OFF or TRUE/FALSE or 1/0
147 enable_model-checking ON/OFF or TRUE/FALSE or 1/0
148 gtnets_path <path_to_gtnets_directory>
149 CMAKE_INSTALL_PREFIX <path_to_install_directory>
150 pipol_user <pipol_username>
153 \subsubsection faq_cmakeoption2 Options explaination
155 \li enable_gtnets : set to true implie that user wants to use gtnets.
157 \li enable_java : set to true implie that user wants to add java langage into simgrid compilation.
159 \li enable_lua : set to true implie that user wants to add lua langage into simgrid compilation.
161 \li enable_ruby : set to true implie that user wants to add ruby langage into simgrid compilation.
163 \li enable_compile_optimizations : add flags "-O3 -finline-functions -funroll-loops -fno-strict-aliasing"
165 \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"
167 \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.
169 \li enable_maintainer_mode : set to true it remakes some files.
171 \li enable_supernovae : set to true make one file for each lib and compile with those generated files.
173 \li enable_tracing : To enable the generation of simulation traces for visualization
175 \li enable_coverage : When set to true this option enable code coverage by setting -fprofile-arcs -ftest-coverage flags.
177 \li enable_memcheck : When set to true this option enable tests for memcheck.
179 \li enable_model-checking : Enable the model checking when set to true.
181 \li gtnets_path : Path to gtnets install directory (ex /usr)
183 \li CMAKE_INSTALL_PREFIX : Path where are installed lib/ doc/ and include/ directories (ex /usr/local)
185 \li pipol_user : specify your pipol username if you want to use the pipol-remote command.
187 \subsubsection faq_cmakeoption3 Initialisation
189 Those options are initialized the first time you launch "cmake ." whithout specified option.
199 enable_compile_optimizations on
200 enable_compile_warnings off
201 enable_maintainer_mode off
204 enable_model-checking off
205 CMAKE_INSTALL_PREFIX /usr/local
210 \subsubsection faq_cmakeoption4 Option's cache and how to reset?
212 When options have been set they are keep into a cache file named "CMakeCache.txt". So if you want
213 reset values you just delete this file located to the project directory.
215 \subsection faq_cmakecompilation Cmake compilation
217 \subsubsection faq_cmakecompilation1 With command line.
220 cmake -D[name]=[value] ... ./
224 \subsubsection faq_cmakecompilation2 With ccmake tool.
229 Then follow instructions.
231 \subsubsection faq_cmakecompilation2bis Build out of source.
233 As cmake generate many files used for compilation, we recommand to make a build directory.
234 For examples you can make :
237 "navarrop@caraja:~/Developments$ cd simgrid/"
238 "navarrop@caraja:~/Developments/simgrid$ mkdir build_directory"
239 "navarrop@caraja:~/Developments/simgrid$ cd build_directory/"
240 "navarrop@caraja:~/Developments/simgrid/build_directory$ cmake ../"
241 "navarrop@caraja:~/Developments/simgrid/build_directory$ make"
244 Or complety out of sources :
247 "navarrop@caraja:~/Developments$ mkdir build_dir"
248 "navarrop@caraja:~/Developments$ cd build_dir/"
249 "navarrop@caraja:~/Developments/build_dir$ cmake ../simgrid/"
250 "navarrop@caraja:~/Developments/build_dir$ make"
253 Those two kind of compilation permit to delete files created by compilation easier.
255 \subsubsection faq_cmakecompilation3 Resume of command line
259 cmake <path> configure the project
260 make build all targets
261 make VERBOSE=1 build all targets and print build command lines
262 make check test all targets and summarize
263 make dist make the distrib
264 make distcheck check the dist (make + make dist + make check)
265 make install install the project (doc/ bin/ lib/ include/)
266 make uninstall uninstall the project (doc/ bin/ lib/ include/)
267 make clean clean all targets
268 make simgrid_documentation Create simgrid documentation
271 When the project have been succesfully compiling and build you can make tests.
275 ctest launch only tests
277 ctest -D Continuous(Start|Update|Configure|Build)
278 ctest -D Continuous(Test|Coverage|MemCheck|Submit)
279 ctest -D Experimental
280 ctest -D Experimental(Start|Update|Configure|Build)
281 ctest -D Experimental(Test|Coverage|MemCheck|Submit)
283 ctest -D Nightly(Start|Update|Configure|Build)
284 ctest -D Nightly(Test|Coverage|MemCheck|Submit)
285 ctest -D NightlyMemoryCheck
288 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>.
290 \subsection faq_cmakeinstall How to install with cmake?
292 \subsubsection faq_cmakeinstall1 From svn.
296 cmake -Denable_maintainer_mode=on -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./
304 cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=C:\simgrid_install ./
309 \subsubsection faq_cmakeinstall2 From a distrib
312 For version 3.4.1 and 3.4
313 cmake -Dprefix=/home/navarrop/Bureau/install_simgrid ./
317 cmake -DCMAKE_INSTALL_PREFIX=/home/navarrop/Bureau/install_simgrid ./
322 \subsection faq_cmakeWHATisInstall What is installed by cmake?
324 \subsubsection faq_cmakeWHATisInstallBIN CMAKE_INSTALL_PREFIX/bin
336 \subsubsection faq_cmakeWHATisInstallDOC CMAKE_INSTALL_PREFIX/doc
341 \subsubsection faq_cmakeWHATisInstallINCLUDE CMAKE_INSTALL_PREFIX/include
357 \subsubsection faq_cmakeWHATisInstallLIB CMAKE_INSTALL_PREFIX/lib
362 libsimgrid.so -> libsimgrid.so.3.5
363 libgras.so -> libgras.so.3.5
364 libsmpi.so -> libsmpi.so.3.5
365 lua/5.1/simgrid.so -> ../../libsimgrid.so
366 ruby/1.9.0/x86_64-linux/libsimgrid.so -> ../../../libsimgrid.so
367 ruby/1.9.0/x86_64-linux/simgrid.rb
369 \subsection faq_cmakehowto How to modified sources files for developers
371 \subsubsection faq_cmakehowto1 Add an executable or examples.
373 If you want make an executable you have to create a CMakeList.txt to the src directory.
374 You must specified where to create the executable, source list, dependencies and the name of the binary.
377 cmake_minimum_required(VERSION 2.6)
379 set(EXECUTABLE_OUTPUT_PATH "./")
380 set(LIBRARY_OUTPUT_PATH "${CMAKE_HOME_DIRECTORY}/lib")
382 add_executable(get_sender get_sender.c) #add_executable(<name_of_target> <src list>)
384 ### Add definitions for compile
385 target_link_libraries(get_sender simgrid m pthread) #target_link_libraries(<name_of_targe> <dependencies>)
388 Then you have to modified <project/directory>/buildtools/Cmake/MakeExeLib.cmake and add
391 add_subdirectory(${CMAKE_HOME_DIRECTORY}/<path_where_is_CMakeList.txt>)
394 \subsubsection faq_cmakehowto2 Delete/add sources to lib.
396 If you want modified, add or delete source files from a library you have to edit <project/directory>/buildtools/Cmake/DefinePackages.cmake
400 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgException.java
401 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/JniException.java
402 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/NativeException.java
403 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/HostNotFoundException.java
404 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ProcessNotFoundException.java
405 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Msg.java
406 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Process.java
407 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Host.java
408 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Task.java
409 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/MsgNative.java
410 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/ApplicationHandler.java
411 ${CMAKE_HOME_DIRECTORY}/src/java/simgrid/msg/Sem.java
415 \subsubsection faq_cmakehowto3 Add test
417 If you want modified, add or delete tests you have to edit <project/directory>/buildtools/Cmake/AddTests.cmake
418 with this function : ADD_TEST(<name> <bin> <ARGS>)
421 add_test(test-simdag-1 ${CMAKE_HOME_DIRECTORY}/testsuite/simdag/sd_test --cfg=path:${CMAKE_HOME_DIRECTORY}/testsuite/simdag small_platform_variable.xml)
424 \subsection faq_PIPOL Pipol-remote
426 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 :
428 amd64_kvm-linux-debian-lenny
429 amd64_kvm-linux-debian-testing
431 amd64-linux-centos-5.dd.gz
432 amd64-linux-debian-etch.dd.gz
433 amd64-linux-debian-lenny.dd.gz
434 amd64-linux-debian-testing.dd.gz
435 amd64-linux-fedora-core10.dd.gz
436 amd64-linux-fedora-core11.dd.gz
437 amd64-linux-fedora-core12.dd.gz
438 amd64-linux-fedora-core13.dd.gz
439 amd64-linux-fedora-core7.dd.gz
440 amd64-linux-fedora-core8.dd.gz
441 amd64-linux-fedora-core9.dd.gz
442 amd64-linux-mandriva-2007_springs_powerpack.dd.gz
443 amd64-linux-mandriva-2009_powerpack.dd.gz
444 amd64-linux-opensuse-11.dd.gz
445 amd64-linux-redhatEL-5.0.dd.gz
446 amd64-linux-suse-LES10.dd.gz
447 amd64-linux-ubuntu-feisty.dd.gz
448 amd64-linux-ubuntu-hardy.dd.gz
449 amd64-linux-ubuntu-intrepid.dd.gz
450 amd64-linux-ubuntu-jaunty.dd.gz
451 amd64-linux-ubuntu-karmic.dd.gz
452 amd64-linux-ubuntu-lucid.dd.gz
453 amd64-unix-freebsd-7.dd.gz
454 amd64-windows-server-2003-64bits.dd.gz
455 amd64-windows-server-2008-64bits.dd.gz
456 i386_kvm-linux-debian-lenny
457 i386_kvm-linux-debian-testing
458 i386_kvm-linux-fedora-core13
459 i386_kvm-windows-xp-pro-sp3
460 i386-linux-centos-5.dd.gz
461 i386-linux-debian-etch.dd.gz
462 i386-linux-debian-lenny.dd.gz
463 i386-linux-debian-testing.dd.gz
464 i386-linux-fedora-core10.dd.gz
465 i386-linux-fedora-core11.dd.gz
466 i386-linux-fedora-core12.dd.gz
467 i386-linux-fedora-core13.dd.gz
468 i386-linux-fedora-core7.dd.gz
469 i386-linux-fedora-core8.dd.gz
470 i386-linux-fedora-core9.dd.gz
471 i386-linux-mandriva-2007_springs_powerpack.dd.gz
472 i386-linux-mandriva-2009_powerpack.dd.gz
473 i386-linux-opensuse-11.dd.gz
474 i386-linux-redhatEL-5.0.dd.gz
475 i386-linux-suse-LES10.dd.gz
476 i386-linux-ubuntu-feisty.dd.gz
477 i386-linux-ubuntu-hardy.dd.gz
478 i386-linux-ubuntu-intrepid.dd.gz
479 i386-linux-ubuntu-jaunty.dd.gz
480 i386-linux-ubuntu-karmic.dd.gz
481 i386-linux-ubuntu-lucid.dd.gz
482 i386_mac-mac-osx-server-leopard.dd.gz
483 i386-unix-freebsd-7.dd.gz
484 i386-unix-opensolaris-10.dd.gz
485 i386-unix-opensolaris-11.dd.gz
486 i386-unix-solaris-10.dd.gz
487 ia64-linux-debian-lenny.dd
488 ia64-linux-fedora-core9.dd
489 ia64-linux-redhatEL-5.0.dd
490 x86_64_mac-mac-osx-server-snow-leopard.dd.gz
491 x86_mac-mac-osx-server-snow-leopard.dd.gz
494 Two kind of uses are possible :
496 This command copy your source and execute a configure then a build and finish with tests.
497 bob@caraja:~/Developments/simgrid/tmp_build$ make <name_of_image>
499 This command copy your source and execute a \"ctest -D Experimental\" and submit the result to cdash.
500 bob@caraja:~/Developments/simgrid/tmp_build$ make <name_of_image>_experimental
502 All commands are resumed with :
504 bob@caraja:~/Developments/simgrid/tmp_build$ make pipol_experimental_list_images
505 bob@caraja:~/Developments/simgrid/tmp_build$ make pipol_test_list_images
508 \section faq_installation Installing the SimGrid library with Autotools (valid until V3.3.4)
510 Many people have been asking me questions on how to use SimGrid. Quite
511 often, the questions were not really about SimGrid but on the
512 installation process. This section is intended to help people that are
513 not familiar with compiling C files under UNIX. If you follow these
514 instructions and still have some troubles, drop an e-mail to
515 <simgrid-user@lists.gforge.inria.fr>.
517 \subsection faq_compiling Compiling SimGrid from a stable archive
519 First of all, you need to download the latest version of SimGrid from
520 <a href="http://gforge.inria.fr/frs/?group_id=12">here</a>.
521 Suppose you have uncompressed SimGrid in some temporary location of
522 your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
523 simplest way to use SimGrid is to install it in your home
524 directory. Change your directory to
525 <tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
528 ./configure --prefix=$HOME
533 If at some point, something fails, check the section \ref faq_trouble_compil .
534 If it does not help, you can report this problem to the
535 list but, please, avoid sending a laconic mail like "There is a problem. Is it
536 okay?". Send the config.log file which is automatically generated by
537 configure. Try to capture both the standard output and the error output of the
538 <tt>make</tt> command with <tt>script</tt>. There is no way for us to help you
539 without the relevant bits of information.
541 Now, the following directory should have been created :
543 \li <tt>/home/joe/doc/simgrid/html/</tt>
544 \li <tt>/home/joe/lib/</tt>
545 \li <tt>/home/joe/include/</tt>
547 SimGrid is not a binary, it is a library. Both a static and a dynamic
548 version are available. Here is what you can find if you try a <tt>ls
551 \verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
554 Thus, there is two ways to link your program with SimGrid:
555 \li Either you use the static version, e.g
556 \verbatim gcc libsimgrid.a -o MainProgram MainProgram.c
558 In this case, all the SimGrid functions are directly
559 included in <tt>MainProgram</tt> (hence a bigger binary).
560 \li Either you use the dynamic version (the preferred method)
561 \verbatim gcc -lsimgrid -o MainProgram MainProgram.c
563 In this case, the SimGrid functions are not included in
564 <tt>MainProgram</tt> and you need to set your environment
565 variable in such a way that <tt>libsimgrid.so</tt> will be
566 found at runtime. This can be done by adding the following
567 line in your .bashrc (if you use bash and if you have
568 installed the SimGrid libraries in your home directory):
569 \verbatim export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
572 \subsection faq_compiling_java Java bindings don't get compiled
574 The configure script detects automatically whether you have the
575 softwares needed to use the Java bindings or not. At the end of the
576 configure, you can see the configuration picked by the script, which
577 should look similar to
578 \verbatim Configuration of package simgrid' (version 3.3.4-svn) on
581 Compiler: gcc (version: )
583 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
587 Context backend: ucontext
594 In this example, Java backends won't be compiled.
596 On Debian-like systems (which includes ubuntu), you need the following
597 packages: sun-java6-jdk libgcj10-dev. If you cannot find the
598 libgcj10-dev, try another version, like libgcj9-dev (on Ubuntu before
599 9.10) or libgcj11-dev (not released yet, but certainly one day).
600 Please note that you need to activate the contrib and non-free
601 repositories in Debian, and the universe ones in Ubuntu. Java comes at
604 \subsection faq_compiling_snapshoot SimGrid development snapshots
606 We have very high standards on software quality, and we are reluctant releasing
607 a stable release as long as there is still some known bug in the code base. In
608 addition, we added quite an extensive test base, making sure that we correctly
609 test the most important parts of the tool.
611 As an unfortunate conclusion, there may be some time between the stable
612 releases. If you want to benefit from the most recent features we introduced,
613 but don't want to take the risk of an untested version from the SVN, then
614 development snapshots are done for you.
616 These are pre-releases of SimGrid that still fail some tests about features
617 that almost nobody use, or on platforms not being in our core target (which is
618 Linux, Mac, other Unixes and Windows, from the most important to the less
619 one). That means that using this development releases should be safe for most
622 These archives can be found on
623 <a href="http://www.loria.fr/~quinson/simgrid.html">this web page</a>. Once you
624 got the lastest archive, you can compile it just like any archive (see above).
626 \subsection faq_compiling_svn Compiling SimGrid from the SVN
628 The project development takes place in the SVN, where all changes are
629 committed when they happen. Then every once in a while, we make sure that the
630 code quality meets our standard and release an archive from the code in the
631 SVN. We afterward go back to the development in the SVN. So, if you need a
632 recently added feature and can afford some little problem with the stability
633 of the lastest features, you may want to use the SVN version instead of a
636 For that, you first need to get the "simgrid" module from
637 <a href="http://gforge.inria.fr/scm/?group_id=12">here</a>.
639 You won't find any <tt>configure</tt> and a few other things
640 (<tt>Makefile.in</tt>'s, documentation, ...) will be missing as well. The
641 reason for that is that all these files have to be regenerated using the
642 latest versions of <tt>autoconf</tt>, <tt>libtool</tt>, <tt>automake</tt>
643 (>1.9) and <tt>doxygen</tt> (>1.4). To generate the <tt>configure</tt> and
644 the <tt>Makefile.in</tt>'s, you just have to launch the <tt>bootstrap</tt>
645 command that resides in the top of the source tree. Then just follow the
646 instructions of Section \ref faq_compiling.
648 We insist on the fact that you really need the latest versions of
649 autoconf, automake and libtool. Doing this step on exotic architectures/systems
650 (i.e. anything different from a recent linux distribution) may be
651 ... uncertain. If you need to compile the SVN version on a machine where all these
652 dependencies are not met, the easiest is to do <tt>make dist</tt> in the SVN
653 directory of another machine where all dependencies are met. It will create an
654 archive you may deploy on other sites just as a regular stable release.
656 In summary, the following commands will checkout the SVN, regenerate the
657 configure script and friends, configure SimGrid and build it.
659 \verbatim svn checkout svn://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk simgrid
662 ./configure --enable-maintainer-mode --prefix=<where to install SimGrid>
665 Then, if you want to install SimGrid on the current box, just do:
666 \verbatim make install \endverbatim
668 If you want to build an snapshot of the SVN to deploy it on another box (for
669 example because the other machine don't have the autotools), do:
670 \verbatim make dist \endverbatim
672 Moreover, you should never call the autotools manually since you must run
673 them in a specific order with specific arguments. Most of the times, the
674 makefiles will automatically call the tools for you. When it's not possible
675 (such as the first time you checkout the SVN), use the ./bootstrap command
676 to call them explicitly.
679 \subsection faq_setting_MSG Setting up your own MSG code
681 Do not build your simulator by modifying the SimGrid examples. Go
682 outside the SimGrid source tree and create your own working directory
683 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
685 Suppose your simulation has the following structure (remember it is
686 just an example to illustrate a possible way to compile everything;
687 feel free to organize it as you want).
689 \li <tt>sched.h</tt>: a description of the core of the
690 scheduler (i.e. which functions are can be used by the
691 agents). For example we could find the following functions
692 (master, forwarder, slave).
694 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
695 implementing the core of the scheduler. Most of these
696 functions use the MSG functions defined in section \ref
699 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
700 the MSG initialization (MSG_global_init()), the platform
701 creation (e.g. with MSG_create_environment()), the
702 deployment phase (e.g. with MSG_function_register() and
703 MSG_launch_application()) and the call to
706 To compile such a program, we suggest to use the following
707 Makefile. It is a generic Makefile that we have used many times with
708 our students when we teach the C language.
712 masterslave: masterslave.o sched.o
714 INSTALL_PATH = $$HOME
716 PEDANTIC_PARANOID_FREAK = -O0 -Wshadow -Wcast-align \
717 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
718 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
719 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
720 -Wpointer-arith -Wwrite-strings -finline-functions
721 REASONABLY_CAREFUL_DUDE = -Wall
722 NO_PRAYER_FOR_THE_WICKED = -w -O2
723 WARNINGS = $(REASONABLY_CAREFUL_DUDE)
724 CFLAGS = -g $(WARNINGS)
726 INCLUDES = -I$(INSTALL_PATH)/include
727 DEFS = -L$(INSTALL_PATH)/lib/
728 LDADD = -lm -lsimgrid
732 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
735 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
738 rm -f $(BIN_FILES) *.o *~
744 The first two lines indicates what should be build when typing make
745 (<tt>masterslave</tt>) and of which files it is to be made of
746 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
747 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
748 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
749 the static version, remove the <tt>-lsimgrid</tt> and add a
750 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
751 after the <tt>LIBS = </tt>.
753 More generally, if you have never written a Makefile by yourself, type
754 in a terminal : <tt>info make</tt> and read the introduction. The
755 previous example should be enough for a first try but you may want to
756 perform some more complex compilations...
758 \subsection faq_setting_GRAS Setting up your own GRAS code
760 If you use the GRAS interface instead of the MSG one, then previous section
761 is not the better source of information. Instead, you should check the GRAS
762 tutorial in general, and the \ref GRAS_tut_tour_setup in particular.
764 \section faq_howto Feature related questions
766 \subsection faq_MIA "Could you please add (your favorite feature here) to SimGrid?"
768 Here is the deal. The whole SimGrid project (MSG, SURF, GRAS, ...) is
769 meant to be kept as simple and generic as possible. We cannot add
770 functions for everybody's needs when these functions can easily be
771 built from the ones already in the API. Most of the time, it is
772 possible and when it was not possible we always have upgraded the API
773 accordingly. When somebody asks us a question like "How to do that?
774 Is there a function in the API to simply do this?", we're always glad
775 to answer and help. However if we don't need this code for our own
776 need, there is no chance we're going to write it... it's your job! :)
777 The counterpart to our answers is that once you come up with a neat
778 implementation of this feature (task duplication, RPC, thread
779 synchronization, ...), you should send it to us and we will be glad to
780 add it to the distribution. Thus, other people will take advantage of
781 it (and we don't have to answer this question again and again ;).
783 You'll find in this section a few "Missing In Action" features. Many
784 people have asked about it and we have given hints on how to simply do
785 it with MSG. Feel free to contribute...
787 \subsection faq_MIA_MSG MSG features
789 \subsubsection faq_MIA_examples I want some more complex MSG examples!
791 Many people have come to ask me a more complex example and each time,
792 they have realized afterward that the basics were in the previous three
795 Of course they have often been needing more complex functions like
796 MSG_process_suspend(), MSG_process_resume() and
797 MSG_process_isSuspended() (to perform synchronization), or
798 MSG_task_Iprobe() and MSG_process_sleep() (to avoid blocking
799 receptions), or even MSG_process_create() (to design asynchronous
800 communications or computations). But the examples are sufficient to
803 We know. We should add some more examples, but not really some more
804 complex ones... We should add some examples that illustrate some other
805 functionalists (like how to simply encode asynchronous
806 communications, RPC, process migrations, thread synchronization, ...)
807 and we will do it when we will have a little bit more time. We have
808 tried to document the examples so that they are understandable. Tell
809 us if something is not clear and once again feel free to participate!
812 \subsubsection faq_MIA_taskdup Missing in action: MSG Task duplication/replication
814 There is no task duplication in MSG. When you create a task, you can
815 process it or send it somewhere else. As soon as a process has sent
816 this task, he doesn't have this task anymore. It's gone. The receiver
817 process has got the task. However, you could decide upon receiving to
818 create a "copy" of a task but you have to handle by yourself the
819 semantic associated to this "duplication".
821 As we already told, we prefer keeping the API as simple as
822 possible. This kind of feature is rather easy to implement by users
823 and the semantic you associate really depends on people. Having a
824 *generic* task duplication mechanism is not that trivial (in
825 particular because of the data field). That is why I would recommand
826 that you write it by yourself even if I can give you advice on how to
829 You have the following functions to get informations about a task:
830 MSG_task_get_name(), MSG_task_get_compute_duration(),
831 MSG_task_get_remaining_computation(), MSG_task_get_data_size(),
832 and MSG_task_get_data().
834 You could use a dictionary (#xbt_dict_t) of dynars (#xbt_dynar_t). If
835 you still don't see how to do it, please come back to us...
837 \subsubsection faq_MIA_asynchronous I want to do asynchronous communications in MSG
839 In the past (version <= 3.4), there was no function to perform asynchronous communications.
840 It could easily be implemented by creating new process when needed though. Since version 3.5,
841 we have introduced the following functions:
850 We refer you to the description of these functions for more details on their usage as well
851 as to the exemple section on \ref MSG_ex_asynchronous_communications.
853 \subsubsection faq_MIA_thread_synchronization I need to synchronize my MSG processes
855 You obviously cannot use pthread_mutexes of pthread_conds since we handle every
856 scheduling related decision within SimGrid.
858 In the past (version <=3.3.4) you could do it by playing with
859 MSG_process_suspend() and MSG_process_resume() or with fake communications (using MSG_task_get(),
860 MSG_task_put() and MSG_task_Iprobe()).
862 Since version 3.4, you can use classical synchronization structures. See page \ref XBT_synchro or simply check in
863 include/xbt/synchro_core.h.
865 \subsubsection faq_MIA_host_load Where is the get_host_load function hidden in MSG?
867 There is no such thing because its semantic wouldn't be really
868 clear. Of course, it is something about the amount of host throughput,
869 but there is as many definition of "host load" as people asking for
870 this function. First, you have to remember that resource availability
871 may vary over time, which make any load notion harder to define.
873 It may be instantaneous value or an average one. Moreover it may be only the
874 power of the computer, or may take the background load into account, or may
875 even take the currently running tasks into account. In some SURF models,
876 communications have an influence on computational power. Should it be taken
879 First of all, it's near to impossible to predict the load beforehands in the
880 simulator since it depends on too much parameters (background load
881 variation, bandwidth sharing algorithmic complexity) some of them even being
882 not known beforehands (other task starting at the same time). So, getting
883 this information is really hard (just like in real life). It's not just that
884 we want MSG to be as painful as real life. But as it is in some way
885 realistic, we face some of the same problems as we would face in real life.
887 How would you do it for real? The most common option is to use something
888 like NWS that performs active probes. The best solution is probably to do
889 the same within MSG, as in next code snippet. It is very close from what you
890 would have to do out of the simulator, and thus gives you information that
891 you could also get in real settings to not hinder the realism of your
895 double get_host_load() {
896 m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
897 double date = MSG_get_clock();
899 MSG_task_execute(task);
900 date = MSG_get_clock() - date;
901 MSG_task_destroy(task);
906 Of course, it may not match your personal definition of "host load". In this
907 case, please detail what you mean on the mailing list, and we will extend
908 this FAQ section to fit your taste if possible.
910 \subsubsection faq_MIA_communication_time How can I get the *real* communication time?
912 Communications are synchronous and thus if you simply get the time
913 before and after a communication, you'll only get the transmission
914 time and the time spent to really communicate (it will also take into
915 account the time spent waiting for the other party to be
916 ready). However, getting the *real* communication time is not really
917 hard either. The following solution is a good starting point.
922 m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
923 calloc(1,sizeof(double)));
924 *((double*) task->data) = MSG_get_clock();
925 MSG_task_put(task, slaves[i % slaves_count], PORT_22);
926 INFO0("Send completed");
931 m_task_t task = NULL;
934 time1 = MSG_get_clock();
935 a = MSG_task_get(&(task), PORT_22);
936 time2 = MSG_get_clock();
937 if(time1<*((double *)task->data))
938 time1 = *((double *) task->data);
939 INFO1("Communication time : \"%f\" ", time2-time1);
941 MSG_task_destroy(task);
946 \subsection faq_MIA_SimDag SimDag related questions
948 \subsubsection faq_SG_comm Implementing communication delays between tasks.
950 A classic question of SimDag newcomers is about how to express a
951 communication delay between tasks. The thing is that in SimDag, both
952 computation and communication are seen as tasks. So, if you want to
953 model a data dependency between two DAG tasks t1 and t2, you have to
954 create 3 SD_tasks: t1, t2 and c and add dependencies in the following
958 SD_task_dependency_add(NULL, NULL, t1, c);
959 SD_task_dependency_add(NULL, NULL, c, t2);
962 This way task t2 cannot start before the termination of communication c
963 which in turn cannot start before t1 ends.
965 When creating task c, you have to associate an amount of data (in bytes)
966 corresponding to what has to be sent by t1 to t2.
968 Finally to schedule the communication task c, you have to build a list
969 comprising the workstations on which t1 and t2 are scheduled (w1 and w2
970 for example) and build a communication matrix that should look like
973 \subsubsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
975 Distributed is somehow "contagious". If you start making distributed
976 decisions, there is no way to handle DAGs directly anymore (unless I
977 am missing something). You have to encode your DAGs in term of
978 communicating process to make the whole scheduling process
979 distributed. Here is an example of how you could do that. Assume T1
980 has to be done before T2.
983 int your_agent(int argc, char *argv[] {
985 T1 = MSG_task_create(...);
986 T2 = MSG_task_create(...);
990 if(cond) MSG_task_execute(T1);
992 if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
995 /* do something else */
1001 If you decide that the distributed part is not that much important and that
1002 DAG is really the level of abstraction you want to work with, then you should
1003 give a try to \ref SD_API.
1005 \subsection faq_MIA_generic Generic features
1007 \subsubsection faq_more_processes Increasing the amount of simulated processes
1009 Here are a few tricks you can apply if you want to increase the amount
1010 of processes in your simulations.
1012 - <b>A few thousands of simulated processes</b> (soft tricks)\n
1013 SimGrid can use either pthreads library or the UNIX98 contextes. On
1014 most systems, the number of pthreads is limited and then your
1015 simulation may be limited for a stupid reason. This is especially
1016 true with the current linux pthreads, and I cannot get more than
1017 2000 simulated processes with pthreads on my box. The UNIX98
1018 contexts allow me to raise the limit to 25,000 simulated processes
1020 The <tt>--with-context</tt> option of the <tt>./configure</tt>
1021 script allows you to choose between UNIX98 contextes
1022 (<tt>--with-context=ucontext</tt>) and the pthread version
1023 (<tt>--with-context=pthread</tt>). The default value is ucontext
1024 when the script detect a working UNIX98 context implementation. On
1025 Windows boxes, the provided value is discarded and an adapted
1026 version is picked up.\n\n
1027 We experienced some issues with contextes on some rare systems
1028 (solaris 8 and lower or old alpha linuxes comes to mind). The main
1029 problem is that the configure script detect the contextes as being
1030 functional when it's not true. If you happen to use such a system,
1031 switch manually to the pthread version, and provide us with a good
1032 patch for the configure script so that it is done automatically ;)
1034 - <b>Hundred thousands of simulated processes</b> (hard-core tricks)\n
1035 As explained above, SimGrid can use UNIX98 contextes to represent
1036 and handle the simulated processes. Thanks to this, the main
1037 limitation to the number of simulated processes becomes the
1038 available memory.\n\n
1039 Here are some tricks I had to use in order to run a token ring
1040 between 25,000 processes on my laptop (1Gb memory, 1.5Gb swap).\n
1041 - First of all, make sure your code runs for a few hundreds
1042 processes before trying to push the limit. Make sure it's
1043 valgrind-clean, ie that valgrind does not report neither memory
1044 error nor memory leaks. Indeed, numerous simulated processes
1045 result in *fat* simulation hindering debugging.
1046 - It was really boring to write 25,000 entries in the deployment
1047 file, so I wrote a little script
1048 <tt>examples/gras/mutual_exclusion/simple_token/make_deployment.pl</tt>, which you may
1049 want to adapt to your case. You could also think about hijacking
1050 the SURFXML parser (have look at \ref faq_flexml_bypassing).
1051 - The deployment file became quite big, so I had to do what is in
1052 the FAQ entry \ref faq_flexml_limit
1053 - Each UNIX98 context has its own stack entry. As debugging this is
1054 quite hairly, the default value is a bit overestimated so that
1055 user don't get into trouble about this. You want to tune this
1056 size to increse the number of processes. This is the
1057 <tt>STACK_SIZE</tt> define in
1058 <tt>src/xbt/xbt_context_sysv.c</tt>, which is 128kb by default.
1059 Reduce this as much as you can, but be warned that if this value
1060 is too low, you'll get a segfault. The token ring example, which
1061 is quite simple, runs with 40kb stacks.
1062 - You may tweak the logs to reduce the stack size further. When
1063 logging something, we try to build the string to display in a
1064 char array on the stack. The size of this array is constant (and
1065 equal to XBT_LOG_BUFF_SIZE, defined in include/xbt/log/h). If the
1066 string is too large to fit this buffer, we move to a dynamically
1067 sized buffer. In which case, we have to traverse one time the log
1068 event arguments to compute the size we need for the buffer,
1069 malloc it, and traverse the argument list again to do the actual
1071 The idea here is to move XBT_LOG_BUFF_SIZE to 1, forcing the logs
1072 to use a dynamic array each time. This allows us to lower further
1073 the stack size at the price of some performance loss...\n
1074 This allowed me to run the reduce the stack size to ... 4k. Ie,
1075 on my 1Gb laptop, I can run more than 250,000 processes!
1077 \subsubsection faq_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid?
1079 No, there is no native support for batch schedulers and none is
1080 planned because this is a very specific need (and doing it in a
1081 generic way is thus very hard). However some people have implemented
1082 their own batch schedulers. Vincent Garonne wrote one during his PhD
1083 and put his code in the contrib directory of our SVN so that other can
1084 keep working on it. You may find inspiring ideas in it.
1086 \subsubsection faq_MIA_checkpointing I need a checkpointing thing
1088 Actually, it depends on whether you want to checkpoint the simulation, or to
1089 simulate checkpoints.
1091 The first one could help if your simulation is a long standing process you
1092 want to keep running even on hardware issues. It could also help to
1093 <i>rewind</i> the simulation by jumping sometimes on an old checkpoint to
1094 cancel recent calculations.\n
1095 Unfortunately, such thing will probably never exist in SG. One would have to
1096 duplicate all data structures because doing a rewind at the simulator level
1097 is very very hard (not talking about the malloc free operations that might
1098 have been done in between). Instead, you may be interested in the Libckpt
1099 library (http://www.cs.utk.edu/~plank/plank/www/libckpt.html). This is the
1100 checkpointing solution used in the condor project, for example. It makes it
1101 easy to create checkpoints (at the OS level, creating something like core
1102 files), and rerunning them on need.
1104 If you want to simulate checkpoints instead, it means that you want the
1105 state of an executing task (in particular, the progress made towards
1106 completion) to be saved somewhere. So if a host (and the task executing on
1107 it) fails (cf. #MSG_HOST_FAILURE), then the task can be restarted
1108 from the last checkpoint.\n
1110 Actually, such a thing does not exists in SimGrid either, but it's just
1111 because we don't think it is fundamental and it may be done in the user code
1112 at relatively low cost. You could for example use a watcher that
1113 periodically get the remaining amount of things to do (using
1114 MSG_task_get_remaining_computation()), or fragment the task in smaller
1117 \subsection faq_platform Platform building and Dynamic resources
1119 \subsubsection faq_platform_example Where can I find SimGrid platform files?
1121 There is several little examples in the archive, in the examples/msg
1122 directory. From time to time, we are asked for other files, but we
1123 don't have much at hand right now.
1125 You should refer to the Platform Description Archive
1126 (http://pda.gforge.inria.fr) project to see the other platform file we
1127 have available, as well as the Simulacrum simulator, meant to generate
1128 SimGrid platforms using all classical generation algorithms.
1130 \subsubsection faq_platform_alnem How can I automatically map an existing platform?
1132 We are working on a project called ALNeM (Application-Level Network
1133 Mapper) which goal is to automatically discover the topology of an
1134 existing network. Its output will be a platform description file
1135 following the SimGrid syntax, so everybody will get the ability to map
1136 their own lab network (and contribute them to the catalog project).
1137 This tool is not ready yet, but it move quite fast forward. Just stay
1140 \subsubsection faq_platform_synthetic Generating synthetic but realistic platforms
1142 The third possibility to get a platform file (after manual or
1143 automatic mapping of real platforms) is to generate synthetic
1144 platforms. Getting a realistic result is not a trivial task, and
1145 moreover, nobody is really able to define what "realistic" means when
1146 speaking of topology files. You can find some more thoughts on this
1148 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">slides</a>.
1150 If you are looking for an actual tool, there we have a little tool to
1151 annotate Tiers-generated topologies. This perl-script is in
1152 <tt>tools/platform_generation/</tt> directory of the SVN. Dinda et Al.
1153 released a very comparable tool, and called it GridG.
1155 \subsubsection faq_SURF_multicore Modeling multi-core resources
1157 There is currently no native support for multi-core or SMP machines in
1158 SimGrid. We are currently working on it, but coming up with the right
1159 model is very hard: Cores share caches and bus to access memory and
1160 thus interfere with each others. Memory contention is a crucial
1161 component of multi-core modeling.
1163 In the meanwhile, some user-level tricks can reveal sufficient for
1164 you. For example, you may model each core by a CPU and add some very
1165 high speed links between them. This complicates a bit the user code
1166 since you have to remember that when you assign something to a (real)
1167 host, it can be any of the (fake) hosts representing the cores of a
1168 given machine. For that, you can use the prop tag of the XML files as
1169 follows. Your code should then look at the ‘machine’ property
1170 associated with each workstation, and run parallel tasks over all
1171 cores of the machine.
1174 <host id="machine0/core0" power="91500E6">
1175 <prop id="machine" value="machine0"/>
1176 <prop id="core" value="0"/>
1178 <host id="machine0/core1" power="91500E6">
1179 <prop id="machine" value="machine0"/>
1180 <prop id="core" value="1"/>
1186 \subsubsection faq_SURF_dynamic Modeling dynamic resource availability
1188 A nice feature of SimGrid is that it enables you to seamlessly have
1189 resources whose availability change over time. When you build a
1190 platform, you generally declare hosts like that:
1193 <host id="host A" power="100.00"/>
1196 If you want the availability of "host A" to change over time, the only
1197 thing you have to do is change this definition like that:
1200 <host id="host A" power="100.00" availability_file="trace_A.txt" state_file="trace_A_failure.txt"/>
1203 For hosts, availability files are expressed in fraction of available
1204 power. Let's have a look at what "trace_A.txt" may look like:
1213 At time 0, our host will deliver 100 flop/s. At time 11.0, it will
1214 deliver only 50 flop/s until time 20.0 where it will will start
1215 delivering 90 flop/s. Last at time 21.0 (20.0 plus the periodicity
1216 1.0), we'll be back to the beginning and it will deliver 100 flop/s.
1218 Now let's look at the state file:
1225 A negative value means "off" while a positive one means "on". At time
1226 1.0, the host is on. At time 1.0, it is turned off and at time 2.0, it
1227 is turned on again until time 12 (2.0 plus the periodicity 10.0). It
1228 will be turned on again at time 13.0 until time 23.0, and so on.
1230 Now, let's look how the same kind of thing can be done for network
1231 links. A usual declaration looks like:
1234 <link id="LinkA" bandwidth="10.0" latency="0.2"/>
1237 You have at your disposal the following options: bandwidth_file,
1238 latency_file and state_file. The only difference with hosts is that
1239 bandwidth_file and latency_file do not express fraction of available
1240 power but are expressed directly in bytes per seconds and seconds.
1242 \subsubsection faq_platform_multipath How to express multipath routing in platform files?
1244 It is unfortunately impossible to express the fact that there is more
1245 than one routing path between two given hosts. Let's consider the
1246 following platform file:
1249 <route src="A" dst="B">
1252 <route src="B" dst="C">
1255 <route src="A" dst="C">
1260 Although it is perfectly valid, it does not mean that data traveling
1261 from A to C can either go directly (using link 3) or through B (using
1262 links 1 and 2). It simply means that the routing on the graph is not
1263 trivial, and that data do not following the shortest path in number of
1264 hops on this graph. Another way to say it is that there is no implicit
1265 in these routing descriptions. The system will only use the routes you
1266 declare (such as <route src="A" dst="C"><link:ctn
1267 id="3"/></route>), without trying to build new routes by aggregating
1270 You are also free to declare platform where the routing is not
1271 symmetric. For example, add the following to the previous file:
1274 <route src="C" dst="A">
1280 This makes sure that data from C to A go through B where data from A
1281 to C go directly. Don't worry about realism of such settings since
1282 we've seen ways more weird situation in real settings (in fact, that's
1283 the realism of very regular platforms which is questionable, but
1284 that's another story).
1286 \subsubsection faq_flexml_bypassing Bypassing the XML parser with your own C functions
1288 So you want to bypass the XML files parser, uh? Maybe doing some parameter
1289 sweep experiments on your simulations or so? This is possible, and
1290 it's not even really difficult (well. Such a brutal idea could be
1291 harder to implement). Here is how it goes.
1293 For this, you have to first remember that the XML parsing in SimGrid is done
1294 using a tool called FleXML. Given a DTD, this gives a flex-based parser. If
1295 you want to bypass the parser, you need to provide some code mimicking what
1296 it does and replacing it in its interactions with the SURF code. So, let's
1297 have a look at these interactions.
1299 FleXML parser are close to classical SAX parsers. It means that a
1300 well-formed SimGrid platform XML file might result in the following
1303 - start "platform_description" with attribute version="2"
1304 - start "host" with attributes id="host1" power="1.0"
1306 - start "host" with attributes id="host2" power="2.0"
1308 - start "link" with ...
1310 - start "route" with ...
1311 - start "link:ctn" with ...
1314 - end "platform_description"
1316 The communication from the parser to the SURF code uses two means:
1317 Attributes get copied into some global variables, and a surf-provided
1318 function gets called by the parser for each event. For example, the event
1319 - start "host" with attributes id="host1" power="1.0"
1321 let the parser do something roughly equivalent to:
1323 strcpy(A_host_id,"host1");
1328 In SURF, we attach callbacks to the different events by initializing the
1329 pointer functions to some the right surf functions. Since there can be
1330 more than one callback attached to the same event (if more than one
1331 model is in use, for example), they are stored in a dynar. Example in
1332 workstation_ptask_L07.c:
1334 /* Adding callback functions */
1335 surf_parse_reset_parser();
1336 surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
1337 surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
1338 surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
1339 surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
1340 surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
1341 surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
1343 /* Parse the file */
1344 surf_parse_open(file);
1345 xbt_assert1((!surf_parse()), "Parse error in %s", file);
1349 So, to bypass the FleXML parser, you need to write your own version of the
1350 surf_parse function, which should do the following:
1351 - Fill the A_<tag>_<attribute> variables with the wanted values
1352 - Call the corresponding STag_<tag>_fun function to simulate tag start
1353 - Call the corresponding ETag_<tag>_fun function to simulate tag end
1354 - (do the same for the next set of values, and loop)
1356 Then, tell SimGrid that you want to use your own "parser" instead of the stock one:
1358 surf_parse = surf_parse_bypass_environment;
1359 MSG_create_environment(NULL);
1360 surf_parse = surf_parse_bypass_application;
1361 MSG_launch_application(NULL);
1364 A set of macros are provided at the end of
1365 include/surf/surfxml_parse.h to ease the writing of the bypass
1366 functions. An example of this trick is distributed in the file
1367 examples/msg/masterslave/masterslave_bypass.c
1369 \subsection faq_simgrid_configuration Changing SimGrid's behavior
1371 A number of options can be given at runtime to change the default
1372 SimGrid behavior. In particular, you can change the default cpu and
1375 \subsubsection faq_simgrid_configuration_fullduplex Using Fullduplex
1377 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
1378 of interconnected hosts, see an example here:
1380 simgrid_svn_sources/exemples/msg/gtnets/fullduplex-p.xml
1383 Using fullduplex support ongoing and incoming communication flows are
1384 treated independently for most models. The exception is the LV08 model which
1385 adds 0.05 of usage on the opposite direction for each new created flow. This
1386 can be useful to simulate some important TCP phenomena such as ack compression.
1388 Running a fullduplex example:
1390 cd simgrid_svn_sources/exemples/msg/gtnets
1391 ./gtnets fullduplex-p.xml fullduplex-d.xml --cfg=fullduplex:1
1398 \subsubsection faq_simgrid_configuration_gtnets Using GTNetS
1400 It is possible to use a packet-level network simulator
1401 instead of the default flow-based simulation. You may want to use such
1402 an approach if you have doubts about the validity of the default model
1403 or if you want to perform some validation experiments. At the moment,
1404 we support the GTNetS simulator (it is still rather experimental
1405 though, so leave us a message if you play with it).
1409 To enable GTNetS model inside SimGrid it is needed to patch the GTNetS simulator source code
1410 and build/install it from scratch
1413 - <b>Download and enter the recent downloaded GTNetS directory</b>
1416 svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
1421 - <b>Use the following commands to unzip and patch GTNetS package to work within SimGrid.</b>
1424 unzip gtnets-current.zip
1425 tar zxvf gtnets-current-patch.tgz
1427 cat ../00*.patch | patch -p1
1430 - <b>OPTIONALLY</b> you can use a patch for itanium 64bit processor family.
1433 cat ../AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch | patch -p1
1436 - <b>Compile GTNetS</b>
1438 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.
1442 ln -sf Makefile.linux Makefile
1448 - <b>NOTE</b> A lot of warnings are expected but the application should compile
1449 just fine. If the makefile insists in compiling some QT libraries
1450 please try a make clean before asking for help.
1453 - <b>To compile optimized version</b>
1460 - <b>Installing GTNetS</b>
1462 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.
1465 ln -sf /<absolute_path>/gtnets_current/libgtsim-debug.so /<userhome>/usr/lib/libgtnets.so
1466 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/<userhome>/usr/lib/libgtnets.so
1467 mkdir /<userhome>/usr/include/gtnets
1468 cp -fr SRC/*.h /<userhome>/usr/include/gtnets
1472 - <b>Enable GTNetS support in SimGrid</b>
1474 In order to enable gtnets with simgrid you have to give where is gtnets. (path to <gtnets_path>/lib and <gtnets_path>/include)
1477 Since v3.4 (with cmake)
1478 cmake . -Dgtnets_path=/<userhome>/usr
1480 Until v3.4 (with autotools)
1481 ./configure --with-gtnets=/<userhome>/usr
1484 - <b>Once you have followed all the instructions for compiling and
1485 installing successfully you can activate this feature at
1486 runntime with the following options:</b>
1489 Since v3.4 (with cmake)
1494 Until v3.4 (with autotools)
1495 cd simgrid/example/msg/
1501 - <b>Or try the GTNetS model dogbone example with</b>
1504 gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network_model:GTNets
1508 A long version of this <a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS HowTo.html">HowTo</a> it is available
1511 More about GTNetS simulator at <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS Website</a>
1515 The patches provided by us worked successfully with GTNetS found
1516 <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>,
1517 dated from 12th June 2008. Due to the discontinuing development of
1518 GTNetS it is impossible to precise a version number. We STRONGLY recommend you
1519 to download and install the GTNetS version found in SimGrid repository as explained above.
1524 \subsubsection faq_simgrid_configuration_alternate_network Using alternative flow models
1526 The default simgrid network model uses a max-min based approach as
1527 explained in the research report
1528 <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>.
1529 Other models have been proposed and implemented since then (see for example
1530 <a href="http://mescal.imag.fr/membres/arnaud.legrand/articles/simutools09.pdf">Accuracy Study and Improvement of Network Simulation in the SimGrid Framework</a>)
1531 and can be activated at runtime. For example:
1533 ./mycode platform.xml deployment.xml --cfg=workstation/model:compound --cfg=network/model:LV08 -cfg=cpu/model:Cas01
1536 Possible models for the network are currently "Constant", "CM02",
1537 "LegrandVelho", "GTNets", Reno", "Reno2", "Vegas". Others will
1538 probably be added in the future and many of the previous ones are
1539 experimental and are likely to disappear without notice... To know the
1540 list of the currently implemented models, you should use the
1541 --help-models command line option.
1544 ./masterslave_forwarder ../small_platform.xml deployment_masterslave.xml --help-models
1545 Long description of the workstation models accepted by this simulator:
1546 CLM03: Default workstation model, using LV08 and CM02 as network and CPU
1547 compound: Workstation model allowing you to use other network and CPU models
1548 ptask_L07: Workstation model with better parallel task modeling
1549 Long description of the CPU models accepted by this simulator:
1550 Cas01_fullupdate: CPU classical model time=size/power
1551 Cas01: Variation of Cas01_fullupdate with partial invalidation optimization of lmm system. Should produce the same values, only faster
1552 CpuTI: Variation of Cas01 with also trace integration. Should produce the same values, only faster if you use availability traces
1553 Long description of the network models accepted by this simulator:
1554 Constant: Simplistic network model where all communication take a constant time (one second)
1555 CM02: Realistic network model with lmm_solve and no correction factors
1556 LV08: Realistic network model with lmm_solve and these correction factors: latency*=10.4, bandwidth*=.92, S=8775
1557 Reno: Model using lagrange_solve instead of lmm_solve (experts only)
1558 Reno2: Model using lagrange_solve instead of lmm_solve (experts only)
1559 Vegas: Model using lagrange_solve instead of lmm_solve (experts only)
1562 \subsection faq_tracing Tracing Simulations for Visualization
1564 The trace visualization is widely used to observe and understand the behavior
1565 of parallel applications and distributed algorithms. Usually, this is done in a
1566 two-step fashion: the user instruments the application and the traces are
1567 analyzed after the end of the execution. The visualization itself can highlights
1568 unexpected behaviors, bottlenecks and sometimes can be used to correct
1569 distributed algorithms. The SimGrid team has instrumented the library
1570 in order to let users trace their simulations and analyze them. This part of the
1571 user manual explains how the tracing-related features can be enabled and used
1572 during the development of simulators using the SimGrid library.
1574 \subsubsection faq_tracing_howitworks How it works
1576 For now, the SimGrid library is instrumented so users can trace the <b>platform
1577 utilization</b> using the MSG, SimDAG and SMPI interface. This means that the tracing will
1578 register how much power is used for each host and how much bandwidth is used for
1579 each link of the platform. The idea with this type of tracing is to observe the
1580 overall view of resources utilization in the first place, especially the
1581 identification of bottlenecks, load-balancing among hosts, and so on.
1583 The idea of the tracing facilities is to give SimGrid users to possibility to
1584 classify MSG and SimDAG tasks by category, tracing the platform utilization
1585 (hosts and links) for each of the categories. For that,
1586 the tracing interface enables the declaration of categories and a function to
1587 mark a task with a previously declared category. <em>The tasks that are not
1588 classified according to a category are not traced</em>. Even if the user
1589 does not specify any category, the simulations can still be traced in terms
1590 of resource utilization by using a special parameter that is detailed below.
1592 \subsubsection faq_tracing_enabling Enabling using CMake
1594 With the sources of SimGrid, it is possible to enable the tracing
1595 using the parameter <b>-Denable_tracing=ON</b> when the cmake is executed.
1596 The section \ref faq_tracing_functions describes all the functions available
1597 when this Cmake options is activated. These functions will have no effect
1598 if SimGrid is configured without this option (they are wiped-out by the
1602 $ cmake -Denable_tracing=ON .
1606 \subsubsection faq_tracing_functions Tracing Functions
1608 \li <b>\c TRACE_category (const char *category)</b>: This function should be used
1609 to define a user category. The category can be used to differentiate the tasks
1610 that are created during the simulation (for example, tasks from server1,
1611 server2, or request tasks, computation tasks, communication tasks).
1612 All resource utilization (host power and link bandwidth) will be
1613 classified according to the task category. Tasks that do not belong to a
1614 category are not traced.
1616 \li <b>\c TRACE_msg_set_task_category (m_task_t task, const char *category)</b>:
1617 This function should be called after the creation of a MSG task, to define the
1618 category of that task. The first parameter \c task must contain a task that was
1619 created with the function \c MSG_task_create. The second parameter
1620 \c category must contain a category that was previously defined by the function
1623 \li <b>\c TRACE_sd_set_task_category (SD_task_t task, const char *category)</b>:
1624 This function should be called after the creation of a SimDAG task, to define the
1625 category of that task. The first parameter \c task must contain a task that was
1626 created with the function \c MSG_task_create. The second parameter
1627 \c category must contain a category that was previously defined by the function
1630 \li <b>\c TRACE_host_variable_declare (const char *variable)</b>:
1631 Declare a user variable that will be associated to hosts. A variable can
1632 be used to trace user variables such as the number of tasks in a server,
1633 the number of clients in an application, and so on.
1635 \li <b>\c TRACE_host_variable_[set|add|sub] (const char *variable, double
1637 Set the value of a given user variable. It is important to remind that
1638 the value of this variable is always associated to the host. The host
1639 that will be used when these functions are called is the one returned by
1640 the function \c MSG_host_self().
1642 \subsubsection faq_tracing_options Tracing configuration Options
1644 These are the options accepted by the tracing system of SimGrid:
1649 It activates the tracing system and register the simulation platform
1650 in the trace file. You have to enable this option to others take effect.
1655 It activates the categorized resource utilization tracing. It should
1656 be enabled if tracing categories are used by this simulator.
1659 tracing/uncategorized
1661 It activates the uncategorized resource utilization tracing. Use it if
1662 this simulator do not use tracing categories and resource use have to be
1666 tracing/platform/method
1668 It changes the way resource utilization (categorized or not) is traced
1669 inside the simulation core. Method 'a' (default) traces all updates defined
1670 by the CPU/network model of a given resource. Depending on the interface used
1671 by this simulator (MSG, SMPI, SimDAG), the default method can generate large
1672 trace files. Method 'b' tries to make smaller tracefiles using clever updates,
1673 without losing details of resource utilization. Method 'c' generates even
1674 smaller files by doing time integration during the simulation, but it loses
1675 precision. If this last method is used, the smallest timeslice used in the
1676 tracefile analysis must be bigger than the smaller resource utilization. If
1677 unsure, do not change this option.
1682 A file with this name will be created to register the simulation. The file
1683 is in the Paje format and can be analyzed using Triva or Paje visualization
1684 tools. More information can be found in these webpages:
1685 <a href="http://triva.gforge.inria.fr/">http://triva.gforge.inria.fr/</a>
1686 <a href="http://paje.sourceforge.net/">http://paje.sourceforge.net/</a>
1691 This option only has effect if this simulator is SMPI-based. Traces the MPI
1692 interface and generates a trace that can be analyzed using Gantt-like
1693 visualizations. Every MPI function (implemented by SMPI) is transformed in a
1694 state, and point-to-point communications can be analyzed with arrows.
1699 This option only has effect if this simulator is SMPI-based. The processes
1700 are grouped by the hosts where they were executed.
1705 This option only has effect if this simulator is MSG-based. It traces the
1706 behavior of all categorized MSG tasks, grouping them by hosts.
1711 This option only has effect if this simulator is MSG-based. It traces the
1712 behavior of all categorized MSG processes, grouping them by hosts. This option
1713 can be used to track process location if this simulator has process migration.
1718 This experimental option only has effect if this simulator is MSG-based.
1719 It traces the communication volume of MSG send/receive.
1721 \subsubsection faq_tracing_example Example of Instrumentation
1723 A simplified example using the tracing mandatory functions.
1726 int main (int argc, char **argv)
1728 MSG_global_init (&argc, &argv);
1730 //note that TRACE_start must be called after MSG_global_init
1731 TRACE_category_with_color ("request", "1 0 0");
1732 TRACE_category_with_color ("computation", "0.3 1 0.4");
1733 TRACE_category ("finalize");
1735 //(... after deployment ...)
1737 m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
1738 m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
1739 m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
1740 m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
1741 TRACE_msg_set_task_category (req1, "request");
1742 TRACE_msg_set_task_category (req2, "request");
1743 TRACE_msg_set_task_category (req3, "request");
1744 TRACE_msg_set_task_category (req4, "request");
1746 m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
1747 TRACE_msg_set_task_category (comp, "computation");
1749 m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
1750 TRACE_msg_set_task_category (finalize, "finalize");
1759 \subsubsection faq_tracing_analyzing Analyzing the SimGrid Traces
1761 The SimGrid library, during an instrumented simulation, creates a trace file in
1762 the Paje file format that contains the platform utilization for the simulation
1763 that was executed. The visualization analysis of this file is performed with the
1764 visualization tool <a href="http://triva.gforge.inria.fr">Triva</a>, with
1765 special configurations tunned to SimGrid needs. This part of the documentation
1766 explains how to configure and use Triva to analyse a SimGrid trace file.
1768 - <b>Installing Triva</b>: the tool is available in the INRIAGforge,
1769 at <a href="http://triva.gforge.inria.fr">http://triva.gforge.inria.fr</a>.
1770 Use the following command to get the sources, and then check the file
1771 <i>INSTALL</i>. This file contains instructions to install
1772 the tool's dependencies in a Ubuntu/Debian Linux. The tool can also
1773 be compiled in MacOSes natively, check <i>INSTALL.mac</i> file.
1775 $ svn checkout svn://scm.gforge.inria.fr/svn/triva
1780 - <b>Executing Triva</b>: a binary called <i>Triva</i> is available after the
1781 installation (you can execute it passing <em>--help</em> to check its
1782 options). If the triva binary is not available after following the
1783 installation instructions, you may want to execute the following command to
1784 initialize the GNUstep environment variables. We strongly recommend that you
1785 use the latest GNUstep packages, and not the packages available through apt-get
1786 in Ubuntu/Debian packaging systems. If you install GNUstep using the latest
1787 available packages, you can execute this command:
1789 $ source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
1791 You should be able to see this output after the installation of triva:
1793 $ ./Triva.app/Triva --help
1794 Usage: Triva [OPTIONS...] TRACE0 [TRACE1]
1795 Trace Analysis through Visualization
1798 --ti_frequency {double} Animation: frequency of updates
1799 --ti_hide Hide the TimeInterval window
1800 --ti_forward {double} Animation: value to move time-slice
1801 --ti_apply Apply the configuration
1802 --ti_update Update on slider change
1803 --ti_animate Start animation
1804 --ti_start {double} Start of time slice
1805 --ti_size {double} Size of time slice
1807 --comparison Compare Trace Files (Experimental)
1808 --graph Configurable Graph
1809 --list Print Trace Type Hierarchy
1810 --hierarchy Export Trace Type Hierarchy (dot)
1811 --stat Trace Statistics and Memory Utilization
1812 --instances List All Trace Entities
1813 --linkview Link View (Experimental)
1814 --treemap Squarified Treemap
1815 --merge Merge Trace Files (Experimental)
1816 --check Check Trace File Integrity
1818 --gc_conf {file} Graph Configuration in Property List Format
1819 --gc_apply Apply the configuration
1820 --gc_hide Hide the GraphConfiguration window
1822 Triva expects that the user choose one of the available options
1823 (currently <em>--graph</em> or <em>--treemap</em> for a visualization analysis)
1824 and the trace file from the simulation.
1826 - <b>Understanding Triva - time-slice</b>: the analysis of a trace file using
1827 the tool always takes into account the concept of the <em>time-slice</em>.
1828 This concept means that what is being visualized in the screen is always
1829 calculated considering a specific time frame, with its beggining and end
1830 timestamp. The time-slice is configured by the user and can be changed
1831 dynamically through the window called <em>Time Interval</em> that is opened
1832 whenever a trace file is being analyzed. The next figure depicts the time-slice
1833 configuration window.
1834 In the top of the window, in the space named <i>Trace Time</i>,
1835 the two fields show the beggining of the trace (which usually starts in 0) and
1836 the end (that depends on the time simulated by SimGrid). The middle of the
1837 window, in the square named <i>Time Slice Configuration</i>, contains the
1838 aspects related to the time-slice, including its <i>start</i> and its
1839 <i>size</i>. The gray rectangle in the bottom of this part indicates the
1840 <i>current time-slice</i> that is considered for the drawings. If the checkbox
1841 <i>Update Drawings on Sliders Change</i> is not selected, the button
1842 <i>Apply</i> must be clicked in order to inform triva that the
1843 new time-slice must be considered. The bottom part of the window, in the space
1844 indicated by the square <i>Time Slice Animation</i> can be used to advance
1845 the time-frame automatically. The user configures the amount of time that the
1846 time-frame will forward and how frequent this update will happen. Once this is
1847 configured, the user clicks the <i>Play</i> button in order to see the dynamic
1848 changes on the drawings.
1851 <a href="triva-time_interval.png" border=0><img src="triva-time_interval.png" width="50%" border=0></a>
1854 <b>Remarks:</b> when the trace has too many hosts or links, the computation to
1855 take into account a new time-slice can be expensive. When this happens, the
1856 <i>Frequency</i> parameter, but also updates caused by change on configurations
1857 when the checkbox <i>Update Drawings on Sliders
1858 Change</i> is selected will not be followed.
1860 - <b>Understanding Triva - graph</b>: this part of the documention explains how
1861 to analyze the traces using the graph view of Triva, when the user executes
1862 the tool passing <em>--graph</em> as parameter. Triva opens three windows when
1863 this parameter is used: the <i>Time Interval</i> window (previously described),
1864 the <i>Graph Representation</i> window, and the <em>Graph Configuration</em>
1865 window. The Graph Representation is the window where drawings take place.
1866 Initially, it is completely white waiting for a proper graph configuration input
1867 by the user. We start the description of this type of analysis by describing the
1868 <i>Graph Configuration</i> window (depicted below). By using a particular
1869 configuration, triva
1870 can be used to customize the graph drawing according to
1871 the SimGrid trace that was created with user-specific categories. Before delving
1872 into the details of this customization, let us first explain the major parts of
1873 the graph configuration window. The buttons located in the top-right corner can
1874 be used to delete, copy and create a new configuration. The checkbox in the
1875 top-middle part of the window indicates if the configuration typed in the
1876 textfield is syntactically correct (we are using the non-XML
1877 <a href="http://en.wikipedia.org/wiki/Property_list">Property List Format</a> to
1878 describe the configuration). The pop-up button located on the top-left corner
1879 indicates the selected configuration (the user can have multiple graph
1880 configurations). The bottom-left text field contains the name of the current
1881 configuration (updates on this field must be followed by typing enter on the
1882 keyboard to take into account the name change). The bottom-right <em>Apply</em>
1883 button activates the current configuration, resulting on an update on the graph
1887 <a href="triva-graph_configuration.png" border=0><img src="triva-graph_configuration.png" width="50%" border=0></a>
1890 <b>Basic SimGrid Configuration</b>: The figure shows in the big textfield the
1891 basic configuration that should be used during the analysis of a SimGrid trace
1892 file. The basic logic of the configuration is as follows:
1898 The nodes of the graph will be created based on the <i>node</i> parameter, which
1899 in this case is the different <em>"HOST"</em>s of the platform
1900 used to simulate. The <i>edge</i> parameter indicates that the edges of the
1901 graph will be created based on the <em>"LINK"</em>s of the platform. After the
1902 definition of these two parameters, the configuration must detail how
1903 <em>HOST</em>s and <em>LINK</em>s should be drawn. For that, the configuration
1904 must have an entry for each of the types used. For <em>HOST</em>, as basic
1905 configuration, we have:
1912 The parameter <em>size</em> indicates which variable from the trace file will be
1913 used to define the size of the node HOST in the visualization. If the simulation
1914 was executed with availability traces, the size of the nodes will be changed
1915 according to these traces. The parameter <em>scale</em> indicates if the value
1916 of the variable is <em>global</em> or <em>local</em>. If it is global, the value
1917 will be relative to the power of all other hosts, if it is local, the value will
1918 be relative locally.
1919 For <em>LINK</em> we have:
1929 For the types specified in the <em>edge</em> parameter (such as <em>LINK</em>),
1930 the configuration must contain two additional parameters: <em>src</em> and
1931 <em>dst</em> that are used to properly identify which nodes this edge is
1932 connecting. The values <em>source</em> and <em>destination</em> are always present
1933 in the SimGrid trace file and should not be changed in the configuration. The
1934 parameter <em>size</em> for the LINK, in this case, is configured as the
1935 variable <em>bandwidth</em>, with a <em>global</em> scale. The scale meaning
1936 here is exactly the same used for nodes. The last parameter is the GraphViz
1937 algorithm used to calculate the position of the nodes in the graph
1940 graphviz-algorithm = neato;
1943 <b>Customizing the Graph Representation</b>: triva is capable to handle
1944 a customized graph representation based on the variables present in the trace
1945 file. In the case of SimGrid, every time a category is created for tasks, two
1946 variables in the trace file are defined: one to indicate node utilization (how
1947 much power was used by that task category), and another to indicate link
1948 utilization (how much bandwidth was used by that category). For instance, if the
1949 user declares a category named <i>request</i>, there will be variables named
1950 <b>p</b><i>request</i> and a <b>b</b><i>request</i> (<b>p</b> for power and
1951 <b>b</b> for bandwidth). It is important to notice that the variable
1952 <i>prequest</i> in this case is only available for HOST, and
1953 <i>brequest</i> is only available for LINK. <b>Example</b>: suppose there are
1954 two categories for tasks: request and compute. To create a customized graph
1955 representation with a proportional separation of host and link utilization, use
1956 as configuration for HOST and LINK this:
1965 values = (prequest, pcomputation);
1978 values = (brequest, bcomputation);
1982 Where <i>sep_host</i> contains a composition of type <i>separation</i> where
1983 its max size is the <i>power</i> of the host and the variables <i>prequest</i>
1984 and <i>pcomputation</i> are drawn proportionally to the size of the HOST. And
1985 <i>sep_link</i> is also a separation where max is defined as the
1986 <i>bandwidth</i> of the link, and the variables <i>brequest</i> and
1987 <i>bcomputation</i> are drawn proportionally within a LINK.
1988 <i>This configuration enables the analysis of resource utilization by MSG tasks,
1989 and the identification of load-balancing issues, network bottlenecks, for
1991 <b>Other compositions</b>: besides <i>separation</i>, it is possible to use
1992 other types of compositions, such as gradients, and colors, like this:
1997 values = (numberOfTasks);
2001 values = (is_server);
2004 Where <i>gra_host</i> creates a gradient within a node of the graph, using a
2005 global scale and using as value a variable called <i>numberOfTasks</i>, that
2006 could be declared by the user using the optional tracing functions of SimGrid.
2007 If scale is global, the max and min value for the gradient will be equal to the
2008 max and min numberOfTasks among all hosts, and if scale is local, the max and
2009 min value based on the value of numberOfTasks locally in each host.
2010 And <i>color_host</i> composition draws a square based on a positive value of
2011 the variable <i>is_server</i>, that could also be defined by the user using the
2012 SimGrid tracing functions. \n
2013 <b>The Graph Visualization</b>: The next figure shows a graph visualization of a
2014 given time-slice of the masterslave_forwarder example (present in the SimGrid
2015 sources). The red color indicates tasks from the <i>compute</i> category. This
2016 visualization was generated with the following configuration:
2029 values = (pcompute, pfinalize);
2041 values = (bcompute, bfinalize);
2044 graphviz-algorithm = neato;
2049 <a href="triva-graph_visualization.png" border=0><img src="triva-graph_visualization.png" width="50%" border=0></a>
2053 - <b>Understading Triva - colors</b>: An important issue when using Triva is how
2054 to define colors. To do that, we have to know which variables are defined in
2055 the trace file generated by the SimGrid library. The parameter <em>--list</em>
2056 lists the variables for a given trace file:
2058 $ Triva -l masterslave_forwarder.trace
2076 We can see that HOST has seven variables (from power to pfinalize) and LINK has
2077 four (from bandwidth to bfinalize). To define a red color for the
2078 <i>pcompute</i> and <i>bcompute</i> (which are defined based on user category
2079 <i>compute</i>), execute:
2081 $ defaults write Triva 'pcompute Color' '1 0 0'
2082 $ defaults write Triva 'bcompute Color' '1 0 0'
2084 Where the three numbers in each line are the RGB color with values from 0 to 1.
2086 \subsection faq_modelchecking Model-Checking
2087 \subsubsection faq_modelchecking_howto How to use it
2088 To enable the experimental SimGrid model-checking support the program should
2089 be executed with the command line argument
2093 Properties are expressed as assertions using the function
2095 void MC_assert(int prop);
2098 \subsection faq_binding_lua Lua Binding
2099 Most of Simgrid modules require a good level in C programming, since simgrid is used to be as standard C library.
2100 Sometime users prefer using some kind of « easy scripts » or a language easier to code with, for their works,
2101 which avoid dealing with C errors, and sometime an important gain of time.
2102 Besides Java Binding, Lua and Ruby bindings are available since version 3.4 of Simgrid
2103 for MSG Module, and we are currenlty working on bindings for other modules.
2106 \subsubsection faq_binding_lua_about What is lua ?
2107 Lua is a lightweight, reflective, imperative and functional programming language,
2108 designed as a scripting language with extensible semantics as a primary goal (see official web site <a href="http://www.lua.org">here</a>).
2109 \subsubsection faq_binding_lua_why Why lua ?
2110 Lua is a fast, portable and powerful script language, quite simple to use for developpers.
2111 it combines procedural features with powerful data description facilities,
2112 by using a simple, yet powerful, mechanism of tables.
2113 Lua has a relatively simple C API compared to other scripting languages,
2114 and accordingly it provides a robust, easy to use it.
2115 \subsubsection faq_binding_lua_simgrid How to use lua in Simgrid ?
2116 Actually, the use of lua in Simgrid is quite simple, you have just to follow the same steps as coding with C in Simgird :
2117 - Coding functions coresponding to each process
2118 - loading the platforme/deployment XML file that describe the environment of simulation
2119 - and … Running the Simulation.
2121 \dontinclude lua/master_slave.lua
2122 \subsubsection faq_binding_lua_example_master_slave Master/Slave Example
2125 \until end_of_master
2126 we mainly use simgrid.Task.new(task_name,computation_size,communication_size) to create our MSG Task,
2127 then simgrid.Task.send(task,alias) to send it.
2128 we use also simgrid.Task.name(task), to get the task's name.
2132 Here, we see the use of simgrid.Task.recv(alias) to receive a task with a specific alias,
2133 this function return directly the task recevied.
2135 \li Set Environmenet and run application
2136 \until simgrid.clean()
2138 \subsubsection faq_binding_lua_example_data Exchanging Data
2139 You can also exchange data between Process using lua. for that, you have to deal with lua task as a table,
2140 since lua is based itself on a mechanism of tables,
2141 so you can exchange any kind of data (tables, matrix, strings,…) between process via tasks.
2145 task = simgrid.Task.new("data_task",task_comp,task_comm);
2146 task['matrix'] = my_matrix;
2147 task['table'] = my_table;
2148 task['message'] = "Hello from (Lua || Simgrid ) !! "
2150 simgrid.Task.send(task,alias)
2152 After creating task, we associate to it various kind of data with a specific key (string in this case)
2153 to distinguish between data variables. The receiver will use this key to access easily to datas.
2156 \li Receiver processe
2158 task = simgrid.Task.recv(alias);
2159 sender_matrix = task['matrix'];
2160 sender_table = task['table'];
2161 sender_message = task['message']
2164 Note that in lua, both sender and receiver share the same lua task.
2165 So that the receiver could joint data directly on the received task without sending it back.
2166 You can find a complet example (matrix multiplication case) in the file example/lua/mult_matrix.lua.
2169 \subsubsection faq_binding_lua_example_bypass Bypass XML
2170 maybe you wonder if there is a way to bypass the XML files,
2171 and describe your platform directly from the code, with lua bindings it's Possible !! how ?
2172 We provide some additional (tricky?) functions in lua that allows you to set up your own platform without using the XML files
2173 ( this can be useful for large platforms, so a simple for loop will avoid you to deal with an annoying XML File ;) )
2176 \li set Routing mode
2178 simgrid.AS.new{id="AS0",mode="Full"};
2183 simgrid.Host.new{id="Tremblay",power=98095000};
2184 simgrid.Host.new{id="Jupiter",power=76296000};
2185 simgrid.Host.new{id="Fafard",power=76296000};
2186 simgrid.Host.new{id="Ginette",power=48492000};
2187 simgrid.Host.new{id="Bourassa",power=48492000};
2189 we use simgrid.Host.new{id=id_host,power=power_host} to instanciate our hosts.
2194 simgrid.Link.new{id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087}; -- some crazy values ;)
2197 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 ?)
2201 -- simgrid.Route.new(src_id,des_id,links_nb,links_list)
2202 simgrid.Route.new("Tremblay","Jupiter",1,{"1"});
2203 simgrid.Route.new("Tremblay","Fafard",6,{"0","1","2","3","4","8"});
2204 simgrid.Route.new("Tremblay","Ginette",3,{"3","4","5"});
2205 simgrid.Route.new("Tremblay","Bourassa",7,{"0","1","3","2","4","6","7"});
2207 simgrid.Route.new("Jupiter","Tremblay",1,{"1"});
2208 simgrid.Route.new("Jupiter","Fafard",7,{"0","1","2","3","4","8","9"});
2209 simgrid.Route.new("Jupiter","Ginette",4,{"3","4","5","9"});
2210 simgrid.Route.new("Jupiter","Bourassa",8,{"0","1","2","3","4","6","7","9"});
2213 for each host you have to specify which route to choose to access to the rest of hosts connected in the grid.
2217 simgrid.register_platform();
2219 Don't forget to register your platform, that SURF callbacks starts their work ;)
2223 simgrid.Host.setFunction("Tremblay","Master",4,{"20","550000000","1000000","4"});
2224 simgrid.Host.setFunction("Bourassa","Slave",1,{"0"});
2225 simgrid.Host.setFunction("Jupiter","Slave",1,{"1"});
2226 simgrid.Host.setFunction("Fafard","Slave",1,{"2"});
2227 simgrid.Host.setFunction("Ginette","Slave",1,{"3"});
2229 you don't need to use a deployment XML file, thanks to simgrid.Host.setFunction(host_id,function,args_number,args_list)
2230 you can associate functions for each host with arguments if needed .
2234 simgrid.register_application();
2236 Yes, Here too you have to resgiter your application before running the simulation.
2238 the full example is distributed in the file examples/lua/master_slave_bypass.lua
2240 \subsection faq_binding_ruby Ruby Binding
2243 \subsubsection faq_binding_ruby_simgrid Use Ruby in Simgrid
2244 Since v3.4, the use of <a href="http://ruby-lang.org">ruby</a> in simgrid is available for the MSG Module.
2245 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.
2247 \dontinclude ruby/MasterSlave.rb
2248 \subsubsection faq_binding_ruby_example Master/Slave Ruby Application
2249 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,
2250 with a 'main' function that describe the behaviour of the process during the simulation.
2258 \until end_of_master
2260 the class MSG::Task contains methods that allows the management of the native MSG tasks.
2261 in master ruby code we used :
2262 - <i>MSG::Task.new(task_name,compute_size,communication_size)</i> : to instanciate a new task.
2263 - <i>MSG::Task.send(mailbox)</i> : to send the task via a mailbox alias.
2264 - <i>MSG::Task.name</i> : to get the task's name.
2268 to receive a task, we use the method <i>MSG::Task.receive(mailbox)</i> that return a MSG:Task object (received task).
2273 - <i>MSG.createEnvironment(platform_file)</i> : set up the environment
2274 - <i>MSG.deployApplication(deployment_file)</i> : load the deployment file description.
2275 - <i>MSG.run</i> : run the simulation
2277 \subsubsection faq_binding_ruby_data Exchanging data
2278 ruby bindings provides two ways to exchange data between ruby processes.
2279 \li MSG::Task.join & MSG::Task.data \br
2281 the MSG::Task class contains 2 methods that allows a data exchange between 2 process.
2283 -<i>MSG::Task.join</i> : makes possible to join any kind of ruby data within a task.
2287 myTable <<1<<-2<<45<<67<<87<<76<<89<<56<<78<<3<<-4<<99
2288 # Creates and send Task With the Table inside
2289 task = MSG::Task.new("quicksort_task",taskComputeSize, taskCommunicationSize);
2294 -<i>MSG::Task.data</i> : to access to the data contained into the task.
2297 task = MSG::Task.receive(recv_mailbox.to_s)
2299 quicksort(table,0,table.size-1)
2302 you can find a complet example illustrating the use of those methods in file /example/ruby/Quicksort.rb
2306 another 'object-oriented' way to do it, is to make your own 'task' class that inherit from MSG::Task ,
2307 and contains data you want to deal with, the only 'tricky' thing is that "the initializer" method has no effect !
2309 the use of some getter/setter methods would be the simple way to manage your data :)
2311 class PingPongTask < MSG::Task
2312 # The initialize method has no effect
2322 you can find an example of use in file example/ruby/PingPong.rb
2324 \section faq_troubleshooting Troubleshooting
2326 \subsection faq_trouble_lib_compil SimGrid compilation and installation problems
2328 \subsubsection faq_trouble_lib_config ./configure fails!
2330 We know only one reason for the configure to fail:
2332 - <b>You are using a broken build environment</b>\n
2333 If symptom is that configure complains about gcc not being able to build
2334 executables, you are probably missing the libc6-dev package. Damn Ubuntu.
2336 If you experience other kind of issue, please get in touch with us. We are
2337 always interested in improving our portability to new systems.
2339 \subsubsection faq_trouble_distcheck Dude! "make check" fails on my machine!
2341 Don't assume we never run this target, because we do. Check
2342 http://bob.loria.fr:8010 if you don't believe us.
2344 There is several reasons which may cause the make check to fail on your
2347 - <b>You are using a broken libc (probably concerning the contextes)</b>.\n
2348 The symptom is that the "make check" fails within the examples/msg directory.\n
2349 By default, SimGrid uses something called ucontexts. This is part of the
2350 libc, but it's quite undertested. For example, some (old) versions of the
2351 glibc on alpha do not implement these functions, but provide the stubs
2352 (which return ENOSYS: not implemented). It may fool our detection mechanism
2353 and leads to segfaults. There is not much we can do to fix the bug.
2354 A workaround is to compile with --with-context=pthread to avoid
2355 ucontext completely. You'll be a bit more limited in the number
2356 of simulated processes you can start concurrently, but 5000
2357 processes is still enough for most purposes, isn't it?\n
2358 This limitation is the reason why we insist on using this piece of ...
2359 software even if it's so troublesome.\n
2360 <b>=> use --with-pthread on AMD64 architecture that do not have an
2361 ultra-recent libc.</b>
2363 - <b>There is a bug in SimGrid we aren't aware of</b>.\n
2364 If none of the above apply, please drop us a mail on the mailing list so
2365 that we can check it out. Make sure to read \ref faq_bugrepport
2368 \subsection faq_trouble_compil User code compilation problems
2370 \subsubsection faq_trouble_err_logcat "gcc: _simgrid_this_log_category_does_not_exist__??? undeclared (first use in this function)"
2372 This is because you are using the log mecanism, but you didn't created
2373 any default category in this file. You should refer to \ref XBT_log
2374 for all the details, but you simply forgot to call one of
2375 XBT_LOG_NEW_DEFAULT_CATEGORY() or XBT_LOG_NEW_DEFAULT_SUBCATEGORY().
2377 \subsubsection faq_trouble_pthreadstatic "gcc: undefined reference to pthread_key_create"
2379 This indicates that one of the library SimGrid depends on (libpthread
2380 here) was missing on the linking command line. Dependencies of
2381 libsimgrid are expressed directly in the dynamic library, so it's
2382 quite impossible that you see this message when doing dynamic linking.
2384 If you compile your code statically (and if you use a pthread version
2385 of SimGrid -- see \ref faq_more_processes), you must absolutely
2386 specify <tt>-lpthread</tt> on the linker command line. As usual, this should
2387 come after <tt>-lsimgrid</tt> on this command line.
2389 \subsection faq_trouble_errors Runtime error messages
2391 \subsubsection faq_flexml_limit "surf_parse_lex: Assertion `next limit' failed."
2393 This is because your platform file is too big for the parser.
2395 Actually, the message comes directly from FleXML, the technology on top of
2396 which the parser is built. FleXML has the bad idea of fetching the whole
2397 document in memory before parsing it. And moreover, the memory buffer size
2398 must be determined at compilation time.
2400 We use a value which seems big enough for our need without bloating the
2401 simulators footprints. But of course your mileage may vary. In this case,
2402 just edit src/surf/surfxml.l modify the definition of
2403 FLEXML_BUFFERSTACKSIZE. E.g.
2406 #define FLEXML_BUFFERSTACKSIZE 1000000000
2409 Then recompile and everything should be fine, provided that your version of
2410 Flex is recent enough (>= 2.5.31). If not the compilation process should
2413 A while ago, we worked on FleXML to reduce a bit its memory consumption, but
2414 these issues remain. There is two things we should do:
2416 - use a dynamic buffer instead of a static one so that the only limit
2417 becomes your memory, not a stupid constant fixed at compilation time
2418 (maybe not so difficult).
2419 - change the parser so that it does not need to get the whole file in
2420 memory before parsing
2421 (seems quite difficult, but I'm a complete newbe wrt flex stuff).
2423 These are changes to FleXML itself, not SimGrid. But since we kinda hijacked
2424 the development of FleXML, I can grant you that any patches would be really
2425 welcome and quickly integrated.
2427 <b>Update:</b> A new version of FleXML (1.7) was released. Most of the work
2428 was done by William Dowling, who use it in his own work. The good point is
2429 that it now use a dynamic buffer, and that the memory usage was greatly
2430 improved. The downside is that William also changed some things internally,
2431 and it breaks the hack we devised to bypass the parser, as explained in
2432 \ref faq_flexml_bypassing. Indeed, this is not a classical usage of the
2433 parser, and Will didn't imagine that we may have used (and even documented)
2434 such a crude usage of FleXML. So, we now have to repair the bypassing
2435 functionality to use the lastest FleXML version and fix the memory usage in
2438 \subsubsection faq_trouble_gras_transport GRAS spits networking error messages
2440 Gras, on real platforms, naturally use regular sockets to communicate. They
2441 are deeply hidden in the gras abstraction, but when things go wrong, you may
2442 get some weird error messages. Here are some example, with the probable
2445 - <b>Transport endpoint is not connected</b>: several processes try to open
2446 a server socket on the same port number of the same machine. This is
2447 naturally bad and each process should pick its own port number for this.\n
2448 Maybe, you just have some processes remaining from a previous experiment
2450 Killing them may help, but again if you kill -KILL them, you'll have to
2451 wait for a while: they didn't close there sockets properly and the system
2452 needs a while to notice that this port is free again.
2454 - <b>Socket closed by remote side</b>: if the remote process is not
2455 supposed to close the socket at this point, it may be dead.
2457 - <b>Connection reset by peer</b>: I found this on Internet about this
2458 error. I think it's what's happening here, too:\n
2459 <i>This basically means that a network error occurred while the client was
2460 receiving data from the server. But what is really happening is that the
2461 server actually accepts the connection, processes the request, and sends
2462 a reply to the client. However, when the server closes the socket, the
2463 client believes that the connection has been terminated abnormally
2464 because the socket implementation sends a TCP reset segment telling the
2465 client to throw away the data and report an error.\n
2466 Sometimes, this problem is caused by not properly closing the
2467 input/output streams and the socket connection. Make sure you close the
2468 input/output streams and socket connection properly. If everything is
2469 closed properly, however, and the problem persists, you can work around
2470 it by adding a one-second sleep before closing the streams and the
2471 socket. This technique, however, is not reliable and may not work on all
2473 Since GRAS sockets are closed properly (repeat after me: there is no bug
2474 in GRAS), it is either that you are closing your sockets on server side
2475 before the client get a chance to read them (use gras_os_sleep() to delay
2476 the server), or the server died awfully before the client got the data.
2478 \subsubsection faq_trouble_errors_big_fat_warning I'm told that my XML files are too old.
2480 The format of the XML platform description files is sometimes
2481 improved. For example, we decided to change the units used in SimGrid
2482 from MBytes, MFlops and seconds to Bytes, Flops and seconds to ease
2483 people exchanging small messages. We also reworked the route
2484 descriptions to allow more compact descriptions.
2486 That is why the XML files are versionned using the 'version' attribute
2487 of the root tag. Currently, it should read:
2489 <platform version="2">
2492 If your files are too old, you can use the simgrid_update_xml.pl
2493 script which can be found in the tools directory of the archive.
2495 \subsection faq_trouble_valgrind Valgrind-related and other debugger issues
2497 If you don't, you really should use valgrind to debug your code, it's
2500 \subsubsection faq_trouble_vg_longjmp longjmp madness in valgrind
2502 This is when valgrind starts complaining about longjmp things, just like:
2504 \verbatim ==21434== Conditional jump or move depends on uninitialised value(s)
2505 ==21434== at 0x420DBE5: longjmp (longjmp.c:33)
2507 ==21434== Use of uninitialised value of size 4
2508 ==21434== at 0x420DC3A: __longjmp (__longjmp.S:48)
2511 This is the sign that you didn't used the exception mecanism well. Most
2512 probably, you have a <tt>return;</tt> somewhere within a <tt>TRY{}</tt>
2513 block. This is <b>evil</b>, and you must not do this. Did you read the section
2516 \subsubsection faq_trouble_vg_libc Valgrind spits tons of errors about backtraces!
2518 It may happen that valgrind, the memory debugger beloved by any decent C
2519 programmer, spits tons of warnings like the following :
2520 \verbatim ==8414== Conditional jump or move depends on uninitialised value(s)
2521 ==8414== at 0x400882D: (within /lib/ld-2.3.6.so)
2522 ==8414== by 0x414EDE9: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2523 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
2524 ==8414== by 0x414F937: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
2525 ==8414== by 0x4150F4C: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2526 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
2527 ==8414== by 0x415102D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
2528 ==8414== by 0x412D6B9: backtrace (in /lib/tls/i686/cmov/libc-2.3.6.so)
2529 ==8414== by 0x8076446: xbt_dictelm_get_ext (dict_elm.c:714)
2530 ==8414== by 0x80764C1: xbt_dictelm_get (dict_elm.c:732)
2531 ==8414== by 0x8079010: xbt_cfg_register (config.c:208)
2532 ==8414== by 0x806821B: MSG_config (msg_config.c:42)
2535 This problem is somewhere in the libc when using the backtraces and there is
2536 very few things we can do ourselves to fix it. Instead, here is how to tell
2537 valgrind to ignore the error. Add the following to your ~/.valgrind.supp (or
2538 create this file on need). Make sure to change the obj line according to
2539 your personnal mileage (change 2.3.6 to the actual version you are using,
2540 which you can retrieve with a simple "ls /lib/ld*.so").
2543 name: Backtrace madness
2545 obj:/lib/ld-2.3.6.so
2550 fun:__libc_dlopen_mode
2553 Then, you have to specify valgrind to use this suppression file by passing
2554 the <tt>--suppressions=$HOME/.valgrind.supp</tt> option on the command line.
2555 You can also add the following to your ~/.bashrc so that it gets passed
2556 automatically. Actually, it passes a bit more options to valgrind, and this
2557 happen to be my personnal settings. Check the valgrind documentation for
2560 \verbatim export VALGRIND_OPTS="--leak-check=yes --leak-resolution=high --num-callers=40 --tool=memcheck --suppressions=$HOME/.valgrind.supp" \endverbatim
2562 \subsubsection faq_trouble_backtraces Truncated backtraces
2564 When debugging SimGrid, it's easier to pass the
2565 --disable-compiler-optimization flag to the configure if valgrind or
2566 gdb get fooled by the optimization done by the compiler. But you
2567 should remove these flag when everything works before going in
2568 production (before launching your 1252135 experiments), or everything
2569 will run only one half of the true SimGrid potential.
2571 \subsection faq_deadlock There is a deadlock in my code!!!
2573 Unfortunately, we cannot debug every code written in SimGrid. We
2574 furthermore believe that the framework provides ways enough
2575 information to debug such informations yourself. If the textual output
2576 is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
2577 how to get a graphical one.
2579 Now, if you come up with a really simple example that deadlocks and
2580 you're absolutely convinced that it should not, you can ask on the
2581 list. Just be aware that you'll be severely punished if the mistake is
2582 on your side... We have plenty of FAQ entries to redact and new
2583 features to implement for the impenitents! ;)
2585 \subsection faq_surf_network_latency I get weird timings when I play with the latencies.
2587 OK, first of all, remember that units should be Bytes, Flops and
2588 Seconds. If you don't use such units, some SimGrid constants (e.g. the
2589 SG_TCP_CTE_GAMMA constant used in most network models) won't have the
2590 right unit and you'll end up with weird results.
2592 Here is what happens with a single transfer of size L on a link
2593 (bw,lat) when nothing else happens.
2596 0-----lat--------------------------------------------------t
2597 |-----|**** real_bw =min(bw,SG_TCP_CTE_GAMMA/(2*lat)) *****|
2600 In more complex situations, this min is the solution of a complex
2601 max-min linear system. Have a look
2602 <a href="http://lists.gforge.inria.fr/pipermail/simgrid-devel/2006-April/thread.html">here</a>
2603 and read the two threads "Bug in SURF?" and "Surf bug not
2604 fixed?". You'll have a few other examples of such computations. You
2605 can also read "A Network Model for Simulation of Grid Application" by
2606 Henri Casanova and Loris Marchal to have all the details. The fact
2607 that the real_bw is smaller than bw is easy to understand. The fact
2608 that real_bw is smaller than SG_TCP_CTE_GAMMA/(2*lat) is due to the
2609 window-based congestion mechanism of TCP. With TCP, you can't exploit
2610 your huge network capacity if you don't have a good round-trip-time
2611 because of the acks...
2613 Anyway, what you get is t=lat + L/min(bw,SG_TCP_CTE_GAMMA/(2*lat)).
2615 * if I you set (bw,lat)=(100 000 000, 0.00001), you get t = 1.00001 (you fully
2617 * if I you set (bw,lat)=(100 000 000, 0.0001), you get t = 1.0001 (you're on the
2619 * if I you set (bw,lat)=(100 000 000, 0.001), you get t = 10.001 (ouch!)
2621 This bound on the effective bandwidth of a flow is not the only thing
2622 that may make your result be unexpected. For example, two flows
2623 competing on a saturated link receive an amount of bandwidth inversely
2624 proportional to their round trip time.
2626 \subsection faq_bugrepport So I've found a bug in SimGrid. How to report it?
2628 We do our best to make sure to hammer away any bugs of SimGrid, but this is
2629 still an academic project so please be patient if/when you find bugs in it.
2630 If you do, the best solution is to drop an email either on the simgrid-user
2631 or the simgrid-devel mailing list and explain us about the issue. You can
2632 also decide to open a formal bug report using the
2633 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">relevant
2634 interface</a>. You need to login on the server to get the ability to submit
2637 We will do our best to solve any problem repported, but you need to help us
2638 finding the issue. Just telling "it segfault" isn't enough. Telling "It
2639 segfaults when running the attached simulator" doesn't really help either.
2640 You may find the following article interesting to see how to repport
2641 informative bug repports:
2642 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (it is not SimGrid
2643 specific at all, but it's full of good advices).
2645 \author Arnaud Legrand (arnaud.legrand::imag.fr)
2646 \author Martin Quinson (martin.quinson::loria.fr)
2651 ******************************************************************
2652 * OLD CRUFT NOT USED ANYMORE *
2653 ******************************************************************
2656 \subsection faq_crosscompile Cross-compiling a Windows DLL of SimGrid from linux
2658 At the moment, we do not distribute Windows pre-compiled version of SimGrid
2659 because the support for this platform is still experimental. We know that
2660 some parts of the GRAS environment do not work, and we think that the others
2661 environments (MSG and SD) have good chances to work, but we didn't test
2662 ourselves. This section explains how we generate the SimGrid DLL so that you
2663 can build it for yourself. First of all, you need to have a version more
2664 recent than 3.1 (ie, a SVN version as time of writting).
2666 In order to cross-compile the package to windows from linux, you need to
2667 install mingw32 (minimalist gnu win32). On Debian, you can do so by
2668 installing the packages mingw32 (compiler), mingw32-binutils (linker and
2669 so), mingw32-runtime.
2671 You can use the VPATH support of configure to compile at the same time for
2672 linux and windows without dupplicating the source nor cleaning the tree
2673 between each. Just run bootstrap (if you use the SVN) to run the autotools.
2674 Then, create a linux and a win directories. Then, type:
2675 \verbatim cd linux; ../configure --srcdir=.. <usual configure flags>; make; cd ..
2676 cd win; ../configure --srcdir=.. --host=i586-mingw32msvc <flags>; make; cd ..
2678 The trick to VPATH builds is to call configure from another directory,
2679 passing it an extra --srcdir argument to tell it where all the sources are.
2680 It will understand you want to use VPATH. Then, the trick to cross-compile
2681 is simply to add a --host argument specifying the target you want to build
2682 for. The i586-mingw32msvc string is what you have to pass to use the mingw32
2683 environment as distributed in Debian.
2685 After that, you can run all make targets from both directories, and test
2686 easily that what you change for one arch does not break the other one.
2688 It is possible that this VPATH build thing breaks from time to time in the
2689 SVN since it's quite fragile, but it's granted to work in any released
2690 version. If you experience problems, drop us a mail.
2692 Another possible source of issue is that at the moment, building the
2693 examples request to use the gras_stub_generator tool, which is a compiled
2694 program, not a script. In cross-compilation, you need to cross-execute with
2695 wine for example, which is not really pleasant. We are working on this, but
2696 in the meanwhile, simply don't build the examples in cross-compilation
2697 (<tt>cd src</tt> before running make).
2699 Program (cross-)compiled with mingw32 do request an extra DLL at run-time to be
2700 usable. For example, if you want to test your build with wine, you should do
2701 the following to put this library where wine looks for DLLs.
2703 cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz ~/.wine/c/windows/system/
2704 gunzip ~/.wine/c/windows/system/mingwm10.dll.gz
2707 The DLL is built in src/.libs, and installed in the <i>prefix</i>/bin directory
2708 when you run make install.
2710 If you want to use it in a native project on windows, you need to use
2711 simgrid.dll and mingwm10.dll. For each DLL, you need to build .def file
2712 under linux (listing the defined symbols), and convert it into a .lib file
2713 under windows (specifying this in a way that windows compilers like). To
2714 generate the def files, run (under linux):
2715 \verbatim echo "LIBRARY libsimgrid-0.dll" > simgrid.def
2716 echo EXPORTS >> simgrid.def
2717 nm libsimgrid-0.dll | grep ' T _' | sed 's/.* T _//' >> simgrid.def
2718 nm libsimgrid-0.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> simgrid.def
2720 echo "LIBRARY mingwm10.dll" > mingwm10.def
2721 echo EXPORTS >> mingwm10.def
2722 nm mingwm10.dll | grep ' T _' | sed 's/.* T _//' >> mingwm10.def
2723 nm mingwm10.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> mingwm10.def
2726 To create the import .lib files, use the <tt>lib</tt> windows tool (from
2727 MSVC) the following way to produce simgrid.lib and mingwm10.lib
2728 \verbatim lib /def:simgrid.def
2729 lib /def:mingwm10.def
2732 If you happen to use Borland C Builder, the right command line is the
2733 following (note that you don't need any file.def to get this working).
2734 \verbatim implib simgrid.lib libsimgrid-0.dll
2735 implib mingwm10.lib mingwm10.dll
2738 Then, set the following parameters in Visual C++ 2005:
2739 Linker -> Input -> Additional dependencies = simgrid.lib mingwm10.lib
2741 Just in case you wonder how to generate a DLL from libtool in another
2742 project, we added -no-undefined to any lib*_la_LDFLAGS variables so that
2743 libtool accepts to generate a dynamic library under windows. Then, to make
2744 it true, we pass any dependencies (such as -lws2 under windows or -lpthread
2745 on need) on the linking line. Passing such deps is a good idea anyway so
2746 that they get noted in the library itself, avoiding the users to know about
2747 our dependencies and put them manually on their compilation line. Then we
2748 added the AC_LIBTOOL_WIN32_DLL macro just before AC_PROG_LIBTOOL in the
2749 configure.ac. It means that we exported any symbols which need to be.
2750 Nowadays, functions get automatically exported, so we don't need to load our
2751 header files with tons of __declspec(dllexport) cruft. We only need to do so
2752 for data, but there is no public data in SimGrid so we are good.