Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Tesh sort wanted output
[simgrid.git] / doc / doxygen / install.doc
1 /*! 
2 @page install Installing Simgrid
3
4 @tableofcontents
5
6 The easiest way to install SimGrid is to go for a binary package.
7 Under Debian or Ubuntu, this is very easy as SimGrid is directly
8 integrated to the official repositories. Under Windows, SimGrid can be
9 installed in a few clicks once you downloaded the installer from
10 gforge. If you just want to use Java, simply copy the jar file on your
11 disk and you're set. 
12
13 Recompiling an official archive is not much more complex, actually.
14 SimGrid has very few dependencies and rely only on very standard
15 tools.  First, download the *@SimGridRelease.tar.gz* archive
16 from [the download page](https://gforge.inria.fr/frs/?group_id=12).
17 Then, recompiling the archive should be done in a few lines:
18
19 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
20 tar xf @SimGridRelease.tar.gz
21 cd @SimGridRelease
22 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
23 make
24 make install
25 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
27 If you want to stay on the bleeding edge, you should get the latest
28 git version, and recompile it as you would do for an official archive.
29 Depending on the files you change in the source tree, some extra
30 tools may be needed.
31
32 @section install_binary Installing a binary package 
33
34 @subsection install_binary_linux Binary packages for linux
35
36 Most of the developers use a Debian or Ubuntu system, and some of us
37 happen to be Debian Maintainers, so the packages for these systems are
38 well integrated with these systems and very uptodate. To install them,
39 simply type:
40
41 @verbatim
42 apt-get install simgrid
43 @endverbatim
44
45 On other Linux variants, you probably want to go for a source install.
46 Please contact us if you want to contribute the build scripts for your
47 prefered distribution.
48
49 @subsection install_binary_win Installation wizard for Windows
50
51 Before starting the installation, make sure that you have the following dependencies:
52   @li cmake 2.8 <a href="http://www.cmake.org/cmake/resources/software.html">(download page)</a>
53   @li MinGW <a href="http://sourceforge.net/projects/mingw/files/MinGW/">(download page)</a>
54   @li perl <a href="http://www.activestate.com/activeperl/downloads">(download page)</a>
55   @li git <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">(download page)</a>
56
57 Then download the package <a href="https://gforge.inria.fr/frs/?group_id=12">SimGrid Installer</a>,
58 execute it and follow instructions.
59
60 @image html win_install_01.png Step 1: Accept the license.
61 @image html win_install_02.png Step 2: Select packets to install.
62 @image html win_install_03.png Step 3: Choice where to install packets previously selected. Please don't use spaces in path.
63 @image html win_install_04.png Step 4: Add CLASSPATH to environment variables.
64 @image html win_install_05.png Step 5: Add PATH to environment variables.
65 @image html win_install_06.png Step 6: Restart your computer to take in consideration environment variables.
66
67 @subsection install_binary_java Using the binary jar file
68
69 The easiest way to install the Java bindings of SimGrid is to grab the
70 jar file from the 
71 <a href="https://gforge.inria.fr/frs/?group_id=12">Download page</a>,
72 and copy it in your classpath (typically, in the same directory than
73 your source code). If you go for that version, there is no need to
74 install the C library as it is bundled within the jar file. Actually,
75 only a bunch of architectures are supported this way to keep the
76 jarfile size under control and because we don't have access to every
77 exotic architectures ourselves. 
78
79 If the jarfile fails on you, complaining that your architecture is not
80 supported, drop us an email: we may extend the jarfile for you, if we
81 have access to your architecture to build SimGrid on it.
82
83 @section install_src Installing from source
84
85 @subsection install_src_deps Resolving the dependencies
86
87 SimGrid only uses very standard tools: 
88   @li C compiler, C++ compiler, make and friends.
89   @li perl (but you may try to go without it) and libpcre (but we are
90       working on removing this dependency)
91   @li We use cmake to configure our compilation 
92       (<a href="http://www.cmake.org/cmake/resources/software.html">download page</a>).
93       You need cmake version 2.8 or higher. You may want to use ccmake
94       for a graphical interface over cmake. 
95
96 On MacOSX, it is advised to use the clang compiler (version 3.0 or
97 higher), from either MacPort or XCode. If you insist on using gcc on
98 this system, you still need a recent version of this compiler, so you
99 need an unofficial gcc47 from MacPort because the version provided by
100 Apple is ways to ancient to suffice. See also @ref install_cmake_mac.
101
102 On Windows, it is strongly advised to use the 
103 <a href="http://sourceforge.net/projects/mingw/files/MinGW/">MinGW
104 environment</a> to build SimGrid. Any other compilers are not tests
105 (and thus probably broken). We usually use the 
106 <a href="http://www.activestate.com/activeperl/downloads">activestate</a>
107 version of Perl, and the 
108 <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
109 version of git on this architecture, but YMMV. See also @ref install_cmake_win.
110
111 @subsection install_src_fetch Retrieving the source
112
113 If you just want to use SimGrid, you should probably grab the latest
114 stable version available from the 
115 <a href="https://gforge.inria.fr/frs/?group_id=12">download page</a>.
116 We do our best to release soon and release often, but sometimes you
117 need to install the developer version of SimGrid, directly from the
118 git repository. Avoid the git version if you are not sure, as it may
119 break on you, or even worse.
120
121 @verbatim
122 git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid
123 @endverbatim
124
125 @subsection install_src_config Configuring the build
126
127 Note that compile-time options are very different from @ref options
128 "run-time options".
129
130 \subsubsection install_cmake_howto Setting compilation options
131
132 The default configuration should be ok for most usages, but if you
133 need to change something, there is several ways to do so. First, you
134 can use environment variable. For example, you can change the used
135 compilers by issuing these commands before launching cmake:
136
137 @verbatim
138 export CC=gcc-4.4 
139 export CXX=g++-4.4
140 @endverbatim
141
142 Another way to do so is to use the -D argument of cmake as follows.
143 Note that the terminating dot is mandatory (see @ref
144 install_cmake_outsrc to understand its meaning).
145
146 @verbatim
147 cmake -DCC=clang -DCXX=clang++ .
148 @endverbatim
149
150 Finally, you can use a graphical interface such as ccmake to change
151 these settings. Simply follow the instructions after starting the
152 interface.
153
154 @verbatim
155 ccmake .
156 @endverbatim
157
158 \subsubsection install_cmake_list SimGrid compilation options
159
160 In addition to the classical cmake configuration variables, SimGrid
161 accepts several options, as listed below.
162
163   @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid 
164       (e.g. /usr/local or /opt).
165
166   @li <b>enable_compile_optimizations</b> (ON/OFF): request the
167       compiler to produce efficient code. You want to activate it,
168       unless you want to debug SimGrid itself (as efficient code may
169       be appear mangled to the debugers).
170
171   @li <b>enable_debug</b> (ON/OFF): disable this if simulation speed
172       really matters to you. All log messages of gravity debug or
173       below will be discarded at compilation time. Since there is
174       quite a bunch of such log messages in SimGrid itself, this can
175       reveal faster than discarding them at runtime as usually. But of
176       course, it is then impossible to get any debug message from
177       SimGrid if something goes wrong.
178
179   @li <b>enable_msg_deprecated</b> (ON/OFF): enable this option if
180       your code used a feature of Simgrid that was droped or modified
181       in recent releases of SimGrid. You should update your code if
182       possible, but with this option, SimGrid will try to emulate its
183       old behavior.
184
185   @li <b>enable_model-checking</b> (ON/OFF): Only enable this if you
186       actually plan to use the model-checking aspect of SimGrid. This
187       mode of execution is still under heavy work, but it should be
188       rather usable now. Be <b>warned</b> that this option will hinder
189       your simulation speed even if you simulate without activating
190       the model-checker. We are working on improving this situation.
191
192   @li <b>enable_supernovae</b> (ON/OFF): If you use an ancient
193       compiler (such as gcc prior to 4.6), you want to enable this
194       option to ensure that the whole SimGrid library is presented to
195       the compiler as a unique compilation unit to allow cross-units
196       optimizations. This is useless on modern compilers (and will
197       soon be droped).
198
199   @li <b>enable_compile_warnings</b> (ON/OFF): request the compiler to
200       issue error message whenever the source code is not perfectly
201       clean. If you develop SimGrid itself, you must activate it to
202       ensure the code quality, but as a user, that option will only
203       bring you issues.
204       
205   @li <b>enable_lib_static</b> (ON/OFF): enable this if you want to
206       compile the static library (but you should consider enjoying
207       this new century instead).
208       
209   @li <b>enable_maintainer_mode</b> (ON/OFF): you only need to set
210       this option if you modify very specific parts of SimGrid itself
211       (the XML parsers and other related elements). Adds an extra
212       dependency on flex and flexml.
213      
214   @li <b>enable_tracing</b> (ON/OFF): disable this if you have issues
215       with the tracing module. But this module is now very stable and
216       you really should try to enjoy this beauty.
217
218   @li <b>enable_smpi</b> (ON/OFF): disable this if you have issues
219       with the module allowing to run MPI code on top of SimGrid. This
220       module very stable, but if you really don't need it, you can
221       disable it.
222       
223   @li <b>enable_mallocators</b> (ON/OFF): disable this when tracking
224       memory issues within SimGrid, or the caching mechanism used
225       internally will fool the debugers.
226
227   @li <b>enable_jedule</b> (ON/OFF): enable this to get SimDag
228       producing traces that can then be vizualized with the Jedule
229       external tool.
230
231   @li <b>enable_lua</b> (ON/OFF): enable this if you want to enjoy the
232       lua bindings of SimGrid. Adds an extra dependency on lua library
233       and developper header files.
234
235
236   @li <b>enable_gtnets</b> (ON/OFF): whether you want to use gtnets.
237       See section @ref pls_simgrid_configuration_gtnets.
238   @li <b>gtnets_path</b> (path): GTNetS installation directory 
239       (eg /usr or /opt).
240   @li <b>enable_ns3</b> (ON/OFF): whether you want to use ns3.
241       See section @ref pls_simgrid_configuration_ns3.
242   @li <b>ns3_path</b> (path): NS3 installation directory (eg /usr or /opt).
243   @li <b>enable_latency_bound_tracking</b> (ON/OFF): enable it if you
244       want to be warned when communications are limited by round trip
245       time while doing packet-level simulation. 
246
247 \subsubsection install_cmake_reset Resetting the compilation configuration
248
249 If you need to empty the cache of values saved by cmake (either
250 because you added a new library or because something seriously went
251 wrong), you can simply delete the file CMakeCache.txt that is created
252 at the root of the source tree. You may also want to edit this file
253 directly in some circumstances.
254
255 \subsubsection install_cmake_outsrc Compiling into a separate directory
256
257 By default, the files produced during the compilation are placed in
258 the source directory. As the compilation generates a lot of files, it
259 is advised to to put them all in a separate directory. It is then
260 easier to cleanup, and this allows to compile several configurations
261 out of the same source tree. For that, simply enter the directory
262 where you want the produced files to land, and invoke cmake (or
263 ccmake) with the full path to the simgrid source as last argument.
264 This approach is called "compilation out of source tree".
265
266 @verbatim
267 mkdir build
268 cd build
269 cmake [options] ..
270 make
271 @endverbatim
272
273 \subsubsection install_cmake_win Cmake on Windows (with MinGW)
274
275 Cmake can produce several kind of of makefiles. Under Windows, it has
276 no way of determining what kind you want to use, so you have to hint it:
277
278 @verbatim
279 cmake -G"MinGW Makefiles" (other options) .
280 mingw32-make
281 @endverbatim
282
283 \subsubsection install_cmake_mac Cmake on Mac OSX
284
285 SimGrid compiles like a charm with clang on Mac OSX:
286
287 @verbatim
288 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
289 make
290 @endverbatim
291
292 With the XCode version of clang 4.1, you may get the following error message:
293 @verbatim
294 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
295 @endverbatim
296
297 In that case, edit the CMakeCache.txt file directly, so that the
298 CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the
299 warning that the "-pthread" argument is not used, if it appears.
300 @verbatim
301 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
302 @endverbatim
303
304 \subsection install_src_compil Compiling SimGrid
305
306 In most cases, compiling and installing simgrid is enough:
307
308 @verbatim
309 make
310 make install # try "sudo make install" if you don't have the permission to write
311 @endverbatim
312
313 In addition, several compilation targets are provided in SimGrid. If
314 your system is well configured, the full list of targets is available
315 for completion when using the Tab key. Note that some of the existing
316 targets are not really for publc consumption so don't worry if some
317 stuff don't work for you.
318
319 @verbatim
320 make simgrid                    Builds only the simgrid library and not any example
321 make masterslave                Builds only this example (and its dependencies)
322 make clean                      Clean the results of a previous compilation
323 make install                    Install the project (doc/ bin/ lib/ include/)
324 make uninstall                  Uninstall the project (doc/ bin/ lib/ include/)
325 make dist                       Cuild a distribution archive (tgz)
326 make distcheck                  Check the dist (make + make dist + tests on the distribution)
327 make simgrid_documentation      Create simgrid documentation
328 @endverbatim
329
330 If you want to see what is really happening, try adding VERBOSE=1 to
331 your compilation requests:
332
333 @verbatim
334 make VERBOSE=1  
335 @endverbatim
336
337 @subsection install_src_test Testing SimGrid 
338
339 Once everything is built, you may want to test the result. SimGrid
340 comes with an extensive set of regression tests (see @ref
341 inside_cmake_addtest "that page of the insider manual" for more
342 details). Running the tests is done using the ctest binary that comes
343 with cmake. These tests are run every night and the result is publicly
344 <a href="http://cdash.inria.fr/CDash/index.php?project=Simgrid">available</a>.
345
346 \verbatim
347 ctest                     # Launch all tests
348 ctest -D Experimental     # Launch all tests and report the result to
349                           # http://cdash.inria.fr/CDash/index.php?project=SimGrid
350 ctest -R msg              # Launch only the tests which name match the string "msg"
351 ctest -j4                 # Launch all tests in parallel, at most 4 at the same time
352 ctest --verbose           # Display all details on what's going on
353 ctest --output-on-failure # Only get verbose for the tests that fail
354
355 ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh?
356                                       # That's fine, I do so all the time myself.
357 \endverbatim
358
359 \section install_setting_own Setting up your own code
360
361 \subsection install_setting_MSG MSG code on Unix (Linux or Mac OSX)
362
363 Do not build your simulator by modifying the SimGrid examples.  Go
364 outside the SimGrid source tree and create your own working directory
365 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
366
367 Suppose your simulation has the following structure (remember it is
368 just an example to illustrate a possible way to compile everything;
369 feel free to organize it as you want).
370
371 \li <tt>sched.h</tt>: a description of the core of the
372     scheduler (i.e. which functions are can be used by the
373     agents). For example we could find the following functions
374     (master, forwarder, slave).
375 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
376     implementing the core of the scheduler. Most of these
377     functions use the MSG functions defined in section \ref
378     msg_task_usage.
379 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
380     the MSG initialization (MSG_init()), the platform
381     creation (e.g. with MSG_create_environment()), the
382     deployment phase (e.g. with MSG_function_register() and
383     MSG_launch_application()) and the call to MSG_main()).
384
385 To compile such a program, we suggest to use the following
386 Makefile. It is a generic Makefile that we have used many times with
387 our students when we teach the C language.
388
389 \verbatim
390 all: masterslave
391 masterslave: masterslave.o sched.o
392
393 INSTALL_PATH = $$HOME
394 CC = gcc
395 PEDANTIC_PARANOID_FREAK =       -O0 -Wshadow -Wcast-align \
396                                 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
397                                 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
398                                 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
399                                 -Wpointer-arith -Wwrite-strings -finline-functions
400 REASONABLY_CAREFUL_DUDE =       -Wall
401 NO_PRAYER_FOR_THE_WICKED =      -w -O2
402 WARNINGS =                      $(REASONABLY_CAREFUL_DUDE)
403 CFLAGS = -g $(WARNINGS)
404
405 INCLUDES = -I$(INSTALL_PATH)/include
406 DEFS = -L$(INSTALL_PATH)/lib/
407 LDADD = -lm -lsimgrid
408 LIBS =
409
410 %: %.o
411         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
412
413 %.o: %.c
414         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
415
416 clean:
417         rm -f $(BIN_FILES) *.o *~
418 .SUFFIXES:
419 .PHONY: clean
420
421 \endverbatim
422
423 The first two lines indicates what should be build when typing make
424 (<tt>masterslave</tt>) and of which files it is to be made of
425 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
426 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
427 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
428 the static version, remove the <tt>-lsimgrid</tt> and add a
429 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
430 after the <tt>LIBS = </tt>.
431
432 More generally, if you have never written a Makefile by yourself, type
433 in a terminal: <tt>info make</tt> and read the introduction. The
434 previous example should be enough for a first try but you may want to
435 perform some more complex compilations...
436
437
438 \subsection install_setting_win_provided Compile the "HelloWorld" project on Windows
439
440 In the SimGrid install directory you should have an HelloWorld project to explain you how to start
441 compiling a source file. There are:
442 \verbatim
443 - HelloWorld.c          The example source file.
444 - CMakeLists.txt        It allows to configure the project.
445 - FindPCRE.cmake        This finds and links to the pcre library (Normally included
446                         into Simgrid directory "GnuWin32").
447 - README                This explaination.
448 \endverbatim
449
450 Now let's compile this example:
451 \li Run windows shell "cmd".
452 \li Open HelloWorld Directory ('cd' command line).
453 \li Create a build directory and change directory. (optional)
454 \li Type 'cmake -G"MinGW Makefiles" \<path_to_HelloWorld_project\>'
455 \li Run mingw32-make
456 \li You should obtain a runnable example ("HelloWorld.exe").
457
458 For compiling your own code you can simply copy the HelloWorld project and rename source name. It will
459 create a target with the same name of the source.
460
461
462 \subsection install_setting_win_new Adding and Compiling a new example on Windows
463
464 \li Put your source file into the helloWord directory.
465 \li Edit CMakeLists.txt by removing the Find Targets section and add those two lines into this section
466 \verbatim
467 ################
468 # FIND TARGETS #
469 ################
470 #It creates a target called 'TARGET_NAME.exe' with the sources 'SOURCES'
471 add_executable(TARGET_NAME SOURCES)
472 #Links TARGET_NAME with simgrid and pcre
473 target_link_libraries(TARGET_NAME simgrid pcre)
474 \endverbatim
475 \li To initialize and build your project, you'll need to run
476 \verbatim
477 cmake -G"MinGW Makefiles" <path_to_HelloWorld_project>
478 \endverbatim
479 \li Run "mingw32-make"
480 \li You should obtain "TARGET_NAME.exe".
481
482 \subsection install_Win_ruby Setup a virtualbox to use SimGrid-Ruby on windows
483
484 Allan Espinosa made these set of Vagrant rules available so that you
485 can use the SimGrid Ruby bindings in a virtual machine using
486 VirtualBox. Thanks to him for that. You can find his project here:
487 https://github.com/aespinosa/simgrid-vagrant
488
489
490
491 */