2 @page install Installing Simgrid
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).
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.
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:
20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
21 tar xf @SimGridRelease.tar.gz
23 cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
33 @section install_binary Installing a binary package
35 @subsection install_binary_linux Binary packages for linux
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,
43 apt-get install simgrid
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.
50 @subsection install_binary_java Using the binary jar file
52 The easiest way to install the Java bindings of SimGrid is to grab 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.
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.
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.
70 You can retrieve a nightly build of the jar file from our autobuilders.
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
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.
84 @section install_src Installing from source
86 @subsection install_src_deps Resolving the dependencies
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.
96 - osX: with <a href="http://www.finkproject.org/">fink</a>: `fink install boost1.53.nopython`,
97 or with homebrew: `brew install boost`
98 - debian: `apt-get install libboost-dev libboost-context-dev`
99 - Java (only needed if you want to use the Java bindings): Grab a
100 full JDK from http://www.oracle.com/technetwork/java/javase/downloads
102 For platform specific details, please see @ref install_cmake_mac and
103 @ref install_cmake_windows.
105 @subsection install_src_fetch Retrieving the source
107 If you just want to use SimGrid, you should probably grab the latest
108 stable version available from the
109 <a href="https://gforge.inria.fr/frs/?group_id=12">download page</a>.
110 We do our best to release soon and release often, but sometimes you
111 need to install the developer version of SimGrid, directly from the
112 git repository. Avoid the git version if you are not sure, as it may
113 break on you, or even worse.
116 git clone git://scm.gforge.inria.fr/simgrid/simgrid.git simgrid
119 @subsection install_src_config Configuring the build
121 Note that compile-time options are very different from @ref options
124 \subsubsection install_cmake_howto Setting compilation options
126 The default configuration should be ok for most usages, but if you
127 need to change something, there is several ways to do so. First, you
128 can use environment variables. For example, you can change the used
129 compilers by issuing these commands before launching cmake:
136 Note that other variables are available, such as CFLAGS and CXXFLAGS to add
137 options for respectively the C compiler and the C++ compiler.
139 Another way to do so is to use the -D argument of cmake as follows.
140 Note that the terminating dot is mandatory (see @ref
141 install_cmake_outsrc to understand its meaning).
144 cmake -DCC=clang -DCXX=clang++ .
147 Finally, you can use a graphical interface such as ccmake to change
148 these settings. Simply follow the instructions after starting the
155 \subsubsection install_cmake_list SimGrid compilation options
157 In addition to the classical cmake configuration variables, SimGrid
158 accepts several options, as listed below.
160 @li <b>CMAKE_INSTALL_PREFIX</b> (path): Where to install SimGrid
161 (/opt/simgrid or /usr/local or elsewhere).
163 @li <b>enable_compile_optimizations</b> (ON/OFF): request the
164 compiler to produce efficient code. You want to activate it,
165 unless you want to debug SimGrid itself (as efficient code may
166 be appear mangled to the debuggers).
168 @li <b>enable_debug</b> (ON/OFF): disable this if simulation speed
169 really matters to you. All log messages of gravity debug or
170 below will be discarded at compilation time. Since there is
171 quite a bunch of such log messages in SimGrid itself, this can
172 reveal faster than discarding them at runtime as usually. But of
173 course, it is then impossible to get any debug message from
174 SimGrid if something goes wrong.
176 @li <b>enable_model-checking</b> (ON/OFF): Only enable this if you
177 actually plan to use the model-checking aspect of SimGrid. This
178 mode of execution is still under heavy work, but it should be
179 rather usable now. Be <b>warned</b> that this option will hinder
180 your simulation speed even if you simulate without activating
181 the model-checker. We are working on improving this situation.
183 @li <b>enable_compile_warnings</b> (ON/OFF): request the compiler to
184 issue error message whenever the source code is not perfectly
185 clean. If you develop SimGrid itself, you must activate it to
186 ensure the code quality, but as a user, that option will only
189 @li <b>enable_maintainer_mode</b> (ON/OFF): you only need to set
190 this option if you modify very specific parts of SimGrid itself
191 (the XML parsers and other related elements). Adds an extra
192 dependency on flex and flexml.
194 @li <b>enable_smpi</b> (ON/OFF): disable this if you have issues
195 with the module allowing to run MPI code on top of SimGrid. This
196 module very stable, but if you really don't need it, you can
199 @li <b>enable_mallocators</b> (ON/OFF): disable this when tracking
200 memory issues within SimGrid, or the caching mechanism used
201 internally will fool the debuggers.
203 @li <b>enable_jedule</b> (ON/OFF): enable this to get SimDag
204 producing traces that can then be visualized with the Jedule
207 @li <b>enable_lua</b> (ON/OFF): enable this if you want to enjoy the
208 lua bindings of SimGrid. Adds an extra dependency on lua library
209 and developer header files.
212 @li <b>enable_ns3</b> (ON/OFF): whether you want to use ns3.
213 See section @ref pls_simgrid_configuration_ns3.
214 @li <b>NS3_HINT</b> (path): Where to search for NS3 (eg /usr or /opt).
215 @li <b>enable_documentation</b> (ON/OFF) : whether the documentation should be
216 generated during the compilation. Default is ON.
218 \subsubsection install_cmake_reset Resetting the compilation configuration
220 If you need to empty the cache of values saved by cmake (either
221 because you added a new library or because something seriously went
222 wrong), you can simply delete the file CMakeCache.txt that is created
223 at the root of the source tree. You may also want to edit this file
224 directly in some circumstances.
226 \subsubsection install_cmake_outsrc Compiling into a separate directory
228 By default, the files produced during the compilation are placed in
229 the source directory. As the compilation generates a lot of files, it
230 is advised to to put them all in a separate directory. It is then
231 easier to cleanup, and this allows to compile several configurations
232 out of the same source tree. For that, simply enter the directory
233 where you want the produced files to land, and invoke cmake (or
234 ccmake) with the full path to the SimGrid source as last argument.
235 This approach is called "compilation out of source tree".
244 \subsubsection install_cmake_mac Building on Mac OS X
246 SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
249 cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
253 With the XCode version of clang 4.1, you may get the following error message:
255 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
258 In that case, edit the CMakeCache.txt file directly, so that the
259 CMAKE_OSX_SYSROOT is similar to the following. Don't worry about the
260 warning that the "-pthread" argument is not used, if it appears.
262 CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
265 In the El Capitan version of Max OS X, Apple decided that users don't
266 need no /usr/include directory anymore. If you are hit by this pure
267 madness, just run the following command to restore that classical
268 UNIX directory: `xcode-select -install`
270 \subsubsection install_cmake_windows Building on Windows
272 Building from the source on Windows, may be something of an adventure.
273 We never managed to compile SimGrid with something else than MinGW-64
274 ourselves. We usually use the
275 <a href="http://www.activestate.com/activeperl/downloads">activestate</a>
276 version of Perl, and the
277 <a href="http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe">msys</a>
278 version of git on this architecture, but YMMV. You can have a look at
279 the configuration scripts in the appveyor.yml file, but you are
280 basically on your own here. Sorry. We are not fluent with Windows so
281 we cannot really help.
283 The drawback of MinGW-64 is that the produced DLL are not compatible
284 with MS Visual C. If you need it, <a href="http://clang.llvm.org/docs/MSVCCompatibility.html">clang-cl</a>
285 sounds promising. If you manage to get something working, please tell
286 us how you achieved it.
288 \subsection install_src_compil SimGrid main compilation targets
290 In most cases, compiling and installing SimGrid is enough:
294 make install # try "sudo make install" if you don't have the permission to write
297 In addition, several compilation targets are provided in SimGrid. If
298 your system is well configured, the full list of targets is available
299 for completion when using the Tab key. Note that some of the existing
300 targets are not really for public consumption so don't worry if some
301 stuff don't work for you.
304 make simgrid Build only the SimGrid library and not any example
305 make masterslave Build only this example (and its dependencies)
306 make clean Clean the results of a previous compilation
307 make install Install the project (doc/ bin/ lib/ include/)
308 make uninstall Uninstall the project (doc/ bin/ lib/ include/)
309 make dist Build a distribution archive (tgz)
310 make distcheck Check the dist (make + make dist + tests on the distribution)
311 make doc Create SimGrid documentation
314 If you want to see what is really happening, try adding VERBOSE=1 to
315 your compilation requests:
321 @subsection install_src_test Testing SimGrid
323 Once everything is built, you may want to test the result. SimGrid
324 comes with an extensive set of regression tests (see @ref
325 inside_tests "that page of the insider manual" for more
326 details). Running the tests is done using the ctest binary that comes
327 with cmake. These tests are run for every commit and the result is
328 publicly <a href="https://ci.inria.fr/simgrid/">available</a>.
331 ctest # Launch all tests
332 ctest -R msg # Launch only the tests which name match the string "msg"
333 ctest -j4 # Launch all tests in parallel, at most 4 at the same time
334 ctest --verbose # Display all details on what's going on
335 ctest --output-on-failure # Only get verbose for the tests that fail
337 ctest -R msg- -j5 --output-on-failure # You changed MSG and want to check that you didn't break anything, huh?
338 # That's fine, I do so all the time myself.
341 \section install_setting_own Setting up your own code
343 Do not build your simulator by modifying the SimGrid examples. Go
344 outside the SimGrid source tree and create your own working directory
345 (say <tt>/home/joe/SimGrid/MyFirstScheduler/</tt>).
347 Suppose your simulation has the following structure (remember it is
348 just an example to illustrate a possible way to compile everything;
349 feel free to organize it as you want).
351 \li <tt>sched.h</tt>: a description of the core of the
352 scheduler (i.e. which functions are can be used by the
353 agents). For example we could find the following functions
354 (master, forwarder, slave).
355 \li <tt>sched.c</tt>: a C file including <tt>sched.h</tt> and
356 implementing the core of the scheduler. Most of these
357 functions use the MSG functions defined in section \ref
359 \li <tt>masterslave.c</tt>: a C file with the main function, i.e.
360 the MSG initialization (MSG_init()), the platform
361 creation (e.g. with MSG_create_environment()), the
362 deployment phase (e.g. with MSG_function_register() and
363 MSG_launch_application()) and the call to MSG_main()).
365 To compile such a program, we suggest to use the following
366 Makefile. It is a generic Makefile that we have used many times with
367 our students when we teach the C language.
370 # The first rule of a Makefile is the default target. It will be built when make is called with no parameter
371 # Here, we want to build the binary 'masterslave'
374 # This second rule lists the dependencies of the masterslave binary
375 # How this dependencies are linked is described in an implicit rule below
376 masterslave: masterslave.o sched.o
378 # These third give the dependencies of the each source file
379 masterslave.o: masterslave.c sched.h # list every .h that you use
380 sched.o: sched.c sched.h
383 SIMGRID_INSTALL_PATH = /opt/simgrid # Where you installed simgrid
384 CC = gcc # Your compiler
385 WARNING = -Wshadow -Wcast-align -Waggregate-return -Wmissing-prototypes \
386 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes \
387 -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls \
388 -Wnested-externs -Wpointer-arith -Wwrite-strings -finline-functions
390 # CFLAGS = -g -O0 $(WARNINGS) # Use this line to make debugging easier
391 CFLAGS = -g -O2 $(WARNINGS) # Use this line to get better performance
393 # No change should be mandated past that line
394 #############################################
395 # The following are implicit rules, used by default to actually build
396 # the targets for which you listed the dependencies above.
398 # The blanks before the $(CC) must be a Tab char, not spaces
400 $(CC) -L$(SIMGRID_INSTALL_PATH)/lib/ $(CFLAGS) $^ -lsimgrid -o $@
402 $(CC) -I$(SIMGRID_INSTALL_PATH)/include $(CFLAGS) -c -o $@ $<
409 The comments of this file should be enough to understand what's going
410 on. If you are completely new to makefiles, you should install the
411 <tt>make-doc</tt> package and type this command in a terminal:
414 Sometimes, the following error message (or similar) will be produced.
416 masterworker.c:209: undefined reference to `sg_version_check'
417 masterworker.c:209: undefined reference to `MSG_init_nocheck'
418 (and possibly many other undefined references)
421 It means that the system does not manage to find simgrid when it tries
422 to execute your programs. Specify where to search with the
423 <tt>LD_LIBRARY_PATH</tt> variable. Try running the following command
424 before executing your code. If it helps, you should add this line to
425 your ~/.bashrc so that it gets executed each time you log into your
429 export LD_LIBRARY_PATH=/opt/simgrid/lib