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 :
107 \li c, c++ and java compiler regards to developers
108 \li ccmake for graphical used of CMake
109 \li cmake <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
112 \li Visual C++ 2010 Express <a href="http://www.microsoft.com/express/Downloads/#2010-Visual-CPP">(download page)</a>
113 \li cmake <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
114 \li Set CC, CXX, INCLUDE, LIB and RC to environment variables.
116 SET --> CC TO --> C:\MicrosoftVisualStudio10\VC\bin\cl
117 --> CXX --> C:\MicrosoftVisualStudio10\VC\bin\cl
118 --> INCLUDE --> C:\MicrosoftVisualStudio10\VC\include;C:\Program Files\Microsoft SDKs\Windows\v7.OA\Include
119 --> LIB --> C:\MicrosoftVisualStudio10\VC\lib;C:\Program Files\Microsoft SDKs\Windows\v7.OA\Lib
120 --> RC --> C:\Program Files\Microsoft SDKs\Windows\v7.OA\bin\RC
122 \li Add to environment variable "Path" the path where to find nmake executable and some needed files.
125 ;C\MicrosoftVisualStudio10\VC\bin
126 ;C\MicrosoftVisualStudio10\Common7\IDE
127 ;C:\Program Files\Microsoft SDKs\Windows\v7.OA\bin
128 ;C:\Program Files\Microsoft SDKs\Windows\v7.OA\Lib
129 ;C:\Program Files\Microsoft SDKs\Windows\v7.OA\bInclude
131 \subsection faq_cmakeoption Cmake options
133 \subsubsection faq_cmakeoption1 Liste of options
136 "cmake -D[name]=[value] ... ./"
138 [name] enable_gtnets [value] ON/OFF or TRUE/FALSE or 1/0
139 enable_java ON/OFF or TRUE/FALSE or 1/0
140 enable_lua ON/OFF or TRUE/FALSE or 1/0
141 enable_ruby ON/OFF or TRUE/FALSE or 1/0
142 enable_compile_optimizations ON/OFF or TRUE/FALSE or 1/0
143 enable_compile_warnings ON/OFF or TRUE/FALSE or 1/0
144 enable_smpi ON/OFF or TRUE/FALSE or 1/0
145 enable_maintainer_mode ON/OFF or TRUE/FALSE or 1/0
146 enable_supernovae ON/OFF or TRUE/FALSE or 1/0
147 enable_tracing ON/OFF or TRUE/FALSE or 1/0
148 enable_coverage ON/OFF or TRUE/FALSE or 1/0
149 enable_memcheck ON/OFF or TRUE/FALSE or 1/0
150 enable_model-checking ON/OFF or TRUE/FALSE or 1/0
151 enable_doc ON/OFF or TRUE/FALSE or 1/0
153 gtnets_path <path_to_gtnets_directory>
154 prefix <path_to_install_directory>
155 BIBTEX2HTML <path_to_bibtex2html>
156 with_context auto/ucontext/pthread/window
159 \subsubsection faq_cmakeoption2 Options explaination
161 \li enable_gtnets : set to true implie that user wants to use gtnets.
163 \li enable_java : set to true implie that user wants to add java langage into simgrid compilation.
165 \li enable_lua : set to true implie that user wants to add lua langage into simgrid compilation.
167 \li enable_ruby : set to true implie that user wants to add ruby langage into simgrid compilation.
169 \li enable_compile_optimizations : add flags "-O3 -finline-functions -funroll-loops -fno-strict-aliasing"
171 \li enable_compile_warnings : add flags "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror"
173 \li enable_smpi : Set to true if you want to use smpi lib. Actually on simgrid v3.4.1 Mac doesn't support lib smpi.
175 \li enable_maintainer_mode : set to true it remakes some files.
177 \li enable_supernovae : set to true make one file for each lib and compile with those generated files.
179 \li enable_tracing : To enable the generation of simulation traces for visualization
181 \li enable_coverage : When set to true this option enable code coverage by setting -fprofile-arcs -ftest-coverage flags.
183 \li enable_memcheck : When set to true this option enable tests for memcheck.
185 \li enable_model-checking : Enable the model checking when set to true.
187 \li enable_doc : Generate the documentation for simgrid with make command. (You can also make the doc manually with command : make html)
189 \li gtnets_path : Path to gtnets install directory (ex /usr)
191 \li prefix : Path where are installed lib/ doc/ and include/ directories (ex /usr/local)
193 \li BIBTEX2HTML : Path where is installed bibtex2html.
195 \li with context : specify which context the user wants to use.
197 \subsubsection faq_cmakeoption3 Initialisation
199 Those options are initialized the first time you launch "cmake ." whithout specified option.
206 enable_compile_optimizations off
207 enable_compile_warnings off
209 enable_maintainer_mode off
210 enable_supernovae off
214 enable_model-checking off
223 \subsubsection faq_cmakeoption4 Option's cache and how to reset?
225 When options have been set they are keep into a cache file named "CMakeCache.txt". So if you want
226 reset values you just delete this file located to the project directory.
228 \subsection faq_cmakecompilation Cmake compilation
230 \subsubsection faq_cmakecompilation1 With command line.
233 cmake -D[name]=[value] ... ./
237 \subsubsection faq_cmakecompilation2 With ccmake tool.
242 Then follow instructions.
244 \subsubsection faq_cmakecompilation2bis Build out of source.
246 As cmake generate many files used for compilation, we recommand to make a build directory.
247 For examples you can make :
250 "navarrop@caraja:~/Developments$ cd simgrid/"
251 "navarrop@caraja:~/Developments/simgrid$ mkdir build_directory"
252 "navarrop@caraja:~/Developments/simgrid$ cd build_directory/"
253 "navarrop@caraja:~/Developments/simgrid/build_directory$ cmake ../"
254 "navarrop@caraja:~/Developments/simgrid/build_directory$ make"
257 Or complety out of sources :
260 "navarrop@caraja:~/Developments$ mkdir build_dir"
261 "navarrop@caraja:~/Developments$ cd build_dir/"
262 "navarrop@caraja:~/Developments/build_dir$ cmake ../simgrid/"
263 "navarrop@caraja:~/Developments/build_dir$ make"
266 Those two kind of compilation permit to delete files created by compilation easier.
268 \subsubsection faq_cmakecompilation3 Resume of command line
272 cmake <path> configure the project
273 make build all targets
274 make VERBOSE=1 build all targets and print build command lines
275 make check test all targets and summarize
276 make dist make the distrib
277 make distcheck check the dist (make + make dist + make check)
278 make install install the project (doc/ lib/ include/)
279 make uninstall uninstall the project (doc/ lib/ include/)
280 make clean clean all targets
281 make java-clean clean files created by java option
282 make doc-clean clean files created for making doc
283 make supernovae-clean clean supernovae files
284 make maintainer-clean clean maintainer files
285 make all-clean execute the 5 upper clean command
286 make html Create simgrid documentation
289 When the project have been succesfully compiling and build you can make tests.
293 ctest launch only tests
295 ctest -D Continuous(Start|Update|Configure|Build)
296 ctest -D Continuous(Test|Coverage|MemCheck|Submit)
297 ctest -D Experimental
298 ctest -D Experimental(Start|Update|Configure|Build)
299 ctest -D Experimental(Test|Coverage|MemCheck|Submit)
301 ctest -D Nightly(Start|Update|Configure|Build)
302 ctest -D Nightly(Test|Coverage|MemCheck|Submit)
303 ctest -D NightlyMemoryCheck
306 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>.
308 \subsubsection faq_cmakecompilation4 Examples for different mode.
312 cmake -Denable_maintainer_mode=on ./
314 -- lookign for config.h
315 with_context auto change to ucontext
316 GIT_DATE : 2010-05-04~09-59-15
317 GIT_VERSION : 53ec816
318 GIT_SVN_VERSION : 7669
320 Configuration of package `simgrid' (revision 7669) on arch (=4):
322 SITE : Linux_2.6.31-21-generic_x86_64
323 Release : simgrid-3.4~rev7669
325 Compiler: c++ : /usr/bin/c++
326 version: c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
327 Compiler: c : /usr/bin/gcc
328 version: gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
330 CFlags : -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/include/lua5.1 -g3
332 LDFlags : -L/usr/lib/
334 Context backend: ucontext
346 Simgrid dependencies: -lm -lruby1.8 -module -ldl -llua5.1 -lrt
347 Gras dependencies : -lm -lpthread -lrt
350 INSTALL_PREFIX: /usr/local
354 -- Build files have been written to: /home/navarrop/Developments/simgrid
359 cmake -Dsupernovae=on ./
361 -- lookign for config.h
362 with_context auto change to ucontext
363 GIT_DATE : 2010-05-04~09-59-15
364 GIT_VERSION : 53ec816
365 GIT_SVN_VERSION : 7669
367 Configuration of package `simgrid' (revision 7669) on arch (=4):
368 BUILDNAME : SUPERNOVAE
369 SITE : Linux_2.6.31-21-generic_x86_64
370 Release : simgrid-3.4~rev7669
372 Compiler: c++ : /usr/bin/c++
373 version: c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
374 Compiler: c : /usr/bin/gcc
375 version: gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
377 CFlags : -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/include/lua5.1 -g3
379 LDFlags : -L/usr/lib/
381 Context backend: ucontext
393 Simgrid dependencies: -lm -lruby1.8 -module -ldl -llua5.1 -lrt
394 Gras dependencies : -lm -lpthread -lrt
397 INSTALL_PREFIX: /usr/local
401 -- Build files have been written to: /home/navarrop/Developments/simgrid
407 cmake -Dgtnets_path=/home/navarrop/Bureau/usr/ ./
409 -- lookign for config.h
410 with_context auto change to ucontext
411 GIT_DATE : 2010-05-04~09-59-15
412 GIT_VERSION : 53ec816
413 GIT_SVN_VERSION : 7669
415 Configuration of package `simgrid' (revision 7669) on arch (=4):
417 SITE : Linux_2.6.31-21-generic_x86_64
418 Release : simgrid-3.4~rev7669
420 Compiler: c++ : /usr/bin/c++
421 version: c++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
422 Compiler: c : /usr/bin/gcc
423 version: gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
425 CFlags : -O3 -finline-functions -funroll-loops -fno-strict-aliasing -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -I/usr/lib/ruby/1.8/x86_64-linux -L/usr/lib -I/usr/include/gtnets -I/usr/include/lua5.1 -g3
426 CPPFlags: -L/usr/lib -I/usr/include/gtnets
427 LDFlags : -L/usr/lib/
429 Context backend: ucontext
441 Simgrid dependencies: -lm -lruby1.8 -module -ldl -llua5.1 -lgtnets -lrt
442 Gras dependencies : -lm -lpthread -lrt
445 INSTALL_PREFIX: /usr/local
449 -- Build files have been written to: /home/navarrop/Developments/simgrid
453 \subsection faq_cmakeinstall How to install with cmake?
455 \subsubsection faq_cmakeinstall1 From svn.
458 cmake -Denable_maintainer_mode=on -Dprefix=/home/navarrop/Bureau/install_simgrid ./
463 \subsubsection faq_cmakeinstall2 From a distrib
466 cmake -Dprefix=/home/navarrop/Bureau/install_simgrid ./
471 \subsection faq_cmakehowto How to modified sources files for developers
473 \subsubsection faq_cmakehowto1 Add an executable or examples.
475 If you want make an executable you have to create a CMakeList.txt to the src directory.
476 You must specified where to create the executable, source list, dependencies and the name of the binary.
479 cmake_minimum_required(VERSION 2.6)
481 set(EXECUTABLE_OUTPUT_PATH "./")
482 set(LIBRARY_OUTPUT_PATH "${PROJECT_DIRECTORY}/lib")
484 add_executable(get_sender get_sender.c) #add_executable(<name_of_target> <src list>)
486 ### Add definitions for compile
487 target_link_libraries(get_sender simgrid m pthread -fprofile-arcs) #target_link_libraries(<name_of_targe> <dependencies>)
490 Then you have to modified <project/directory>/buildtools/Cmake/MakeExeLib.cmake and add
493 add_subdirectory(${PROJECT_DIRECTORY}/<path_where_is_CMakeList.txt>)
496 \subsubsection faq_cmakehowto2 Delete/add sources to lib.
498 If you want modified, add or delete source files from a library you have to edit <project/directory>/buildtools/Cmake/DefinePackages.cmake
502 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/MsgException.java
503 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/JniException.java
504 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/NativeException.java
505 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/HostNotFoundException.java
506 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/ProcessNotFoundException.java
507 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/Msg.java
508 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/Process.java
509 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/Host.java
510 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/Task.java
511 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/MsgNative.java
512 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/ApplicationHandler.java
513 ${PROJECT_DIRECTORY}/src/java/simgrid/msg/Sem.java
517 \subsubsection faq_cmakehowto3 Add test
519 If you want modified, add or delete tests you have to edit <project/directory>/buildtools/Cmake/AddTests.cmake
520 with this function : ADD_TEST(<name> <bin> <ARGS>)
523 add_test(test-simdag-1 ${PROJECT_DIRECTORY}/testsuite/simdag/sd_test --cfg=path:${PROJECT_DIRECTORY}/testsuite/simdag small_platform_variable.xml)
526 \subsection faq_cmakeExplain Explaination of sources files for cmake
530 Those files are the "main parts". One located at the project directory call all the cmake sources files. The others
531 are little projects called by the first for make examples.
533 \li CompleteInFiles.cmake
535 Complete all .in files and define Variables for h files
537 \li GenerateDoc.cmake
539 This file make the html documentation.
543 Here are callled all "CMakeLists.txt" for make executables and libraries.
547 This file is called at the end of the build for summarize environment variables.
549 \li DefinePackages.cmake
551 Here is defined sources packages for compiling libs.
555 Defined flags which are used for compiling sources.
559 Here are made files for the supernovae mode.
563 Here is defined packages for install simgrid and make a distribution.
565 \li MaintainerMode.cmake
567 Part where are generated source files for maintainer mode.
571 Here are defined options and initialized values.
575 All tests are listed.
577 \li CTestConfig.cmake
579 Properties which link tests with dashboard.
581 \subsection faq_cmakeList List of files added for cmake
583 Here is a list of files involved into cmake build (relative to project directory path) :
588 ./buildtools/Cmake/AddTests.cmake
589 ./buildtools/Cmake/CompleteInFiles.cmake
590 ./buildtools/Cmake/CTestConfig.cmake
591 ./buildtools/Cmake/DefinePackages.cmake
592 ./buildtools/Cmake/Distrib.cmake
593 ./buildtools/Cmake/Flags.cmake
594 ./buildtools/Cmake/GenerateDocs.cmake
595 ./buildtools/Cmake/MaintainerMode.cmake
596 ./buildtools/Cmake/MakeExeLib.cmake
597 ./buildtools/Cmake/MakeExeLibWin.cmake
598 ./buildtools/Cmake/MakeJava.cmake
599 ./buildtools/Cmake/Option.cmake
600 ./buildtools/Cmake/PrintArgs.cmake
601 ./buildtools/Cmake/Supernovae.cmake
603 CMakeLists for each binaries or examples:
606 ./teshsuite/gras/empty_main/CMakeLists.txt
607 ./teshsuite/gras/small_sleep/CMakeLists.txt
608 ./teshsuite/gras/datadesc/CMakeLists.txt
609 ./teshsuite/gras/msg_handle/CMakeLists.txt
610 ./teshsuite/simdag/CMakeLists.txt
611 ./teshsuite/simdag/partask/CMakeLists.txt
612 ./teshsuite/simdag/platforms/CMakeLists.txt
613 ./teshsuite/simdag/network/CMakeLists.txt
614 ./teshsuite/simdag/network/mxn/CMakeLists.txt
615 ./teshsuite/simdag/network/p2p/CMakeLists.txt
616 ./teshsuite/xbt/CMakeLists.txt
617 ./teshsuite/msg/CMakeLists.txt
618 ./tools/gras/CMakeLists.txt
619 ./tools/tesh/CMakeLists.txt
620 ./testsuite/simdag/CMakeLists.txt
621 ./testsuite/xbt/CMakeLists.txt
622 ./testsuite/surf/CMakeLists.txt
623 ./examples/gras/properties/CMakeLists.txt
624 ./examples/gras/ping/CMakeLists.txt
625 ./examples/gras/pmm/CMakeLists.txt
626 ./examples/gras/mmrpc/CMakeLists.txt
627 ./examples/gras/synchro/CMakeLists.txt
628 ./examples/gras/timer/CMakeLists.txt
629 ./examples/gras/mutual_exclusion/simple_token/CMakeLists.txt
630 ./examples/gras/spawn/CMakeLists.txt
631 ./examples/gras/chrono/CMakeLists.txt
632 ./examples/gras/rpc/CMakeLists.txt
633 ./examples/gras/all2all/CMakeLists.txt
634 ./examples/simdag/properties/CMakeLists.txt
635 ./examples/simdag/CMakeLists.txt
636 ./examples/simdag/metaxml/CMakeLists.txt
637 ./examples/simdag/dax/CMakeLists.txt
638 ./examples/smpi/CMakeLists.txt
639 ./examples/amok/bandwidth/CMakeLists.txt
640 ./examples/amok/saturate/CMakeLists.txt
641 ./examples/msg/priority/CMakeLists.txt
642 ./examples/msg/properties/CMakeLists.txt
643 ./examples/msg/migration/CMakeLists.txt
644 ./examples/msg/gtnets/CMakeLists.txt
645 ./examples/msg/parallel_task/CMakeLists.txt
646 ./examples/msg/trace/CMakeLists.txt
647 ./examples/msg/suspend/CMakeLists.txt
648 ./examples/msg/masterslave/CMakeLists.txt
649 ./examples/msg/actions/CMakeLists.txt
650 ./examples/msg/sendrecv/CMakeLists.txt
653 \section faq_installation Installing the SimGrid library with Autotools (valid until V3.3.4)
655 Many people have been asking me questions on how to use SimGrid. Quite
656 often, the questions were not really about SimGrid but on the
657 installation process. This section is intended to help people that are
658 not familiar with compiling C files under UNIX. If you follow these
659 instructions and still have some troubles, drop an e-mail to
660 <simgrid-user@lists.gforge.inria.fr>.
662 \subsection faq_compiling Compiling SimGrid from a stable archive
664 First of all, you need to download the latest version of SimGrid from
665 <a href="http://gforge.inria.fr/frs/?group_id=12">here</a>.
666 Suppose you have uncompressed SimGrid in some temporary location of
667 your home directory (say <tt>/home/joe/tmp/simgrid-3.0.1 </tt>). The
668 simplest way to use SimGrid is to install it in your home
669 directory. Change your directory to
670 <tt>/home/joe/tmp/simgrid-3.0.1</tt> and type
673 ./configure --prefix=$HOME
678 If at some point, something fails, check the section \ref faq_trouble_compil .
679 If it does not help, you can report this problem to the
680 list but, please, avoid sending a laconic mail like "There is a problem. Is it
681 okay?". Send the config.log file which is automatically generated by
682 configure. Try to capture both the standard output and the error output of the
683 <tt>make</tt> command with <tt>script</tt>. There is no way for us to help you
684 without the relevant bits of information.
686 Now, the following directory should have been created :
688 \li <tt>/home/joe/doc/simgrid/html/</tt>
689 \li <tt>/home/joe/lib/</tt>
690 \li <tt>/home/joe/include/</tt>
692 SimGrid is not a binary, it is a library. Both a static and a dynamic
693 version are available. Here is what you can find if you try a <tt>ls
696 \verbatim libsimgrid.a libsimgrid.la libsimgrid.so libsimgrid.so.0 libsimgrid.so.0.0.1
699 Thus, there is two ways to link your program with SimGrid:
700 \li Either you use the static version, e.g
701 \verbatim gcc libsimgrid.a -o MainProgram MainProgram.c
703 In this case, all the SimGrid functions are directly
704 included in <tt>MainProgram</tt> (hence a bigger binary).
705 \li Either you use the dynamic version (the preferred method)
706 \verbatim gcc -lsimgrid -o MainProgram MainProgram.c
708 In this case, the SimGrid functions are not included in
709 <tt>MainProgram</tt> and you need to set your environment
710 variable in such a way that <tt>libsimgrid.so</tt> will be
711 found at runtime. This can be done by adding the following
712 line in your .bashrc (if you use bash and if you have
713 installed the SimGrid libraries in your home directory):
714 \verbatim export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
717 \subsection faq_compiling_java Java bindings don't get compiled
719 The configure script detects automatically whether you have the
720 softwares needed to use the Java bindings or not. At the end of the
721 configure, you can see the configuration picked by the script, which
722 should look similar to
723 \verbatim Configuration of package simgrid' (version 3.3.4-svn) on
726 Compiler: gcc (version: )
728 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
732 Context backend: ucontext
739 In this example, Java backends won't be compiled.
741 On Debian-like systems (which includes ubuntu), you need the following
742 packages: sun-java6-jdk libgcj10-dev. If you cannot find the
743 libgcj10-dev, try another version, like libgcj9-dev (on Ubuntu before
744 9.10) or libgcj11-dev (not released yet, but certainly one day).
745 Please note that you need to activate the contrib and non-free
746 repositories in Debian, and the universe ones in Ubuntu. Java comes at
749 \subsection faq_compiling_snapshoot SimGrid development snapshots
751 We have very high standards on software quality, and we are reluctant releasing
752 a stable release as long as there is still some known bug in the code base. In
753 addition, we added quite an extensive test base, making sure that we correctly
754 test the most important parts of the tool.
756 As an unfortunate conclusion, there may be some time between the stable
757 releases. If you want to benefit from the most recent features we introduced,
758 but don't want to take the risk of an untested version from the SVN, then
759 development snapshots are done for you.
761 These are pre-releases of SimGrid that still fail some tests about features
762 that almost nobody use, or on platforms not being in our core target (which is
763 Linux, Mac, other Unixes and Windows, from the most important to the less
764 one). That means that using this development releases should be safe for most
767 These archives can be found on
768 <a href="http://www.loria.fr/~quinson/simgrid.html">this web page</a>. Once you
769 got the lastest archive, you can compile it just like any archive (see above).
771 \subsection faq_compiling_svn Compiling SimGrid from the SVN
773 The project development takes place in the SVN, where all changes are
774 committed when they happen. Then every once in a while, we make sure that the
775 code quality meets our standard and release an archive from the code in the
776 SVN. We afterward go back to the development in the SVN. So, if you need a
777 recently added feature and can afford some little problem with the stability
778 of the lastest features, you may want to use the SVN version instead of a
781 For that, you first need to get the "simgrid" module from
782 <a href="http://gforge.inria.fr/scm/?group_id=12">here</a>.
784 You won't find any <tt>configure</tt> and a few other things
785 (<tt>Makefile.in</tt>'s, documentation, ...) will be missing as well. The
786 reason for that is that all these files have to be regenerated using the
787 latest versions of <tt>autoconf</tt>, <tt>libtool</tt>, <tt>automake</tt>
788 (>1.9) and <tt>doxygen</tt> (>1.4). To generate the <tt>configure</tt> and
789 the <tt>Makefile.in</tt>'s, you just have to launch the <tt>bootstrap</tt>
790 command that resides in the top of the source tree. Then just follow the
791 instructions of Section \ref faq_compiling.
793 We insist on the fact that you really need the latest versions of
794 autoconf, automake and libtool. Doing this step on exotic architectures/systems
795 (i.e. anything different from a recent linux distribution) may be
796 ... uncertain. If you need to compile the SVN version on a machine where all these
797 dependencies are not met, the easiest is to do <tt>make dist</tt> in the SVN
798 directory of another machine where all dependencies are met. It will create an
799 archive you may deploy on other sites just as a regular stable release.
801 In summary, the following commands will checkout the SVN, regenerate the
802 configure script and friends, configure SimGrid and build it.
804 \verbatim svn checkout svn://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk simgrid
807 ./configure --enable-maintainer-mode --prefix=<where to install SimGrid>
810 Then, if you want to install SimGrid on the current box, just do:
811 \verbatim make install \endverbatim
813 If you want to build an snapshot of the SVN to deploy it on another box (for
814 example because the other machine don't have the autotools), do:
815 \verbatim make dist \endverbatim
817 Moreover, you should never call the autotools manually since you must run
818 them in a specific order with specific arguments. Most of the times, the
819 makefiles will automatically call the tools for you. When it's not possible
820 (such as the first time you checkout the SVN), use the ./bootstrap command
821 to call them explicitly.
824 \subsection faq_setting_MSG Setting up your own MSG code
826 Do not build your simulator by modifying the SimGrid examples. Go
827 outside the SimGrid source tree and create your own working directory
828 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
830 Suppose your simulation has the following structure (remember it is
831 just an example to illustrate a possible way to compile everything;
832 feel free to organize it as you want).
834 \li <tt>sched.h</tt>: a description of the core of the
835 scheduler (i.e. which functions are can be used by the
836 agents). For example we could find the following functions
837 (master, forwarder, slave).
839 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
840 implementing the core of the scheduler. Most of these
841 functions use the MSG functions defined in section \ref
844 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
845 the MSG initialization (MSG_global_init()), the platform
846 creation (e.g. with MSG_create_environment()), the
847 deployment phase (e.g. with MSG_function_register() and
848 MSG_launch_application()) and the call to
851 To compile such a program, we suggest to use the following
852 Makefile. It is a generic Makefile that we have used many times with
853 our students when we teach the C language.
857 masterslave: masterslave.o sched.o
859 INSTALL_PATH = $$HOME
861 PEDANTIC_PARANOID_FREAK = -O0 -Wshadow -Wcast-align \
862 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
863 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
864 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
865 -Wpointer-arith -Wwrite-strings -finline-functions
866 REASONABLY_CAREFUL_DUDE = -Wall
867 NO_PRAYER_FOR_THE_WICKED = -w -O2
868 WARNINGS = $(REASONABLY_CAREFUL_DUDE)
869 CFLAGS = -g $(WARNINGS)
871 INCLUDES = -I$(INSTALL_PATH)/include
872 DEFS = -L$(INSTALL_PATH)/lib/
873 LDADD = -lm -lsimgrid
877 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
880 $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
883 rm -f $(BIN_FILES) *.o *~
889 The first two lines indicates what should be build when typing make
890 (<tt>masterslave</tt>) and of which files it is to be made of
891 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
892 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
893 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
894 the static version, remove the <tt>-lsimgrid</tt> and add a
895 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
896 after the <tt>LIBS = </tt>.
898 More generally, if you have never written a Makefile by yourself, type
899 in a terminal : <tt>info make</tt> and read the introduction. The
900 previous example should be enough for a first try but you may want to
901 perform some more complex compilations...
903 \subsection faq_setting_GRAS Setting up your own GRAS code
905 If you use the GRAS interface instead of the MSG one, then previous section
906 is not the better source of information. Instead, you should check the GRAS
907 tutorial in general, and the \ref GRAS_tut_tour_setup in particular.
909 \section faq_howto Feature related questions
911 \subsection faq_MIA "Could you please add (your favorite feature here) to SimGrid?"
913 Here is the deal. The whole SimGrid project (MSG, SURF, GRAS, ...) is
914 meant to be kept as simple and generic as possible. We cannot add
915 functions for everybody's needs when these functions can easily be
916 built from the ones already in the API. Most of the time, it is
917 possible and when it was not possible we always have upgraded the API
918 accordingly. When somebody asks us a question like "How to do that?
919 Is there a function in the API to simply do this?", we're always glad
920 to answer and help. However if we don't need this code for our own
921 need, there is no chance we're going to write it... it's your job! :)
922 The counterpart to our answers is that once you come up with a neat
923 implementation of this feature (task duplication, RPC, thread
924 synchronization, ...), you should send it to us and we will be glad to
925 add it to the distribution. Thus, other people will take advantage of
926 it (and we don't have to answer this question again and again ;).
928 You'll find in this section a few "Missing In Action" features. Many
929 people have asked about it and we have given hints on how to simply do
930 it with MSG. Feel free to contribute...
932 \subsection faq_MIA_MSG MSG features
934 \subsubsection faq_MIA_examples I want some more complex MSG examples!
936 Many people have come to ask me a more complex example and each time,
937 they have realized afterward that the basics were in the previous three
940 Of course they have often been needing more complex functions like
941 MSG_process_suspend(), MSG_process_resume() and
942 MSG_process_isSuspended() (to perform synchronization), or
943 MSG_task_Iprobe() and MSG_process_sleep() (to avoid blocking
944 receptions), or even MSG_process_create() (to design asynchronous
945 communications or computations). But the examples are sufficient to
948 We know. We should add some more examples, but not really some more
949 complex ones... We should add some examples that illustrate some other
950 functionalists (like how to simply encode asynchronous
951 communications, RPC, process migrations, thread synchronization, ...)
952 and we will do it when we will have a little bit more time. We have
953 tried to document the examples so that they are understandable. Tell
954 us if something is not clear and once again feel free to participate!
957 \subsubsection faq_MIA_taskdup Missing in action: MSG Task duplication/replication
959 There is no task duplication in MSG. When you create a task, you can
960 process it or send it somewhere else. As soon as a process has sent
961 this task, he doesn't have this task anymore. It's gone. The receiver
962 process has got the task. However, you could decide upon receiving to
963 create a "copy" of a task but you have to handle by yourself the
964 semantic associated to this "duplication".
966 As we already told, we prefer keeping the API as simple as
967 possible. This kind of feature is rather easy to implement by users
968 and the semantic you associate really depends on people. Having a
969 *generic* task duplication mechanism is not that trivial (in
970 particular because of the data field). That is why I would recommand
971 that you write it by yourself even if I can give you advice on how to
974 You have the following functions to get informations about a task:
975 MSG_task_get_name(), MSG_task_get_compute_duration(),
976 MSG_task_get_remaining_computation(), MSG_task_get_data_size(),
977 and MSG_task_get_data().
979 You could use a dictionary (#xbt_dict_t) of dynars (#xbt_dynar_t). If
980 you still don't see how to do it, please come back to us...
982 \subsubsection faq_MIA_asynchronous I want to do asynchronous communications in MSG
984 Up until now, there is no asynchronous communications in MSG. However,
985 you can create as many process as you want so you should be able to do
986 whatever you want... I've written a queue module to help implementing
987 some asynchronous communications at low cost (creating thousands of
988 process only to handle communications may be problematic in term of
989 performance at some point). I'll add it in the distribution asap.
991 \subsubsection faq_MIA_thread_synchronization I need to synchronize my MSG processes
993 You obviously cannot use pthread_mutexes of pthread_conds. The best
994 thing would be to propose similar structures. Unfortunately, we
995 haven't found time to do it yet. However you can try to play with
996 MSG_process_suspend() and MSG_process_resume(). You can even do some
997 synchronization with fake communications (using MSG_task_get(),
998 MSG_task_put() and MSG_task_Iprobe()).
1000 \subsubsection faq_MIA_host_load Where is the get_host_load function hidden in MSG?
1002 There is no such thing because its semantic wouldn't be really
1003 clear. Of course, it is something about the amount of host throughput,
1004 but there is as many definition of "host load" as people asking for
1005 this function. First, you have to remember that resource availability
1006 may vary over time, which make any load notion harder to define.
1008 It may be instantaneous value or an average one. Moreover it may be only the
1009 power of the computer, or may take the background load into account, or may
1010 even take the currently running tasks into account. In some SURF models,
1011 communications have an influence on computational power. Should it be taken
1014 First of all, it's near to impossible to predict the load beforehands in the
1015 simulator since it depends on too much parameters (background load
1016 variation, bandwidth sharing algorithmic complexity) some of them even being
1017 not known beforehands (other task starting at the same time). So, getting
1018 this information is really hard (just like in real life). It's not just that
1019 we want MSG to be as painful as real life. But as it is in some way
1020 realistic, we face some of the same problems as we would face in real life.
1022 How would you do it for real? The most common option is to use something
1023 like NWS that performs active probes. The best solution is probably to do
1024 the same within MSG, as in next code snippet. It is very close from what you
1025 would have to do out of the simulator, and thus gives you information that
1026 you could also get in real settings to not hinder the realism of your
1030 double get_host_load() {
1031 m_task_t task = MSG_task_create("test", 0.001, 0, NULL);
1032 double date = MSG_get_clock();
1034 MSG_task_execute(task);
1035 date = MSG_get_clock() - date;
1036 MSG_task_destroy(task);
1037 return (0.001/date);
1041 Of course, it may not match your personal definition of "host load". In this
1042 case, please detail what you mean on the mailing list, and we will extend
1043 this FAQ section to fit your taste if possible.
1045 \subsubsection faq_MIA_communication_time How can I get the *real* communication time?
1047 Communications are synchronous and thus if you simply get the time
1048 before and after a communication, you'll only get the transmission
1049 time and the time spent to really communicate (it will also take into
1050 account the time spent waiting for the other party to be
1051 ready). However, getting the *real* communication time is not really
1052 hard either. The following solution is a good starting point.
1057 m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
1058 calloc(1,sizeof(double)));
1059 *((double*) task->data) = MSG_get_clock();
1060 MSG_task_put(task, slaves[i % slaves_count], PORT_22);
1061 INFO0("Send completed");
1066 m_task_t task = NULL;
1069 time1 = MSG_get_clock();
1070 a = MSG_task_get(&(task), PORT_22);
1071 time2 = MSG_get_clock();
1072 if(time1<*((double *)task->data))
1073 time1 = *((double *) task->data);
1074 INFO1("Communication time : \"%f\" ", time2-time1);
1076 MSG_task_destroy(task);
1081 \subsection faq_MIA_SimDag SimDag related questions
1083 \subsubsection faq_SG_comm Implementing communication delays between tasks.
1085 A classic question of SimDag newcomers is about how to express a
1086 communication delay between tasks. The thing is that in SimDag, both
1087 computation and communication are seen as tasks. So, if you want to
1088 model a data dependency between two DAG tasks t1 and t2, you have to
1089 create 3 SD_tasks: t1, t2 and c and add dependencies in the following
1093 SD_task_dependency_add(NULL, NULL, t1, c);
1094 SD_task_dependency_add(NULL, NULL, c, t2);
1097 This way task t2 cannot start before the termination of communication c
1098 which in turn cannot start before t1 ends.
1100 When creating task c, you have to associate an amount of data (in bytes)
1101 corresponding to what has to be sent by t1 to t2.
1103 Finally to schedule the communication task c, you have to build a list
1104 comprising the workstations on which t1 and t2 are scheduled (w1 and w2
1105 for example) and build a communication matrix that should look like
1108 \subsubsection faq_SG_DAG How to implement a distributed dynamic scheduler of DAGs.
1110 Distributed is somehow "contagious". If you start making distributed
1111 decisions, there is no way to handle DAGs directly anymore (unless I
1112 am missing something). You have to encode your DAGs in term of
1113 communicating process to make the whole scheduling process
1114 distributed. Here is an example of how you could do that. Assume T1
1115 has to be done before T2.
1118 int your_agent(int argc, char *argv[] {
1120 T1 = MSG_task_create(...);
1121 T2 = MSG_task_create(...);
1125 if(cond) MSG_task_execute(T1);
1127 if((MSG_task_get_remaining_computation(T1)=0.0) && (you_re_in_a_good_mood))
1128 MSG_task_execute(T2)
1130 /* do something else */
1136 If you decide that the distributed part is not that much important and that
1137 DAG is really the level of abstraction you want to work with, then you should
1138 give a try to \ref SD_API.
1140 \subsection faq_MIA_generic Generic features
1142 \subsubsection faq_more_processes Increasing the amount of simulated processes
1144 Here are a few tricks you can apply if you want to increase the amount
1145 of processes in your simulations.
1147 - <b>A few thousands of simulated processes</b> (soft tricks)\n
1148 SimGrid can use either pthreads library or the UNIX98 contextes. On
1149 most systems, the number of pthreads is limited and then your
1150 simulation may be limited for a stupid reason. This is especially
1151 true with the current linux pthreads, and I cannot get more than
1152 2000 simulated processes with pthreads on my box. The UNIX98
1153 contexts allow me to raise the limit to 25,000 simulated processes
1155 The <tt>--with-context</tt> option of the <tt>./configure</tt>
1156 script allows you to choose between UNIX98 contextes
1157 (<tt>--with-context=ucontext</tt>) and the pthread version
1158 (<tt>--with-context=pthread</tt>). The default value is ucontext
1159 when the script detect a working UNIX98 context implementation. On
1160 Windows boxes, the provided value is discarded and an adapted
1161 version is picked up.\n\n
1162 We experienced some issues with contextes on some rare systems
1163 (solaris 8 and lower or old alpha linuxes comes to mind). The main
1164 problem is that the configure script detect the contextes as being
1165 functional when it's not true. If you happen to use such a system,
1166 switch manually to the pthread version, and provide us with a good
1167 patch for the configure script so that it is done automatically ;)
1169 - <b>Hundred thousands of simulated processes</b> (hard-core tricks)\n
1170 As explained above, SimGrid can use UNIX98 contextes to represent
1171 and handle the simulated processes. Thanks to this, the main
1172 limitation to the number of simulated processes becomes the
1173 available memory.\n\n
1174 Here are some tricks I had to use in order to run a token ring
1175 between 25,000 processes on my laptop (1Gb memory, 1.5Gb swap).\n
1176 - First of all, make sure your code runs for a few hundreds
1177 processes before trying to push the limit. Make sure it's
1178 valgrind-clean, ie that valgrind does not report neither memory
1179 error nor memory leaks. Indeed, numerous simulated processes
1180 result in *fat* simulation hindering debugging.
1181 - It was really boring to write 25,000 entries in the deployment
1182 file, so I wrote a little script
1183 <tt>examples/gras/mutual_exclusion/simple_token/make_deployment.pl</tt>, which you may
1184 want to adapt to your case. You could also think about hijacking
1185 the SURFXML parser (have look at \ref faq_flexml_bypassing).
1186 - The deployment file became quite big, so I had to do what is in
1187 the FAQ entry \ref faq_flexml_limit
1188 - Each UNIX98 context has its own stack entry. As debugging this is
1189 quite hairly, the default value is a bit overestimated so that
1190 user don't get into trouble about this. You want to tune this
1191 size to increse the number of processes. This is the
1192 <tt>STACK_SIZE</tt> define in
1193 <tt>src/xbt/xbt_context_sysv.c</tt>, which is 128kb by default.
1194 Reduce this as much as you can, but be warned that if this value
1195 is too low, you'll get a segfault. The token ring example, which
1196 is quite simple, runs with 40kb stacks.
1197 - You may tweak the logs to reduce the stack size further. When
1198 logging something, we try to build the string to display in a
1199 char array on the stack. The size of this array is constant (and
1200 equal to XBT_LOG_BUFF_SIZE, defined in include/xbt/log/h). If the
1201 string is too large to fit this buffer, we move to a dynamically
1202 sized buffer. In which case, we have to traverse one time the log
1203 event arguments to compute the size we need for the buffer,
1204 malloc it, and traverse the argument list again to do the actual
1206 The idea here is to move XBT_LOG_BUFF_SIZE to 1, forcing the logs
1207 to use a dynamic array each time. This allows us to lower further
1208 the stack size at the price of some performance loss...\n
1209 This allowed me to run the reduce the stack size to ... 4k. Ie,
1210 on my 1Gb laptop, I can run more than 250,000 processes!
1212 \subsubsection faq_MIA_batch_scheduler Is there a native support for batch schedulers in SimGrid?
1214 No, there is no native support for batch schedulers and none is
1215 planned because this is a very specific need (and doing it in a
1216 generic way is thus very hard). However some people have implemented
1217 their own batch schedulers. Vincent Garonne wrote one during his PhD
1218 and put his code in the contrib directory of our SVN so that other can
1219 keep working on it. You may find inspiring ideas in it.
1221 \subsubsection faq_MIA_checkpointing I need a checkpointing thing
1223 Actually, it depends on whether you want to checkpoint the simulation, or to
1224 simulate checkpoints.
1226 The first one could help if your simulation is a long standing process you
1227 want to keep running even on hardware issues. It could also help to
1228 <i>rewind</i> the simulation by jumping sometimes on an old checkpoint to
1229 cancel recent calculations.\n
1230 Unfortunately, such thing will probably never exist in SG. One would have to
1231 duplicate all data structures because doing a rewind at the simulator level
1232 is very very hard (not talking about the malloc free operations that might
1233 have been done in between). Instead, you may be interested in the Libckpt
1234 library (http://www.cs.utk.edu/~plank/plank/www/libckpt.html). This is the
1235 checkpointing solution used in the condor project, for example. It makes it
1236 easy to create checkpoints (at the OS level, creating something like core
1237 files), and rerunning them on need.
1239 If you want to simulate checkpoints instead, it means that you want the
1240 state of an executing task (in particular, the progress made towards
1241 completion) to be saved somewhere. So if a host (and the task executing on
1242 it) fails (cf. #MSG_HOST_FAILURE), then the task can be restarted
1243 from the last checkpoint.\n
1245 Actually, such a thing does not exists in SimGrid either, but it's just
1246 because we don't think it is fundamental and it may be done in the user code
1247 at relatively low cost. You could for example use a watcher that
1248 periodically get the remaining amount of things to do (using
1249 MSG_task_get_remaining_computation()), or fragment the task in smaller
1252 \subsection faq_platform Platform building and Dynamic resources
1254 \subsubsection faq_platform_example Where can I find SimGrid platform files?
1256 There is several little examples in the archive, in the examples/msg
1257 directory. From time to time, we are asked for other files, but we
1258 don't have much at hand right now.
1260 You should refer to the Platform Description Archive
1261 (http://pda.gforge.inria.fr) project to see the other platform file we
1262 have available, as well as the Simulacrum simulator, meant to generate
1263 SimGrid platforms using all classical generation algorithms.
1265 \subsubsection faq_platform_alnem How can I automatically map an existing platform?
1267 We are working on a project called ALNeM (Application-Level Network
1268 Mapper) which goal is to automatically discover the topology of an
1269 existing network. Its output will be a platform description file
1270 following the SimGrid syntax, so everybody will get the ability to map
1271 their own lab network (and contribute them to the catalog project).
1272 This tool is not ready yet, but it move quite fast forward. Just stay
1275 \subsubsection faq_platform_synthetic Generating synthetic but realistic platforms
1277 The third possibility to get a platform file (after manual or
1278 automatic mapping of real platforms) is to generate synthetic
1279 platforms. Getting a realistic result is not a trivial task, and
1280 moreover, nobody is really able to define what "realistic" means when
1281 speaking of topology files. You can find some more thoughts on this
1283 <a href="http://graal.ens-lyon.fr/~alegrand/articles/Simgrid-Introduction.pdf">slides</a>.
1285 If you are looking for an actual tool, there we have a little tool to
1286 annotate Tiers-generated topologies. This perl-script is in
1287 <tt>tools/platform_generation/</tt> directory of the SVN. Dinda et Al.
1288 released a very comparable tool, and called it GridG.
1290 \subsubsection faq_SURF_dynamic Expressing dynamic resource availability in platform files
1292 A nice feature of SimGrid is that it enables you to seamlessly have
1293 resources whose availability change over time. When you build a
1294 platform, you generally declare hosts like that:
1297 <host id="host A" power="100.00"/>
1300 If you want the availability of "host A" to change over time, the only
1301 thing you have to do is change this definition like that:
1304 <host id="host A" power="100.00" availability_file="trace_A.txt" state_file="trace_A_failure.txt"/>
1307 For hosts, availability files are expressed in fraction of available
1308 power. Let's have a look at what "trace_A.txt" may look like:
1317 At time 0, our host will deliver 100 flop/s. At time 11.0, it will
1318 deliver only 50 flop/s until time 20.0 where it will will start
1319 delivering 90 flop/s. Last at time 21.0 (20.0 plus the periodicity
1320 1.0), we'll be back to the beginning and it will deliver 100 flop/s.
1322 Now let's look at the state file:
1329 A negative value means "off" while a positive one means "on". At time
1330 1.0, the host is on. At time 1.0, it is turned off and at time 2.0, it
1331 is turned on again until time 12 (2.0 plus the periodicity 10.0). It
1332 will be turned on again at time 13.0 until time 23.0, and so on.
1334 Now, let's look how the same kind of thing can be done for network
1335 links. A usual declaration looks like:
1338 <link id="LinkA" bandwidth="10.0" latency="0.2"/>
1341 You have at your disposal the following options: bandwidth_file,
1342 latency_file and state_file. The only difference with hosts is that
1343 bandwidth_file and latency_file do not express fraction of available
1344 power but are expressed directly in bytes per seconds and seconds.
1346 \subsubsection faq_platform_multipath How to express multipath routing in platform files?
1348 It is unfortunately impossible to express the fact that there is more
1349 than one routing path between two given hosts. Let's consider the
1350 following platform file:
1353 <route src="A" dst="B">
1356 <route src="B" dst="C">
1359 <route src="A" dst="C">
1364 Although it is perfectly valid, it does not mean that data traveling
1365 from A to C can either go directly (using link 3) or through B (using
1366 links 1 and 2). It simply means that the routing on the graph is not
1367 trivial, and that data do not following the shortest path in number of
1368 hops on this graph. Another way to say it is that there is no implicit
1369 in these routing descriptions. The system will only use the routes you
1370 declare (such as <route src="A" dst="C"><link:ctn
1371 id="3"/></route>), without trying to build new routes by aggregating
1374 You are also free to declare platform where the routing is not
1375 symmetric. For example, add the following to the previous file:
1378 <route src="C" dst="A">
1384 This makes sure that data from C to A go through B where data from A
1385 to C go directly. Don't worry about realism of such settings since
1386 we've seen ways more weird situation in real settings (in fact, that's
1387 the realism of very regular platforms which is questionable, but
1388 that's another story).
1390 \subsubsection faq_flexml_bypassing Bypassing the XML parser with your own C functions
1392 So you want to bypass the XML files parser, uh? Maybe doing some parameter
1393 sweep experiments on your simulations or so? This is possible, and
1394 it's not even really difficult (well. Such a brutal idea could be
1395 harder to implement). Here is how it goes.
1397 For this, you have to first remember that the XML parsing in SimGrid is done
1398 using a tool called FleXML. Given a DTD, this gives a flex-based parser. If
1399 you want to bypass the parser, you need to provide some code mimicking what
1400 it does and replacing it in its interactions with the SURF code. So, let's
1401 have a look at these interactions.
1403 FleXML parser are close to classical SAX parsers. It means that a
1404 well-formed SimGrid platform XML file might result in the following
1407 - start "platform_description" with attribute version="2"
1408 - start "host" with attributes id="host1" power="1.0"
1410 - start "host" with attributes id="host2" power="2.0"
1412 - start "link" with ...
1414 - start "route" with ...
1415 - start "link:ctn" with ...
1418 - end "platform_description"
1420 The communication from the parser to the SURF code uses two means:
1421 Attributes get copied into some global variables, and a surf-provided
1422 function gets called by the parser for each event. For example, the event
1423 - start "host" with attributes id="host1" power="1.0"
1425 let the parser do something roughly equivalent to:
1427 strcpy(A_host_id,"host1");
1432 In SURF, we attach callbacks to the different events by initializing the
1433 pointer functions to some the right surf functions. Since there can be
1434 more than one callback attached to the same event (if more than one
1435 model is in use, for example), they are stored in a dynar. Example in
1436 workstation_ptask_L07.c:
1438 /* Adding callback functions */
1439 surf_parse_reset_parser();
1440 surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
1441 surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
1442 surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
1443 surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
1444 surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
1445 surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
1447 /* Parse the file */
1448 surf_parse_open(file);
1449 xbt_assert1((!surf_parse()), "Parse error in %s", file);
1453 So, to bypass the FleXML parser, you need to write your own version of the
1454 surf_parse function, which should do the following:
1455 - Fill the A_<tag>_<attribute> variables with the wanted values
1456 - Call the corresponding STag_<tag>_fun function to simulate tag start
1457 - Call the corresponding ETag_<tag>_fun function to simulate tag end
1458 - (do the same for the next set of values, and loop)
1460 Then, tell SimGrid that you want to use your own "parser" instead of the stock one:
1462 surf_parse = surf_parse_bypass_environment;
1463 MSG_create_environment(NULL);
1464 surf_parse = surf_parse_bypass_application;
1465 MSG_launch_application(NULL);
1468 A set of macros are provided at the end of
1469 include/surf/surfxml_parse.h to ease the writing of the bypass
1470 functions. An example of this trick is distributed in the file
1471 examples/msg/masterslave/masterslave_bypass.c
1473 \subsection faq_simgrid_configuration Changing SimGrid's behavior
1475 A number of options can be given at runtime to change the default
1476 SimGrid behavior. In particular, you can change the default cpu and
1479 \subsubsection faq_simgrid_configuration_gtnets Using GTNetS
1481 It is possible to use a packet-level network simulator
1482 instead of the default flow-based simulation. You may want to use such
1483 an approach if you have doubts about the validity of the default model
1484 or if you want to perform some validation experiments. At the moment,
1485 we support the GTNetS simulator (it is still rather experimental
1486 though, so leave us a message if you play with it).
1490 To enable GTNetS model inside SimGrid it is needed to patch the GTNetS simulator source code
1491 and build/install it from scratch
1494 - <b>Download and enter the recent downloaded GTNetS directory</b>
1497 svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
1502 - <b>Use the following commands to unzip and patch GTNetS package to work within SimGrid.</b>
1505 unzip gtnets-current.zip
1506 tar zxvf gtnets-current-patch.tgz
1508 cat ../00*.patch | patch -p1
1511 - <b>OPTIONALLY</b> you can use a patch for itanium 64bit processor family.
1514 cat ../AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch | patch -p1
1517 - <b>Compile GTNetS</b>
1519 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.
1523 ln -sf Makefile.linux Makefile
1529 - <b>NOTE</b> A lot of warnings are expected but the application should compile
1530 just fine. If the makefile insists in compiling some QT libraries
1531 please try a make clean before asking for help.
1534 - <b>To compile optimized version</b>
1541 - <b>Installing GTNetS</b>
1543 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.
1546 ln -sf /<absolute_path>/gtnets_current/libgtsim-debug.so /<userhome>/usr/lib/libgtnets.so
1547 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/<userhome>/usr/lib/libgtnets.so
1548 mkdir /<userhome>/usr/include/gtnets
1549 cp -fr SRC/*.h /<userhome>/usr/include/gtnets
1553 - <b>Enable GTNetS support in SimGrid</b>
1556 ./configure --with-gtnets=/<userhome>/usr
1559 - <b>Once you have followed all the instructions for compiling and
1560 installing successfully you can activate this feature at
1561 runntime with the following options:</b>
1564 cd simgrid/example/msg/
1570 - <b>Or try the GTNetS model dogbone example with</b>
1573 gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network_model:GTNets
1577 A long version of this <a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS HowTo.html">HowTo</a> it is available
1580 More about GTNetS simulator at <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS Website</a>
1584 The patches provided by us worked successfully with GTNetS found
1585 <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>,
1586 dated from 12th June 2008. Due to the discontinuing development of
1587 GTNetS it is impossible to precise a version number. We STRONGLY recommend you
1588 to download and install the GTNetS version found in SimGrid repository as explained above.
1593 \subsubsection faq_simgrid_configuration_alternate_network Using alternative flow models
1595 The default simgrid network model uses a max-min based approach as
1596 explained in the research report
1597 <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>.
1598 Other models have been proposed and implemented since then (see for example
1599 <a href="http://mescal.imag.fr/membres/arnaud.legrand/articles/simutools09.pdf">Accuracy Study and Improvement of Network Simulation in the SimGrid Framework</a>)
1600 and can be activated at runtime. For example:
1602 ./mycode platform.xml deployment.xml --cfg=workstation/model:compound --cfg=network/model:LV08 -cfg=cpu/model:Cas01
1605 Possible models for the network are currently "Constant", "CM02",
1606 "LegrandVelho", "GTNets", Reno", "Reno2", "Vegas". Others will
1607 probably be added in the future and many of the previous ones are
1608 experimental and are likely to disappear without notice... To know the
1609 list of the currently implemented models, you should use the
1610 --help-models command line option.
1613 ./masterslave_forwarder ../small_platform.xml deployment_masterslave.xml --help-models
1614 Long description of the workstation models accepted by this simulator:
1615 CLM03: Default workstation model, using LV08 and CM02 as network and CPU
1616 compound: Workstation model allowing you to use other network and CPU models
1617 ptask_L07: Workstation model with better parallel task modeling
1618 Long description of the CPU models accepted by this simulator:
1619 Cas01_fullupdate: CPU classical model time=size/power
1620 Cas01: Variation of Cas01_fullupdate with partial invalidation optimization of lmm system. Should produce the same values, only faster
1621 CpuTI: Variation of Cas01 with also trace integration. Should produce the same values, only faster if you use availability traces
1622 Long description of the network models accepted by this simulator:
1623 Constant: Simplistic network model where all communication take a constant time (one second)
1624 CM02: Realistic network model with lmm_solve and no correction factors
1625 LV08: Realistic network model with lmm_solve and these correction factors: latency*=10.4, bandwidth*=.92, S=8775
1626 Reno: Model using lagrange_solve instead of lmm_solve (experts only)
1627 Reno2: Model using lagrange_solve instead of lmm_solve (experts only)
1628 Vegas: Model using lagrange_solve instead of lmm_solve (experts only)
1631 \subsection faq_tracing Tracing Simulations for Visualization
1633 The trace visualization is widely used to observe and understand the behavior
1634 of parallel applications and distributed algorithms. Usually, this is done in a
1635 two-step fashion: the user instruments the application and the traces are
1636 analyzed after the end of the execution. The visualization itself can highlights
1637 unexpected behaviors, bottlenecks and sometimes can be used to correct
1638 distributed algorithms. The SimGrid team is currently instrumenting the library
1639 in order to let users trace their simulations and analyze them. This part of the
1640 user manual explains how the tracing-related features can be enabled and used
1641 during the development of simulators using the SimGrid library.
1643 \subsubsection faq_tracing_howitworks How it works
1645 For now, the SimGrid library is instrumented so users can trace the <b>platform
1646 utilization</b> using the MSG interface. This means that the tracing will
1647 register how much power is used for each host and how much bandwidth is used for
1648 each link of the platform. The idea with this type of tracing is to observe the
1649 overall view of resources utilization in the first place, especially the
1650 identification of bottlenecks, load-balancing among hosts, and so on.
1652 The idea of the instrumentation is to classify the MSG tasks by category,
1654 the platform utilization (hosts and links) for each of the categories. For that,
1655 the tracing interface enables the declaration of categories and a function to
1656 mark a task with a previously declared category. <em>The tasks that are not
1657 classified according to a category are not traced</em>.
1659 \subsubsection faq_tracing_enabling Enabling using CMake
1661 With the sources of SimGrid, it is possible to enable the tracing
1662 using the parameter <b>-Dtracing=on</b> when the cmake is executed.
1663 The section \ref faq_tracing_functions describes all the functions available
1664 when this Cmake options is activated. These functions will have no effect
1665 if SimGrid is configured without this option (they are wiped-out by the
1669 $ cmake -Dtracing=on .
1673 \subsubsection faq_tracing_functions Tracing Functions
1675 \subsubsubsection Mandatory Functions
1677 \li <b>\c TRACE_start (const char *filename)</b>: This is the first function to
1678 be called. It receives a single argument as parameter that contains the name of
1679 the file that will hold the trace in the end of the simulation. It returns 0 if
1680 everything was properly initialized, 1 otherwise. All trace functions called
1681 before TRACE_start do nothing.
1683 \li <b>\c TRACE_category (const char *category)</b>: This function should be used
1684 to define a user category. The category can be used to differentiate the tasks
1685 that are created during the simulation (for example, tasks from server1,
1686 server2, or request tasks, computation tasks, communication tasks).
1687 All resource utilization (host power and link bandwidth) will be
1688 classified according to the task category. Tasks that do not belong to a
1689 category are not traced.
1691 \li <b>\c TRACE_msg_set_task_category (m_task_t task, const char *category)</b>:
1692 This function should be called after the creation of a task, to define the
1693 category of that task. The first parameter \c task must contain a task that was
1694 created with the function \c MSG_task_create. The second parameter
1695 \c category must contain a category that was previously defined by the function
1698 \li <b>\c TRACE_end ()</b>: This is the last function to be called. It closes
1699 the trace file and stops the tracing of the simulation. All tracing will be
1700 completely disabled after the calling this function. Although we recommend
1701 the use of this function somewhere in the end of program, it can be used
1702 anywhere in the code. This function returns 0 if everything is ok, 1 otherwise.
1704 \subsubsubsection Optional Functions
1706 \li <b>\c TRACE_host_variable_declare (const char *variable)</b>:
1707 Declare a user variable that will be associated to hosts. A variable can
1708 be used to trace user variables such as the number of tasks in a server,
1709 the number of clients in an application, and so on.
1711 \li <b>\c TRACE_host_variable_[set|add|sub] (const char *variable, double
1713 Set the value of a given user variable. It is important to remind that
1714 the value of this variable is always associated to the host. The host
1715 that will be used when these functions are called is the one returned by
1716 the function \c MSG_host_self().
1718 \subsubsection faq_tracing_example Example of Instrumentation
1720 A simplified example using the tracing mandatory functions.
1723 int main (int argc, char **argv)
1725 TRACE_start ("traced_simulation.trace");
1726 TRACE_category ("request");
1727 TRACE_category ("computation");
1728 TRACE_category ("finalize");
1730 MSG_global_init (&argc, &argv);
1732 //(... after deployment ...)
1734 m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
1735 m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
1736 m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
1737 m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
1738 TRACE_msg_set_task_category (req1, "request");
1739 TRACE_msg_set_task_category (req2, "request");
1740 TRACE_msg_set_task_category (req3, "request");
1741 TRACE_msg_set_task_category (req4, "request");
1743 m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
1744 TRACE_msg_set_task_category (comp, "computation");
1746 m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
1747 TRACE_msg_set_task_category (finalize, "finalize");
1758 \subsubsection faq_tracing_analyzing Analyzing the SimGrid Traces
1760 The SimGrid library, during an instrumented simulation, creates a trace file in
1761 the Paje file format that contains the platform utilization for the simulation
1762 that was executed. The visualization analysis of this file is performed with the
1763 visualization tool <a href="http://triva.gforge.inria.fr">Triva</a>, with
1764 special configurations tunned to SimGrid needs. This part of the documentation
1765 explains how to configure and use Triva to analyse a SimGrid trace file.
1767 - <b>Installing Triva</b>: the tool is available in the INRIAGforge,
1768 at <a href="http://triva.gforge.inria.fr">http://triva.gforge.inria.fr</a>.
1769 Use the following command to get the sources, and then check the file
1770 <i>INSTALL.simplified</i>. This file contains instructions to install
1771 the tool's dependencies in a Ubuntu/Debian Linux.
1773 $ svn checkout svn://scm.gforge.inria.fr/svn/triva
1775 $ cat INSTALL.simplified
1778 - <b>Executing Triva</b>: a binary called <i>Triva</i> is available after the
1779 installation (you can execute it passing <em>--help</em> to check its
1780 options). If the triva binary is not available after following the
1781 installation instructions, you may want to execute the following command to
1782 initialize the GNUstep environment variables (note that the location of the
1783 <i>GNUstep.sh</i> file may vary depending on your GNUstep installation - the
1784 command is known to work in Ubuntu and Debian Linux):
1786 $ source /usr/share/GNUstep/Makefiles/GNUstep.sh
1788 You should be able to see this output after the installation of triva:
1790 $ ./Triva.app/Triva --help
1791 Usage: Triva [OPTION...] TRACEFILE
1792 Trace Analysis through Visualization
1794 You need to use one of the following options:
1795 -g, --graph Graph Analysis
1796 -t, --treemap Treemap Analysis
1798 Other auxiliary options to check the trace file:
1799 -c, --check Check the integrity of trace file
1800 -h, --hierarchy Export the trace type hierarchy
1801 -l, --list List entity types
1803 -?, --help Give this help list
1804 --usage Give a short usage message
1806 Triva expects that the user choose one of the available options
1807 (currently <em>--graph</em> or <em>--treemap</em> for a visualization analysis)
1808 and the trace file from the simulation.
1810 - <b>Understanding Triva - time-slice</b>: the analysis of a trace file using
1811 the tool always takes into account the concept of the <em>time-slice</em>.
1812 This concept means that what is being visualized in the screen is always
1813 calculated considering a specific time frame, with its beggining and end
1814 timestamp. The time-slice is configured by the user and can be changed
1815 dynamically through the window called <em>Time Interval</em> that is opened
1816 whenever a trace file is being analyzed. The next figure depicts the time-slice
1817 configuration window.
1818 In the top of the window, in the space named <i>Trace Time</i>,
1819 the two fields show the beggining of the trace (which usually starts in 0) and
1820 the end (that depends on the time simulated by SimGrid). The middle of the
1821 window, in the square named <i>Time Slice Configuration</i>, contains the
1822 aspects related to the time-slice, including its <i>start</i> and its
1823 <i>size</i>. The gray rectangle in the bottom of this part indicates the
1824 <i>current time-slice</i> that is considered for the drawings. If the checkbox
1825 <i>Update Drawings on Sliders Change</i> is not selected, the button
1826 <i>Apply</i> must be clicked in order to inform triva that the
1827 new time-slice must be considered. The bottom part of the window, in the space
1828 indicated by the square <i>Time Slice Animation</i> can be used to advance
1829 the time-frame automatically. The user configures the amount of time that the
1830 time-frame will forward and how frequent this update will happen. Once this is
1831 configured, the user clicks the <i>Play</i> button in order to see the dynamic
1832 changes on the drawings.
1835 <a href="triva-time_interval.png" border=0><img src="triva-time_interval.png" width="50%" border=0></a>
1838 <b>Remarks:</b> when the trace has too many hosts or links, the computation to
1839 take into account a new time-slice can be expensive. When this happens, the
1840 <i>Frequency</i> parameter, but also updates caused by change on configurations
1841 when the checkbox <i>Update Drawings on Sliders
1842 Change</i> is selected will not be followed.
1844 - <b>Understanding Triva - graph</b>: this part of the documention explains how
1845 to analyze the traces using the graph view of Triva, when the user executes
1846 the tool passing <em>--graph</em> as parameter. Triva opens three windows when
1847 this parameter is used: the <i>Time Interval</i> window (previously described),
1848 the <i>Graph Representation</i> window, and the <em>Graph Configuration</em>
1849 window. The Graph Representation is the window where drawings take place.
1850 Initially, it is completely white waiting for a proper graph configuration input
1851 by the user. We start the description of this type of analysis by describing the
1852 <i>Graph Configuration</i> window (depicted below). By using a particular
1853 configuration, triva
1854 can be used to customize the graph drawing according to
1855 the SimGrid trace that was created with user-specific categories. Before delving
1856 into the details of this customization, let us first explain the major parts of
1857 the graph configuration window. The buttons located in the top-right corner can
1858 be used to delete, copy and create a new configuration. The checkbox in the
1859 top-middle part of the window indicates if the configuration typed in the
1860 textfield is syntactically correct (we are using the non-XML
1861 <a href="http://en.wikipedia.org/wiki/Property_list">Property List Format</a> to
1862 describe the configuration). The pop-up button located on the top-left corner
1863 indicates the selected configuration (the user can have multiple graph
1864 configurations). The bottom-left text field contains the name of the current
1865 configuration (updates on this field must be followed by typing enter on the
1866 keyboard to take into account the name change). The bottom-right <em>Apply</em>
1867 button activates the current configuration, resulting on an update on the graph
1871 <a href="triva-graph_configuration.png" border=0><img src="triva-graph_configuration.png" width="50%" border=0></a>
1874 <b>Basic SimGrid Configuration</b>: The figure shows in the big textfield the
1875 basic configuration that should be used during the analysis of a SimGrid trace
1876 file. The basic logic of the configuration is as follows:
1882 The nodes of the graph will be created based on the <i>node</i> parameter, which
1883 in this case is the different <em>"HOST"</em>s of the platform
1884 used to simulate. The <i>edge</i> parameter indicates that the edges of the
1885 graph will be created based on the <em>"LINK"</em>s of the platform. After the
1886 definition of these two parameters, the configuration must detail how
1887 <em>HOST</em>s and <em>LINK</em>s should be drawn. For that, the configuration
1888 must have an entry for each of the types used. For <em>HOST</em>, as basic
1889 configuration, we have:
1896 The parameter <em>size</em> indicates which variable from the trace file will be
1897 used to define the size of the node HOST in the visualization. If the simulation
1898 was executed with availability traces, the size of the nodes will be changed
1899 according to these traces. The parameter <em>scale</em> indicates if the value
1900 of the variable is <em>global</em> or <em>local</em>. If it is global, the value
1901 will be relative to the power of all other hosts, if it is local, the value will
1902 be relative locally.
1903 For <em>LINK</em> we have:
1913 For the types specified in the <em>edge</em> parameter (such as <em>LINK</em>),
1914 the configuration must contain two additional parameters: <em>src</em> and
1915 <em>dst</em> that are used to properly identify which nodes this edge is
1916 connecting. The values <em>SrcHost</em> and <em>DstHost</em> are always present
1917 in the SimGrid trace file and should not be changed in the configuration. The
1918 parameter <em>size</em> for the LINK, in this case, is configured as the
1919 variable <em>bandwidth</em>, with a <em>global</em> scale. The scale meaning
1920 here is exactly the same used for nodes. The last parameter is the GraphViz
1921 algorithm used to calculate the position of the nodes in the graph
1924 graphviz-algorithm = neato;
1927 <b>Customizing the Graph Representation</b>: triva is capable to handle
1928 a customized graph representation based on the variables present in the trace
1929 file. In the case of SimGrid, every time a category is created for tasks, two
1930 variables in the trace file are defined: one to indicate node utilization (how
1931 much power was used by that task category), and another to indicate link
1932 utilization (how much bandwidth was used by that category). For instance, if the
1933 user declares a category named <i>request</i>, there will be variables named
1934 <b>p</b><i>request</i> and a <b>b</b><i>request</i> (<b>p</b> for power and
1935 <b>b</b> for bandwidth). It is important to notice that the variable
1936 <i>prequest</i> in this case is only available for HOST, and
1937 <i>brequest</i> is only available for LINK. <b>Example</b>: suppose there are
1938 two categories for tasks: request and compute. To create a customized graph
1939 representation with a proportional separation of host and link utilization, use
1940 as configuration for HOST and LINK this:
1949 values = (prequest, pcomputation);
1962 values = (brequest, bcomputation);
1966 Where <i>sep_host</i> contains a composition of type <i>separation</i> where
1967 its max size is the <i>power</i> of the host and the variables <i>prequest</i>
1968 and <i>pcomputation</i> are drawn proportionally to the size of the HOST. And
1969 <i>sep_link</i> is also a separation where max is defined as the
1970 <i>bandwidth</i> of the link, and the variables <i>brequest</i> and
1971 <i>bcomputation</i> are drawn proportionally within a LINK.
1972 <i>This configuration enables the analysis of resource utilization by MSG tasks,
1973 and the identification of load-balancing issues, network bottlenecks, for
1975 <b>Other compositions</b>: besides <i>separation</i>, it is possible to use
1976 other types of compositions, such as gradients, and colors, like this:
1981 values = (numberOfTasks);
1985 values = (is_server);
1988 Where <i>gra_host</i> creates a gradient within a node of the graph, using a
1989 global scale and using as value a variable called <i>numberOfTasks</i>, that
1990 could be declared by the user using the optional tracing functions of SimGrid.
1991 If scale is global, the max and min value for the gradient will be equal to the
1992 max and min numberOfTasks among all hosts, and if scale is local, the max and
1993 min value based on the value of numberOfTasks locally in each host.
1994 And <i>color_host</i> composition draws a square based on a positive value of
1995 the variable <i>is_server</i>, that could also be defined by the user using the
1996 SimGrid tracing functions. \n
1997 <b>The Graph Visualization</b>: The next figure shows a graph visualization of a
1998 given time-slice of the masterslave_forwarder example (present in the SimGrid
1999 sources). The red color indicates tasks from the <i>compute</i> category. This
2000 visualization was generated with the following configuration:
2013 values = (pcompute, pfinalize);
2025 values = (bcompute, bfinalize);
2028 graphviz-algorithm = neato;
2033 <a href="triva-graph_visualization.png" border=0><img src="triva-graph_visualization.png" width="50%" border=0></a>
2037 - <b>Understading Triva - colors</b>: An important issue when using Triva is how
2038 to define colors. To do that, we have to know which variables are defined in
2039 the trace file generated by the SimGrid library. The parameter <em>--list</em>
2040 lists the variables for a given trace file:
2042 $ Triva -l masterslave_forwarder.trace
2060 We can see that HOST has seven variables (from power to pfinalize) and LINK has
2061 four (from bandwidth to bfinalize). To define a red color for the
2062 <i>pcompute</i> and <i>bcompute</i> (which are defined based on user category
2063 <i>compute</i>), execute:
2065 $ defaults write Triva 'pcompute Color' '1 0 0'
2066 $ defaults write Triva 'bcompute Color' '1 0 0'
2068 Where the three numbers in each line are the RGB color with values from 0 to 1.
2070 \subsection faq_modelchecking Model-Checking
2071 \subsubsection faq_modelchecking_howto How to use it
2072 To enable the experimental SimGrid model-checking support the program should
2073 be executed with the command line argument
2077 Properties are expressed as assertions using the function
2079 void MC_assert(int prop);
2082 \subsection faq_binding_lua Lua Binding
2083 Most of Simgrid modules require a good level in C programming ,
2084 since simgrid is used to be as standard C library .
2085 Sometime ( for some reason or another ) developers prefer using some kind of « easy scripts »
2086 (something like … lua ? Ruby ? ...?) or a language easier to code with ( Java ? ) for their works,
2087 which avoid dealing with C errors , and sometime an important gain of time (coding-time?) .
2088 Besides Java Binding, Lua and Ruby bindings are available now( since version 3.4 of Simgrid )
2089 for MSG Module, and we are currenlty working on bindings for other modules .
2092 \subsubsection faq_binding_lua_about What is lua ?
2093 Lua (Moon for portuguese !) is a lightweight, reflective, imperative and functional programming language,
2094 designed as a scripting language with extensible semantics as a primary goal.(see official web site <a href="http://www.lua.org">here</a>)
2095 \subsubsection faq_binding_lua_why Why lua ?
2096 Lua is a fast,portable and powerful script language, quite simple to use for developpers .
2097 it combines procedural features with powerful data description facilities,
2098 by using a simple, yet powerful, mechanism of tables.
2099 Lua has a relatively simple C API compared to other scripting languages,
2100 and accordingly it provides a robust, easy to use it.
2101 \subsubsection faq_binding_lua_simgrid How to use lua in Simgrid ?
2102 Actually , the use of lua in Simgrid is quite simple, you have just to follow the same steps as coding with C in Simgird,
2103 but this time, code with Lua ;) :
2104 - Coding functions coresponding to each process
2105 - loading the platforme/deployment XML file that describe the environment of simulation
2106 - and … Running the Simulation !!!
2108 \dontinclude lua/master_slave.lua
2109 \subsubsection faq_binding_lua_example_master_slave Master/Slave Example
2112 \until end_of_master
2113 we mainly use simgrid.Task.new(task_name,computation_size,communication_size) to create our MSG Task,
2114 then simgrid.Task.send(task,alias) to send it.
2115 we use also simgrid.Task.name(task), to get the task's name .
2119 Here, we could see how we use simgrid.Task.recv(alias) to receive a task with a specific alias,
2120 this function return directly the task recevied .
2122 \li Set Environmenet and run application
2123 \until simgrid.clean()
2125 \subsubsection faq_binding_lua_example_data Exchanging Data
2126 You can also exchange data between Process using lua. for that, you have to deal with lua task as a table,
2127 since lua is based itself on a mechanism of tables,
2128 so you can exchange any kind of data ( tables, matrix, strings … ) between process via tasks.
2132 task = simgrid.Task.new("data_task",task_comp,task_comm);
2133 task['matrix'] = my_matrix;
2134 task['table'] = my_table;
2135 task['message'] = "Hello from (Lua || Simgrid ) !! "
2137 simgrid.Task.send(task,alias)
2139 After creating task, we associate to it various kind of data with a specific key,( string in this case)
2140 to distinguish between data variables. Via this key the receiver could access easily to datas.
2143 \li Receiver processe
2145 task = simgrid.Task.recv(alias);
2146 sender_matrix = task['matrix'];
2147 sender_table = task['table'];
2148 sender_message = task['message']
2151 Note that in lua, both sender and receiver share the same lua task!
2152 So that the receiver could joint data directly on the received task without sending it back.
2153 You can find a complet example ( matrix multiplication case ) in the file example/lua/mult_matrix.lua
2156 \subsubsection faq_binding_lua_example_bypass Bypass XML
2157 maybe you wonder if there is a way to bypass the XML files,
2158 and describe your platform directly from the code, with lua bindings it's Possible !! how ?
2159 We provide some additional (tricky?) functions in lua that allows you to set up your own platform without using the XML files
2160 ( this can be useful for large platforms, so a simple for loop will avoid you to deal with an annoying XML File ;) )
2165 simgrid.Host.new("Tremblay",98095000);
2166 simgrid.Host.new("Jupiter",76296000);
2167 simgrid.Host.new("Fafard",76296000);
2168 simgrid.Host.new("Ginette",48492000);
2169 simgrid.Host.new("Bourassa",48492000);
2171 we use simgrid.Host.new(host_id,power) to instanciate our hosts.
2176 simgrid.Link.new(i,252750+ i*768,0.000270544+i*0.087); -- some crazy values ;)
2179 we used simgrid.Link.new(link_id,bandwidth,latency) with a simple for loop to create all links we need ( much easier than XML hein ? )
2183 -- simgrid.Route.new(src_id,des_id,links_nb,links_list)
2184 simgrid.Route.new("Tremblay","Jupiter",1,{"1"});
2185 simgrid.Route.new("Tremblay","Fafard",6,{"0","1","2","3","4","8"});
2186 simgrid.Route.new("Tremblay","Ginette",3,{"3","4","5"});
2187 simgrid.Route.new("Tremblay","Bourassa",7,{"0","1","3","2","4","6","7"});
2189 simgrid.Route.new("Jupiter","Tremblay",1,{"1"});
2190 simgrid.Route.new("Jupiter","Fafard",7,{"0","1","2","3","4","8","9"});
2191 simgrid.Route.new("Jupiter","Ginette",4,{"3","4","5","9"});
2192 simgrid.Route.new("Jupiter","Bourassa",8,{"0","1","2","3","4","6","7","9"});
2195 for each host you have to specify which route to choose to access to the rest of hosts connected in the grid.
2199 simgrid.register_platform();
2201 Don't forget to register your platform, that SURF callbacks starts their work ;)
2205 simgrid.Host.setFunction("Tremblay","Master",4,{"20","550000000","1000000","4"});
2206 simgrid.Host.setFunction("Bourassa","Slave",1,{"0"});
2207 simgrid.Host.setFunction("Jupiter","Slave",1,{"1"});
2208 simgrid.Host.setFunction("Fafard","Slave",1,{"2"});
2209 simgrid.Host.setFunction("Ginette","Slave",1,{"3"});
2211 you don't need to use a deployment XML file, thanks to simgrid.Host.setFunction(host_id,function,args_number,args_list)
2212 you can associate functions for each host with arguments if needed .
2216 simgrid.register_application();
2218 Yes, Here too you have to resgiter your application before running the simulation.
2220 the full example is distributed in the file examples/lua/master_slave_bypass.lua
2222 \subsection faq_binding_ruby Ruby Binding
2225 \subsubsection faq_binding_ruby_simgrid Use Ruby in Simgrid
2226 Since v3.4, the use of <a href="http://ruby-lang.org">ruby</a> in simgrid is available for the MSG Module.
2227 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.
2229 \dontinclude ruby/MasterSlave.rb
2230 \subsubsection faq_binding_ruby_example Master/Slave Ruby Application
2231 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,
2232 with a 'main' function that describe the behaviour of the process during the simulation.
2240 \until end_of_master
2242 the class MSG::Task contains methods that allows the management of the native MSG tasks.
2243 in master ruby code we used :
2244 - <i>MSG::Task.new(task_name,compute_size,communication_size)</i> : to instanciate a new task.
2245 - <i>MSG::Task.send(mailbox)</i> : to send the task via a mailbox alias.
2246 - <i>MSG::Task.name</i> : to get the task's name.
2250 to receive a task, we use the method <i>MSG::Task.receive(mailbox)</i> that return a MSG:Task object (received task).
2255 - <i>MSG.createEnvironment(platform_file)</i> : set up the environment
2256 - <i>MSG.deployApplication(deployment_file)</i> : load the deployment file description.
2257 - <i>MSG.run</i> : run the simulation
2259 \subsubsection faq_binding_ruby_data Exchanging data
2260 ruby bindings provides two ways to exchange data between ruby processes.
2261 \li MSG::Task.join & MSG::Task.data \br
2263 the MSG::Task class contains 2 methods that allows a data exchange between 2 process.
2265 -<i>MSG::Task.join</i> : makes possible to join any kind of ruby data within a task.
2269 myTable <<1<<-2<<45<<67<<87<<76<<89<<56<<78<<3<<-4<<99
2270 # Creates and send Task With the Table inside
2271 task = MSG::Task.new("quicksort_task",taskComputeSize, taskCommunicationSize);
2276 -<i>MSG::Task.data</i> : to access to the data contained into the task.
2279 task = MSG::Task.receive(recv_mailbox.to_s)
2281 quicksort(table,0,table.size-1)
2284 you can find a complet example illustrating the use of those methods in file /example/ruby/Quicksort.rb
2288 another 'object-oriented' way to do it, is to make your own 'task' class that inherit from MSG::Task ,
2289 and contains data you want to deal with, the only 'tricky' thing is that "the initializer" method has no effect !
2291 the use of some getter/setter methods would be the simple way to manage your data :)
2293 class PingPongTask < MSG::Task
2294 # The initialize method has no effect
2304 you can find an example of use in file example/ruby/PingPong.rb
2306 \section faq_troubleshooting Troubleshooting
2308 \subsection faq_trouble_lib_compil SimGrid compilation and installation problems
2310 \subsubsection faq_trouble_lib_config ./configure fails!
2312 We know only one reason for the configure to fail:
2314 - <b>You are using a broken build environment</b>\n
2315 If symptom is that configure complains about gcc not being able to build
2316 executables, you are probably missing the libc6-dev package. Damn Ubuntu.
2318 If you experience other kind of issue, please get in touch with us. We are
2319 always interested in improving our portability to new systems.
2321 \subsubsection faq_trouble_distcheck Dude! "make check" fails on my machine!
2323 Don't assume we never run this target, because we do. Check
2324 http://bob.loria.fr:8010 if you don't believe us.
2326 There is several reasons which may cause the make check to fail on your
2329 - <b>You are using a broken libc (probably concerning the contextes)</b>.\n
2330 The symptom is that the "make check" fails within the examples/msg directory.\n
2331 By default, SimGrid uses something called ucontexts. This is part of the
2332 libc, but it's quite undertested. For example, some (old) versions of the
2333 glibc on alpha do not implement these functions, but provide the stubs
2334 (which return ENOSYS: not implemented). It may fool our detection mechanism
2335 and leads to segfaults. There is not much we can do to fix the bug.
2336 A workaround is to compile with --with-context=pthread to avoid
2337 ucontext completely. You'll be a bit more limited in the number
2338 of simulated processes you can start concurrently, but 5000
2339 processes is still enough for most purposes, isn't it?\n
2340 This limitation is the reason why we insist on using this piece of ...
2341 software even if it's so troublesome.\n
2342 <b>=> use --with-pthread on AMD64 architecture that do not have an
2343 ultra-recent libc.</b>
2345 - <b>There is a bug in SimGrid we aren't aware of</b>.\n
2346 If none of the above apply, please drop us a mail on the mailing list so
2347 that we can check it out. Make sure to read \ref faq_bugrepport
2350 \subsection faq_trouble_compil User code compilation problems
2352 \subsubsection faq_trouble_err_logcat "gcc: _simgrid_this_log_category_does_not_exist__??? undeclared (first use in this function)"
2354 This is because you are using the log mecanism, but you didn't created
2355 any default category in this file. You should refer to \ref XBT_log
2356 for all the details, but you simply forgot to call one of
2357 XBT_LOG_NEW_DEFAULT_CATEGORY() or XBT_LOG_NEW_DEFAULT_SUBCATEGORY().
2359 \subsubsection faq_trouble_pthreadstatic "gcc: undefined reference to pthread_key_create"
2361 This indicates that one of the library SimGrid depends on (libpthread
2362 here) was missing on the linking command line. Dependencies of
2363 libsimgrid are expressed directly in the dynamic library, so it's
2364 quite impossible that you see this message when doing dynamic linking.
2366 If you compile your code statically (and if you use a pthread version
2367 of SimGrid -- see \ref faq_more_processes), you must absolutely
2368 specify <tt>-lpthread</tt> on the linker command line. As usual, this should
2369 come after <tt>-lsimgrid</tt> on this command line.
2371 \subsection faq_trouble_errors Runtime error messages
2373 \subsubsection faq_flexml_limit "surf_parse_lex: Assertion `next limit' failed."
2375 This is because your platform file is too big for the parser.
2377 Actually, the message comes directly from FleXML, the technology on top of
2378 which the parser is built. FleXML has the bad idea of fetching the whole
2379 document in memory before parsing it. And moreover, the memory buffer size
2380 must be determined at compilation time.
2382 We use a value which seems big enough for our need without bloating the
2383 simulators footprints. But of course your mileage may vary. In this case,
2384 just edit src/surf/surfxml.l modify the definition of
2385 FLEXML_BUFFERSTACKSIZE. E.g.
2388 #define FLEXML_BUFFERSTACKSIZE 1000000000
2391 Then recompile and everything should be fine, provided that your version of
2392 Flex is recent enough (>= 2.5.31). If not the compilation process should
2395 A while ago, we worked on FleXML to reduce a bit its memory consumption, but
2396 these issues remain. There is two things we should do:
2398 - use a dynamic buffer instead of a static one so that the only limit
2399 becomes your memory, not a stupid constant fixed at compilation time
2400 (maybe not so difficult).
2401 - change the parser so that it does not need to get the whole file in
2402 memory before parsing
2403 (seems quite difficult, but I'm a complete newbe wrt flex stuff).
2405 These are changes to FleXML itself, not SimGrid. But since we kinda hijacked
2406 the development of FleXML, I can grant you that any patches would be really
2407 welcome and quickly integrated.
2409 <b>Update:</b> A new version of FleXML (1.7) was released. Most of the work
2410 was done by William Dowling, who use it in his own work. The good point is
2411 that it now use a dynamic buffer, and that the memory usage was greatly
2412 improved. The downside is that William also changed some things internally,
2413 and it breaks the hack we devised to bypass the parser, as explained in
2414 \ref faq_flexml_bypassing. Indeed, this is not a classical usage of the
2415 parser, and Will didn't imagine that we may have used (and even documented)
2416 such a crude usage of FleXML. So, we now have to repair the bypassing
2417 functionality to use the lastest FleXML version and fix the memory usage in
2420 \subsubsection faq_trouble_gras_transport GRAS spits networking error messages
2422 Gras, on real platforms, naturally use regular sockets to communicate. They
2423 are deeply hidden in the gras abstraction, but when things go wrong, you may
2424 get some weird error messages. Here are some example, with the probable
2427 - <b>Transport endpoint is not connected</b>: several processes try to open
2428 a server socket on the same port number of the same machine. This is
2429 naturally bad and each process should pick its own port number for this.\n
2430 Maybe, you just have some processes remaining from a previous experiment
2432 Killing them may help, but again if you kill -KILL them, you'll have to
2433 wait for a while: they didn't close there sockets properly and the system
2434 needs a while to notice that this port is free again.
2436 - <b>Socket closed by remote side</b>: if the remote process is not
2437 supposed to close the socket at this point, it may be dead.
2439 - <b>Connection reset by peer</b>: I found this on Internet about this
2440 error. I think it's what's happening here, too:\n
2441 <i>This basically means that a network error occurred while the client was
2442 receiving data from the server. But what is really happening is that the
2443 server actually accepts the connection, processes the request, and sends
2444 a reply to the client. However, when the server closes the socket, the
2445 client believes that the connection has been terminated abnormally
2446 because the socket implementation sends a TCP reset segment telling the
2447 client to throw away the data and report an error.\n
2448 Sometimes, this problem is caused by not properly closing the
2449 input/output streams and the socket connection. Make sure you close the
2450 input/output streams and socket connection properly. If everything is
2451 closed properly, however, and the problem persists, you can work around
2452 it by adding a one-second sleep before closing the streams and the
2453 socket. This technique, however, is not reliable and may not work on all
2455 Since GRAS sockets are closed properly (repeat after me: there is no bug
2456 in GRAS), it is either that you are closing your sockets on server side
2457 before the client get a chance to read them (use gras_os_sleep() to delay
2458 the server), or the server died awfully before the client got the data.
2460 \subsubsection faq_trouble_errors_big_fat_warning I'm told that my XML files are too old.
2462 The format of the XML platform description files is sometimes
2463 improved. For example, we decided to change the units used in SimGrid
2464 from MBytes, MFlops and seconds to Bytes, Flops and seconds to ease
2465 people exchanging small messages. We also reworked the route
2466 descriptions to allow more compact descriptions.
2468 That is why the XML files are versionned using the 'version' attribute
2469 of the root tag. Currently, it should read:
2471 <platform version="2">
2474 If your files are too old, you can use the simgrid_update_xml.pl
2475 script which can be found in the tools directory of the archive.
2477 \subsection faq_trouble_valgrind Valgrind-related and other debugger issues
2479 If you don't, you really should use valgrind to debug your code, it's
2482 \subsubsection faq_trouble_vg_longjmp longjmp madness in valgrind
2484 This is when valgrind starts complaining about longjmp things, just like:
2486 \verbatim ==21434== Conditional jump or move depends on uninitialised value(s)
2487 ==21434== at 0x420DBE5: longjmp (longjmp.c:33)
2489 ==21434== Use of uninitialised value of size 4
2490 ==21434== at 0x420DC3A: __longjmp (__longjmp.S:48)
2493 This is the sign that you didn't used the exception mecanism well. Most
2494 probably, you have a <tt>return;</tt> somewhere within a <tt>TRY{}</tt>
2495 block. This is <b>evil</b>, and you must not do this. Did you read the section
2498 \subsubsection faq_trouble_vg_libc Valgrind spits tons of errors about backtraces!
2500 It may happen that valgrind, the memory debugger beloved by any decent C
2501 programmer, spits tons of warnings like the following :
2502 \verbatim ==8414== Conditional jump or move depends on uninitialised value(s)
2503 ==8414== at 0x400882D: (within /lib/ld-2.3.6.so)
2504 ==8414== by 0x414EDE9: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2505 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
2506 ==8414== by 0x414F937: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
2507 ==8414== by 0x4150F4C: (within /lib/tls/i686/cmov/libc-2.3.6.so)
2508 ==8414== by 0x400B105: (within /lib/ld-2.3.6.so)
2509 ==8414== by 0x415102D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
2510 ==8414== by 0x412D6B9: backtrace (in /lib/tls/i686/cmov/libc-2.3.6.so)
2511 ==8414== by 0x8076446: xbt_dictelm_get_ext (dict_elm.c:714)
2512 ==8414== by 0x80764C1: xbt_dictelm_get (dict_elm.c:732)
2513 ==8414== by 0x8079010: xbt_cfg_register (config.c:208)
2514 ==8414== by 0x806821B: MSG_config (msg_config.c:42)
2517 This problem is somewhere in the libc when using the backtraces and there is
2518 very few things we can do ourselves to fix it. Instead, here is how to tell
2519 valgrind to ignore the error. Add the following to your ~/.valgrind.supp (or
2520 create this file on need). Make sure to change the obj line according to
2521 your personnal mileage (change 2.3.6 to the actual version you are using,
2522 which you can retrieve with a simple "ls /lib/ld*.so").
2525 name: Backtrace madness
2527 obj:/lib/ld-2.3.6.so
2532 fun:__libc_dlopen_mode
2535 Then, you have to specify valgrind to use this suppression file by passing
2536 the <tt>--suppressions=$HOME/.valgrind.supp</tt> option on the command line.
2537 You can also add the following to your ~/.bashrc so that it gets passed
2538 automatically. Actually, it passes a bit more options to valgrind, and this
2539 happen to be my personnal settings. Check the valgrind documentation for
2542 \verbatim export VALGRIND_OPTS="--leak-check=yes --leak-resolution=high --num-callers=40 --tool=memcheck --suppressions=$HOME/.valgrind.supp" \endverbatim
2544 \subsubsection faq_trouble_backtraces Truncated backtraces
2546 When debugging SimGrid, it's easier to pass the
2547 --disable-compiler-optimization flag to the configure if valgrind or
2548 gdb get fooled by the optimization done by the compiler. But you
2549 should remove these flag when everything works before going in
2550 production (before launching your 1252135 experiments), or everything
2551 will run only one half of the true SimGrid potential.
2553 \subsection faq_deadlock There is a deadlock in my code!!!
2555 Unfortunately, we cannot debug every code written in SimGrid. We
2556 furthermore believe that the framework provides ways enough
2557 information to debug such informations yourself. If the textual output
2558 is not enough, Make sure to check the \ref faq_visualization FAQ entry to see
2559 how to get a graphical one.
2561 Now, if you come up with a really simple example that deadlocks and
2562 you're absolutely convinced that it should not, you can ask on the
2563 list. Just be aware that you'll be severely punished if the mistake is
2564 on your side... We have plenty of FAQ entries to redact and new
2565 features to implement for the impenitents! ;)
2567 \subsection faq_surf_network_latency I get weird timings when I play with the latencies.
2569 OK, first of all, remember that units should be Bytes, Flops and
2570 Seconds. If you don't use such units, some SimGrid constants (e.g. the
2571 SG_TCP_CTE_GAMMA constant used in most network models) won't have the
2572 right unit and you'll end up with weird results.
2574 Here is what happens with a single transfer of size L on a link
2575 (bw,lat) when nothing else happens.
2578 0-----lat--------------------------------------------------t
2579 |-----|**** real_bw =min(bw,SG_TCP_CTE_GAMMA/(2*lat)) *****|
2582 In more complex situations, this min is the solution of a complex
2583 max-min linear system. Have a look
2584 <a href="http://lists.gforge.inria.fr/pipermail/simgrid-devel/2006-April/thread.html">here</a>
2585 and read the two threads "Bug in SURF?" and "Surf bug not
2586 fixed?". You'll have a few other examples of such computations. You
2587 can also read "A Network Model for Simulation of Grid Application" by
2588 Henri Casanova and Loris Marchal to have all the details. The fact
2589 that the real_bw is smaller than bw is easy to understand. The fact
2590 that real_bw is smaller than SG_TCP_CTE_GAMMA/(2*lat) is due to the
2591 window-based congestion mechanism of TCP. With TCP, you can't exploit
2592 your huge network capacity if you don't have a good round-trip-time
2593 because of the acks...
2595 Anyway, what you get is t=lat + L/min(bw,SG_TCP_CTE_GAMMA/(2*lat)).
2597 * if I you set (bw,lat)=(100 000 000, 0.00001), you get t = 1.00001 (you fully
2599 * if I you set (bw,lat)=(100 000 000, 0.0001), you get t = 1.0001 (you're on the
2601 * if I you set (bw,lat)=(100 000 000, 0.001), you get t = 10.001 (ouch!)
2603 This bound on the effective bandwidth of a flow is not the only thing
2604 that may make your result be unexpected. For example, two flows
2605 competing on a saturated link receive an amount of bandwidth inversely
2606 proportional to their round trip time.
2608 \subsection faq_bugrepport So I've found a bug in SimGrid. How to report it?
2610 We do our best to make sure to hammer away any bugs of SimGrid, but this is
2611 still an academic project so please be patient if/when you find bugs in it.
2612 If you do, the best solution is to drop an email either on the simgrid-user
2613 or the simgrid-devel mailing list and explain us about the issue. You can
2614 also decide to open a formal bug report using the
2615 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">relevant
2616 interface</a>. You need to login on the server to get the ability to submit
2619 We will do our best to solve any problem repported, but you need to help us
2620 finding the issue. Just telling "it segfault" isn't enough. Telling "It
2621 segfaults when running the attached simulator" doesn't really help either.
2622 You may find the following article interesting to see how to repport
2623 informative bug repports:
2624 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html (it is not SimGrid
2625 specific at all, but it's full of good advices).
2627 \author Arnaud Legrand (arnaud.legrand::imag.fr)
2628 \author Martin Quinson (martin.quinson::loria.fr)
2633 ******************************************************************
2634 * OLD CRUFT NOT USED ANYMORE *
2635 ******************************************************************
2638 \subsection faq_crosscompile Cross-compiling a Windows DLL of SimGrid from linux
2640 At the moment, we do not distribute Windows pre-compiled version of SimGrid
2641 because the support for this platform is still experimental. We know that
2642 some parts of the GRAS environment do not work, and we think that the others
2643 environments (MSG and SD) have good chances to work, but we didn't test
2644 ourselves. This section explains how we generate the SimGrid DLL so that you
2645 can build it for yourself. First of all, you need to have a version more
2646 recent than 3.1 (ie, a SVN version as time of writting).
2648 In order to cross-compile the package to windows from linux, you need to
2649 install mingw32 (minimalist gnu win32). On Debian, you can do so by
2650 installing the packages mingw32 (compiler), mingw32-binutils (linker and
2651 so), mingw32-runtime.
2653 You can use the VPATH support of configure to compile at the same time for
2654 linux and windows without dupplicating the source nor cleaning the tree
2655 between each. Just run bootstrap (if you use the SVN) to run the autotools.
2656 Then, create a linux and a win directories. Then, type:
2657 \verbatim cd linux; ../configure --srcdir=.. <usual configure flags>; make; cd ..
2658 cd win; ../configure --srcdir=.. --host=i586-mingw32msvc <flags>; make; cd ..
2660 The trick to VPATH builds is to call configure from another directory,
2661 passing it an extra --srcdir argument to tell it where all the sources are.
2662 It will understand you want to use VPATH. Then, the trick to cross-compile
2663 is simply to add a --host argument specifying the target you want to build
2664 for. The i586-mingw32msvc string is what you have to pass to use the mingw32
2665 environment as distributed in Debian.
2667 After that, you can run all make targets from both directories, and test
2668 easily that what you change for one arch does not break the other one.
2670 It is possible that this VPATH build thing breaks from time to time in the
2671 SVN since it's quite fragile, but it's granted to work in any released
2672 version. If you experience problems, drop us a mail.
2674 Another possible source of issue is that at the moment, building the
2675 examples request to use the gras_stub_generator tool, which is a compiled
2676 program, not a script. In cross-compilation, you need to cross-execute with
2677 wine for example, which is not really pleasant. We are working on this, but
2678 in the meanwhile, simply don't build the examples in cross-compilation
2679 (<tt>cd src</tt> before running make).
2681 Program (cross-)compiled with mingw32 do request an extra DLL at run-time to be
2682 usable. For example, if you want to test your build with wine, you should do
2683 the following to put this library where wine looks for DLLs.
2685 cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz ~/.wine/c/windows/system/
2686 gunzip ~/.wine/c/windows/system/mingwm10.dll.gz
2689 The DLL is built in src/.libs, and installed in the <i>prefix</i>/bin directory
2690 when you run make install.
2692 If you want to use it in a native project on windows, you need to use
2693 simgrid.dll and mingwm10.dll. For each DLL, you need to build .def file
2694 under linux (listing the defined symbols), and convert it into a .lib file
2695 under windows (specifying this in a way that windows compilers like). To
2696 generate the def files, run (under linux):
2697 \verbatim echo "LIBRARY libsimgrid-0.dll" > simgrid.def
2698 echo EXPORTS >> simgrid.def
2699 nm libsimgrid-0.dll | grep ' T _' | sed 's/.* T _//' >> simgrid.def
2700 nm libsimgrid-0.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> simgrid.def
2702 echo "LIBRARY mingwm10.dll" > mingwm10.def
2703 echo EXPORTS >> mingwm10.def
2704 nm mingwm10.dll | grep ' T _' | sed 's/.* T _//' >> mingwm10.def
2705 nm mingwm10.dll | grep ' D _' | sed 's/.* D _//' | sed 's/$/ DATA/' >> mingwm10.def
2708 To create the import .lib files, use the <tt>lib</tt> windows tool (from
2709 MSVC) the following way to produce simgrid.lib and mingwm10.lib
2710 \verbatim lib /def:simgrid.def
2711 lib /def:mingwm10.def
2714 If you happen to use Borland C Builder, the right command line is the
2715 following (note that you don't need any file.def to get this working).
2716 \verbatim implib simgrid.lib libsimgrid-0.dll
2717 implib mingwm10.lib mingwm10.dll
2720 Then, set the following parameters in Visual C++ 2005:
2721 Linker -> Input -> Additional dependencies = simgrid.lib mingwm10.lib
2723 Just in case you wonder how to generate a DLL from libtool in another
2724 project, we added -no-undefined to any lib*_la_LDFLAGS variables so that
2725 libtool accepts to generate a dynamic library under windows. Then, to make
2726 it true, we pass any dependencies (such as -lws2 under windows or -lpthread
2727 on need) on the linking line. Passing such deps is a good idea anyway so
2728 that they get noted in the library itself, avoiding the users to know about
2729 our dependencies and put them manually on their compilation line. Then we
2730 added the AC_LIBTOOL_WIN32_DLL macro just before AC_PROG_LIBTOOL in the
2731 configure.ac. It means that we exported any symbols which need to be.
2732 Nowadays, functions get automatically exported, so we don't need to load our
2733 header files with tons of __declspec(dllexport) cruft. We only need to do so
2734 for data, but there is no public data in SimGrid so we are good.