Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implem? I meant Impl, as in pimpl. Sorry for the noise
[simgrid.git] / doc / doxygen / install.doc
1 /*!
2 @page install Installing Simgrid
3
4 @tableofcontents
5
6 SimGrid should work out of the box on Linux, Mac OSX, FreeBSD and
7 Windows (under windows, only the Java interfaces are available atm).
8
9 The easiest way to install SimGrid is to go for a binary package.
10 Under Debian or Ubuntu, this is very easy as SimGrid is directly
11 integrated to the official repositories.  If you just want to use
12 Java, simply copy the jar file on your disk and you're set.
13
14 Recompiling an official archive is not much more complex, actually.
15 SimGrid has very few dependencies and rely only on very standard
16 tools.  First, download the *@SimGridRelease.tar.gz* archive
17 from [the download page](https://gforge.inria.fr/frs/?group_id=12).
18 Then, recompiling the archive should be done in a few lines:
19
20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
21 tar xf @SimGridRelease.tar.gz
22 cd @SimGridRelease
23 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
24 make
25 make install
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28 If you want to stay on the bleeding edge, you should get the latest
29 git version, and recompile it as you would do for an official archive.
30 Depending on the files you change in the source tree, some extra
31 tools may be needed.
32
33 @section install_binary Installing a binary package
34
35 @subsection install_binary_linux Binary packages for linux
36
37 Most of the developers use a Debian or Ubuntu system, and some of us
38 happen to be Debian Maintainers, so the packages for these systems are
39 well integrated with these systems and very up-to-date. To install them,
40 simply type:
41
42 @verbatim
43 apt-get install simgrid
44 @endverbatim
45
46 On other Linux variants, you probably want to go for a source install.
47 Please contact us if you want to contribute the build scripts for your
48 preferred distribution.
49
50 @subsection install_binary_java Using the binary jar file
51
52 The easiest way to install the Java bindings of SimGrid is to grab the
53 jar file from the
54 <a href="https://gforge.inria.fr/frs/?group_id=12">Download page</a>,
55 and copy it in your classpath (typically, in the same directory than
56 your source code). If you go for that version, there is no need to
57 install the C library as it is bundled within the jar file. Actually,
58 only a bunch of architectures are supported this way to keep the
59 jar file size under control and because we don't have access to every
60 exotic architectures ourselves.
61
62 If the jarfile fails on you, complaining that your architecture is not
63 supported, drop us an email: we may extend the jarfile for you, if we
64 have access to your architecture to build SimGrid on it.
65
66 If the error message is about the boost-context library, then you
67 should install that library on your machine. This is a known issue in
68 the 3.12 release that will be fixed in the next release.
69
70 You can retrieve a nightly build of the jar file from our autobuilders. 
71 For Windows, head to 
72 <a href="https://ci.appveyor.com/project/mquinson/simgrid">AppVeyor</a>.
73 Click on the artefact link on the right, and grab your file. If the
74 latest build failed, there will be no artefact so you will need to
75 first click on "History" on the top to search for the last successful
76 build.
77 For non-Windows systems (Linux, Mac or FreeBSD), head to 
78 <a href="https://ci.inria.fr/simgrid/job/SimGrid-Multi">Jenkins</a>.
79 In the build history, pick the last green (or at least yellow) build
80 that is not blinking (ie, that is done building). In the list, pick a
81 system that is close to your system, and click on the ball in the
82 Debug row. The build artefact appear on the top of the resulting page.
83
84 @section install_src Installing from source
85
86 @subsection install_src_deps Resolving the dependencies
87
88 SimGrid only uses very standard tools:
89   - C compiler, C++ compiler, make and friends.
90   - perl (but you may try to go without it)
91   - 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.8 or higher. You may want to use ccmake
94       for a graphical interface over cmake.
95   - LibBoost:
96     - osX: with <a href="http://www.finkproject.org/">fink</a>: `sudo fink install boost1.53.nopython`
97     - debian: `apt-get install libboost-dev libboost-context-dev`
98
99 For platform specific details, please see  @ref install_cmake_mac and
100 @ref install_cmake_windows.
101
102 @subsection install_src_fetch Retrieving the source
103
104 If you just want to use SimGrid, you should probably grab the latest
105 stable version available from the
106 <a href="https://gforge.inria.fr/frs/?group_id=12">download page</a>.
107 We do our best to release soon and release often, but sometimes you
108 need to install the developer version of SimGrid, directly from the
109 git repository. Avoid the git version if you are not sure, as it may
110 break on you, or even worse.
111
112 @verbatim
113 git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid
114 @endverbatim
115
116 @subsection install_src_config Configuring the build
117
118 Note that compile-time options are very different from @ref options
119 "run-time options".
120
121 \subsubsection install_cmake_howto Setting compilation options
122
123 The default configuration should be ok for most usages, but if you
124 need to change something, there is several ways to do so. First, you
125 can use environment variables. For example, you can change the used
126 compilers by issuing these commands before launching cmake:
127
128 @verbatim
129 export CC=gcc-4.7
130 export CXX=g++-4.7
131 @endverbatim
132
133 Note that other variables are available, such as CFLAGS and CXXFLAGS to add
134 options for respectively the C compiler and the C++ compiler.
135
136 Another way to do so is to use the -D argument of cmake as follows.
137 Note that the terminating dot is mandatory (see @ref
138 install_cmake_outsrc to understand its meaning).
139
140 @verbatim
141 cmake -DCC=clang -DCXX=clang++ .
142 @endverbatim
143
144 Finally, you can use a graphical interface such as ccmake to change
145 these settings. Simply follow the instructions after starting the
146 interface.
147
148 @verbatim
149 ccmake .
150 @endverbatim
151
152 \subsubsection install_cmake_list SimGrid compilation options
153
154 In addition to the classical cmake configuration variables, SimGrid
155 accepts several options, as listed below.
156
157   @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid
158       (e.g. /usr/local or /opt).
159
160   @li <b>enable_compile_optimizations</b> (ON/OFF): request the
161       compiler to produce efficient code. You want to activate it,
162       unless you want to debug SimGrid itself (as efficient code may
163       be appear mangled to the debuggers).
164
165   @li <b>enable_debug</b> (ON/OFF): disable this if simulation speed
166       really matters to you. All log messages of gravity debug or
167       below will be discarded at compilation time. Since there is
168       quite a bunch of such log messages in SimGrid itself, this can
169       reveal faster than discarding them at runtime as usually. But of
170       course, it is then impossible to get any debug message from
171       SimGrid if something goes wrong.
172
173   @li <b>enable_model-checking</b> (ON/OFF): Only enable this if you
174       actually plan to use the model-checking aspect of SimGrid. This
175       mode of execution is still under heavy work, but it should be
176       rather usable now. Be <b>warned</b> that this option will hinder
177       your simulation speed even if you simulate without activating
178       the model-checker. We are working on improving this situation.
179
180   @li <b>enable_compile_warnings</b> (ON/OFF): request the compiler to
181       issue error message whenever the source code is not perfectly
182       clean. If you develop SimGrid itself, you must activate it to
183       ensure the code quality, but as a user, that option will only
184       bring you issues.
185
186   @li <b>enable_maintainer_mode</b> (ON/OFF): you only need to set
187       this option if you modify very specific parts of SimGrid itself
188       (the XML parsers and other related elements). Adds an extra
189       dependency on flex and flexml.
190
191   @li <b>enable_tracing</b> (ON/OFF): disable this if you have issues
192       with the tracing module. But this module is now very stable and
193       you really should try to enjoy this beauty.
194
195   @li <b>enable_smpi</b> (ON/OFF): disable this if you have issues
196       with the module allowing to run MPI code on top of SimGrid. This
197       module very stable, but if you really don't need it, you can
198       disable it.
199
200   @li <b>enable_mallocators</b> (ON/OFF): disable this when tracking
201       memory issues within SimGrid, or the caching mechanism used
202       internally will fool the debuggers.
203
204   @li <b>enable_jedule</b> (ON/OFF): enable this to get SimDag
205       producing traces that can then be visualized with the Jedule
206       external tool.
207
208   @li <b>enable_lua</b> (ON/OFF): enable this if you want to enjoy the
209       lua bindings of SimGrid. Adds an extra dependency on lua library
210       and developer header files.
211
212
213   @li <b>enable_ns3</b> (ON/OFF): whether you want to use ns3.
214       See section @ref pls_simgrid_configuration_ns3.
215   @li <b>NS3_HINT</b> (path): Where to search for NS3 (eg /usr or /opt).
216   @li <b>enable_latency_bound_tracking</b> (ON/OFF): enable it if you
217       want to be warned when communications are limited by round trip
218       time while doing packet-level simulation.
219   @li <b>enable_documentation</b> (ON/OFF) : whether the documentation should be
220        generated during the compilation. Default is ON.
221
222 \subsubsection install_cmake_reset Resetting the compilation configuration
223
224 If you need to empty the cache of values saved by cmake (either
225 because you added a new library or because something seriously went
226 wrong), you can simply delete the file CMakeCache.txt that is created
227 at the root of the source tree. You may also want to edit this file
228 directly in some circumstances.
229
230 \subsubsection install_cmake_outsrc Compiling into a separate directory
231
232 By default, the files produced during the compilation are placed in
233 the source directory. As the compilation generates a lot of files, it
234 is advised to to put them all in a separate directory. It is then
235 easier to cleanup, and this allows to compile several configurations
236 out of the same source tree. For that, simply enter the directory
237 where you want the produced files to land, and invoke cmake (or
238 ccmake) with the full path to the SimGrid source as last argument.
239 This approach is called "compilation out of source tree".
240
241 @verbatim
242 mkdir build
243 cd build
244 cmake [options] ..
245 make
246 @endverbatim
247
248 \subsubsection install_cmake_mac Building on Mac OS X
249
250 SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
251
252 @verbatim
253 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
254 make
255 @endverbatim
256
257 With the XCode version of clang 4.1, you may get the following error message:
258 @verbatim
259 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
260 @endverbatim
261
262 In that case, edit the CMakeCache.txt file directly, so that the
263 CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the
264 warning that the "-pthread" argument is not used, if it appears.
265 @verbatim
266 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
267 @endverbatim
268
269 \subsubsection install_cmake_windows Building on Windows
270
271 Building from the source on Windows, may be something of an adventure.
272 We never managed to compile SimGrid with something else than MinGW-64
273 ourselves. We usually use the
274 <a href="http://www.activestate.com/activeperl/downloads">activestate</a>
275 version of Perl, and the
276 <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
277 version of git on this architecture, but YMMV. You can have a look at
278 the configuration scripts in the appveyor.yml file, but you are
279 basically on your own here. Sorry. We are not fluent with Windows so
280 we cannot really help. 
281
282 The drawback of MinGW-64 is that the produced DLL are not compatible
283 with MS Visual C. If you need it, <a href="http://clang.llvm.org/docs/MSVCCompatibility.html">clang-cl</a>
284 sounds promising. If you manage to get something working, please tell
285 us how you achieved it.
286
287 \subsection install_src_compil SimGrid main compilation targets
288
289 In most cases, compiling and installing SimGrid is enough:
290
291 @verbatim
292 make
293 make install # try "sudo make install" if you don't have the permission to write
294 @endverbatim
295
296 In addition, several compilation targets are provided in SimGrid. If
297 your system is well configured, the full list of targets is available
298 for completion when using the Tab key. Note that some of the existing
299 targets are not really for public consumption so don't worry if some
300 stuff don't work for you.
301
302 @verbatim
303 make simgrid                    Build only the SimGrid library and not any example
304 make masterslave                Build only this example (and its dependencies)
305 make clean                      Clean the results of a previous compilation
306 make install                    Install the project (doc/ bin/ lib/ include/)
307 make uninstall                  Uninstall the project (doc/ bin/ lib/ include/)
308 make dist                       Build a distribution archive (tgz)
309 make distcheck                  Check the dist (make + make dist + tests on the distribution)
310 make doc                        Create SimGrid documentation
311 @endverbatim
312
313 If you want to see what is really happening, try adding VERBOSE=1 to
314 your compilation requests:
315
316 @verbatim
317 make VERBOSE=1
318 @endverbatim
319
320 @subsection install_src_test Testing SimGrid
321
322 Once everything is built, you may want to test the result. SimGrid
323 comes with an extensive set of regression tests (see @ref
324 inside_tests "that page of the insider manual" for more
325 details). Running the tests is done using the ctest binary that comes
326 with cmake. These tests are run for every commit and the result is
327 publicly <a href="https://ci.inria.fr/simgrid/">available</a>.
328
329 \verbatim
330 ctest                     # Launch all tests
331 ctest -R msg              # Launch only the tests which name match the string "msg"
332 ctest -j4                 # Launch all tests in parallel, at most 4 at the same time
333 ctest --verbose           # Display all details on what's going on
334 ctest --output-on-failure # Only get verbose for the tests that fail
335
336 ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh?
337                                       # That's fine, I do so all the time myself.
338 \endverbatim
339
340 \section install_setting_own Setting up your own code
341
342 \subsection install_setting_MSG MSG code on Unix
343
344 Do not build your simulator by modifying the SimGrid examples.  Go
345 outside the SimGrid source tree and create your own working directory
346 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
347
348 Suppose your simulation has the following structure (remember it is
349 just an example to illustrate a possible way to compile everything;
350 feel free to organize it as you want).
351
352 \li <tt>sched.h</tt>: a description of the core of the
353     scheduler (i.e. which functions are can be used by the
354     agents). For example we could find the following functions
355     (master, forwarder, slave).
356 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
357     implementing the core of the scheduler. Most of these
358     functions use the MSG functions defined in section \ref
359     msg_task_usage.
360 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
361     the MSG initialization (MSG_init()), the platform
362     creation (e.g. with MSG_create_environment()), the
363     deployment phase (e.g. with MSG_function_register() and
364     MSG_launch_application()) and the call to MSG_main()).
365
366 To compile such a program, we suggest to use the following
367 Makefile. It is a generic Makefile that we have used many times with
368 our students when we teach the C language.
369
370 \verbatim
371 all: masterslave
372 masterslave: masterslave.o sched.o
373
374 INSTALL_PATH = $$HOME
375 CC = gcc
376 PEDANTIC_PARANOID_FREAK =       -O0 -Wshadow -Wcast-align \
377                                 -Waggregate-return -Wmissing-prototypes -Wmissing-declarations \
378                                 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
379                                 -Wmissing-noreturn -Wredundant-decls -Wnested-externs \
380                                 -Wpointer-arith -Wwrite-strings -finline-functions
381 REASONABLY_CAREFUL_DUDE =       -Wall
382 NO_PRAYER_FOR_THE_WICKED =      -w -O2
383 WARNINGS =                      $(REASONABLY_CAREFUL_DUDE)
384 CFLAGS = -g $(WARNINGS)
385
386 INCLUDES = -I$(INSTALL_PATH)/include
387 DEFS = -L$(INSTALL_PATH)/lib/
388 LDADD = -lm -lsimgrid
389 LIBS =
390
391 %: %.o
392         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
393
394 %.o: %.c
395         $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
396
397 clean:
398         rm -f $(BIN_FILES) *.o *~
399 .SUFFIXES:
400 .PHONY: clean
401
402 \endverbatim
403
404 The first two lines indicates what should be build when typing make
405 (<tt>masterslave</tt>) and of which files it is to be made of
406 (<tt>masterslave.o</tt> and <tt>sched.o</tt>). This makefile assumes
407 that you have set up correctly your <tt>LD_LIBRARY_PATH</tt> variable
408 (look, there is a <tt>LDADD = -lm -lsimgrid</tt>). If you prefer using
409 the static version, remove the <tt>-lsimgrid</tt> and add a
410 <tt>$(INSTALL_PATH)/lib/libsimgrid.a</tt> on the next line, right
411 after the <tt>LIBS = </tt>.
412
413 More generally, if you have never written a Makefile by yourself, type
414 in a terminal: <tt>info make</tt> and read the introduction. The
415 previous example should be enough for a first try but you may want to
416 perform some more complex compilations...
417
418
419 */