Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove multiarch from the doc: it was never tested, and 32b is soon gone
[simgrid.git] / docs / source / Installing_SimGrid.rst
1 .. Copyright 2005-2023
2
3 .. _install:
4
5 Installing SimGrid
6 ==================
7
8
9 SimGrid should work out of the box on Linux, macOS, FreeBSD, and
10 Windows (with WSL).
11
12 Pre-compiled Packages
13 ---------------------
14
15 Binaries for Linux
16 ^^^^^^^^^^^^^^^^^^
17
18 To get all of SimGrid on Debian or Ubuntu, simply type one of the
19 following lines, or several lines if you need several languages.
20
21 .. code-block:: console
22
23    $ apt install libsimgrid-dev  # if you want to develop in C or C++
24    $ apt install python3-simgrid # if you want to develop in Python
25
26 If you use the Nix_ package manager, the latest SimGrid release is packaged as ``simgrid`` in Nixpkgs_.
27 Previous SimGrid versions are maintained in `NUR-Kapack`_ and are available
28 pre-compiled in release and debug modes on the `capack cachix binary cache`_
29 — refer to `NUR-Kapack's documentation`_ for usage instructions.
30
31 If you use a pacman-based system (*e.g.*, Arch Linux and derived distributions),
32 the latest SimGrid is available in the `simgrid AUR package`_
33 — refer to `AUR official documentation`_ for installation instructions.
34
35 If you build pre-compiled packages for other distributions, drop us an
36 email.
37
38 .. _Nix: https://nixos.org/
39 .. _Nixpkgs: https://github.com/NixOS/nixpkgs
40 .. _NUR-Kapack: https://github.com/oar-team/nur-kapack
41 .. _capack cachix binary cache: https://app.cachix.org/cache/capack
42 .. _NUR-Kapack's documentation: https://github.com/oar-team/nur-kapack
43 .. _simgrid AUR package: https://aur.archlinux.org/packages/simgrid/
44 .. _AUR official documentation: https://wiki.archlinux.org/title/Arch_User_Repository
45
46 .. _deprecation_policy:
47
48 Version numbering and deprecation
49 ---------------------------------
50
51 SimGrid tries to be both a research instrument that you can trust, and
52 a vivid project targeting the future issues. We have 4 stable versions
53 per year, numbered 3.24 or 3.25. Backward compatibility is ensured for
54 one year: Code compiling without warning on 3.24 will still compile
55 with 3.28, but maybe with some deprecation warnings. You should update
56 your SimGrid installation at least once a year and fix those
57 deprecation warnings: the compatibility wrappers are usually removed
58 after 4 versions. Another approach is to never update your SimGrid
59 installation, but we don't provide any support to old versions.
60
61 Interim versions (also called pre-versions) may be released between
62 stable releases. They are numbered 3.X.Y, with even Y (for example,
63 3.23.2 was released on July 8. 2019 as a pre-version of 3.24). These
64 versions should be as usable as regular stable releases, even if they
65 may be somewhat less tested and documented. They play no role in our
66 deprecation handling, and they are not really announced to not spam
67 our users.
68
69 Version numbered 3.X.Y with odd Y are git versions. They often work,
70 but no guarantee is given whatsoever (all releases are given "as is",
71 but that's even more so for these unreleased versions).
72
73 .. _install_src:
74
75 Installing from the Source
76 --------------------------
77
78 Getting the Dependencies
79 ^^^^^^^^^^^^^^^^^^^^^^^^
80
81 C++ compiler (either g++, clang, or icc).
82   We use the C++17 standard, and older compilers tend to fail on
83   us. It seems that g++ 7.0 or higher is required nowadays (because of
84   boost).  SimGrid compiles well with `clang` or `icc` too.
85 Python 3.
86   SimGrid should build without Python. That is only needed by our regression test suite.
87 cmake (v3.5).
88   ``ccmake`` provides a nicer graphical interface compared to ``cmake``.
89   Press ``t`` in ``ccmake`` if you need to see absolutely all
90   configuration options (e.g., if your Python installation is not standard).
91 boost (at least v1.48, v1.59 recommended)
92   - On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
93   - On CentOS / Fedora: ``dnf install boost-devel``
94   - On macOS with homebrew: ``brew install boost``
95 Eigen3 (optional)
96   - On Debian / Ubuntu: ``apt install libeigen3-dev``
97   - On CentOS / Fedora: ``dnf install eigen3-devel``
98   - On macOS with homebrew: ``brew install eigen``
99   - Use EIGEN3_HINT to specify where it's installed if cmake doesn't find it automatically.
100
101 For platform-specific details, please see below.
102
103 Getting the Sources
104 ^^^^^^^^^^^^^^^^^^^
105
106 Grab the last **stable release** from `FramaGit
107 <https://framagit.org/simgrid/simgrid/-/releases>`_, and compile it as follows:
108
109 .. code-block:: console
110
111    $ tar xf simgrid-3-XX.tar.gz
112    $ cd simgrid-*
113    $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid -GNinja .
114    $ make
115    $ make install
116
117 If you want to stay on the **bleeding edge**, get the current git version,
118 and recompile it as with stable archives. You may need some extra
119 dependencies.
120
121 .. code-block:: console
122
123    $ git clone https://framagit.org/simgrid/simgrid.git
124    $ cd simgrid
125    $ cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
126    $ make
127    $ make install
128
129 .. _install_src_config:
130
131 Build Configuration
132 ^^^^^^^^^^^^^^^^^^^
133
134 This section is about **compile-time options**, which are very
135 different from :ref:`run-time options <options>`. Compile-time options
136 fall into two categories. **SimGrid-specific options** define which part
137 of the framework to compile while **Generic options** are provided by
138 cmake itself.
139
140 .. warning::
141
142    Our build system often gets mixed up if you change something on
143    your machine after the build configuration.  For example, if
144    SimGrid fails to detect your fortran compiler, it is not enough to
145    install a fortran compiler. You also need to delete all Cmake
146    files, such as ``CMakeCache.txt``. Since Cmake also generates some
147    files in the tree, you may need to wipe out your complete tree and
148    start with a fresh one when you install new dependencies.
149
150    A better solution is to :ref:`build out of the source tree <install_cmake_outsrc>`.
151
152 Generic build-time options
153 """"""""""""""""""""""""""
154
155 These options specify, for example, the path to various system elements (Python
156 path, compiler to use, etc). In most case, CMake automatically discovers the
157 right value for these elements, but you can set them manually as needed.
158 Notably, such variables include ``CC`` and ``CXX``, defining the paths to the C
159 and C++ compilers; ``CFLAGS`` and ``CXXFLAGS`` specifying extra options to pass
160 to the C and C++ compilers; and ``PYTHON_EXECUTABLE`` specifying the path to the
161 Python executable.
162
163 The best way to discover the exact name of the option that you need to
164 change is to press ``t`` in the ``ccmake`` graphical interface, as all
165 options are shown (and documented) in the advanced mode.
166
167 Once you know their name, there are several ways to change the values of
168 build-time options. You can naturally use the ccmake graphical
169 interface for that, or you can use environment variables, or you can
170 prefer the ``-D`` flag of ``cmake``.
171
172 For example, you can change the compilers by issuing these commands to set some
173 environment variables before launching cmake:
174
175 .. code-block:: console
176
177    $ export CC=gcc-5.1
178    $ export CXX=g++-5.1
179
180 The same can be done by passing ``-D`` parameters to cmake, as follows.
181 Note that the dot at the end is mandatory (see :ref:`install_cmake_outsrc`).
182
183 .. code-block:: console
184
185    $ cmake -DCC=clang -DCXX=clang++ .
186
187 SimGrid compilation options
188 """""""""""""""""""""""""""
189
190 Here is the list of all SimGrid-specific compile-time options (the
191 default choice is in upper case).
192
193 CMAKE_INSTALL_PREFIX (path)
194   Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
195
196 enable_compile_optimizations (ON/off)
197   Ask the compiler to produce efficient code. You probably want to
198   leave this option activated, unless you plan to modify SimGrid itself:
199   efficient code takes more time to compile, and appears mangled to some debuggers.
200
201 enable_compile_warnings (on/OFF)
202   Ask the compiler to issue error messages whenever the source
203   code is not perfectly clean. If you are a SimGrid developer, you
204   have to activate this option to enforce the code quality. As a
205   regular user, this option is of little use.
206
207 enable_debug (ON/off)
208   Disabling this option discards all log messages of severity
209   debug or below at compile time (see :ref:`outcome_logs`). The resulting
210   code is marginaly faster than if you discard these messages at
211   runtime, but it obviously becomes impossible to get any debug
212   info from SimGrid when things go wrong.
213
214 enable_documentation (on/OFF)
215   Generates the documentation pages. Building the documentation is not
216   as easy as it used to be, and you should probably use the online
217   version for now.
218
219 enable_lto (ON/off)
220   Enables the *Link Time Optimization* in the C++ compiler.
221   This feature really speeds up the code produced, but it is fragile
222   with older gcc versions.
223
224 enable_maintainer_mode (on/OFF)
225   (dev only) Regenerates the XML parsers whenever the DTD is modified (requires flex and flexml).
226
227 enable_mallocators (ON/off)
228   Activates our internal memory caching mechanism. This produces faster
229   code, but it may fool the debuggers.
230
231 enable_model-checking (on/OFF)
232   Activates the formal verification mode. This will **hinder
233   simulation speed** even when the model checker is not activated at
234   run time.
235
236 enable_ns3 (on/OFF)
237   Activates the ns-3 bindings. See section :ref:`models_ns3`.
238
239 enable_smpi (ON/off)
240   Allows one to run MPI code on top of SimGrid.
241
242 enable_smpi_MBI_testsuite (on/OFF)
243   Adds many extra tests for the model checker module.
244
245 enable_smpi_MPICH3_testsuite (on/OFF)
246   Adds many extra tests for the MPI module.
247
248 minimal-bindings (on/OFF)
249   Take as few optional dependencies as possible, to get minimal
250   library bindings in Python.
251
252 NS3_HINT (empty by default)
253   Alternative path into which ns-3 should be searched for.
254
255 EIGEN3_HINT (empty by default)
256   Alternative path into which Eigen3 should be searched for.
257
258 SIMGRID_PYTHON_LIBDIR (auto-detected)
259   Where to install the Python module library. By default, it is set to the cmake Python3_SITEARCH variable if installing to /usr,
260   and a modified version of that variable if installing to another path. Just force another value if the auto-detected default
261   does not fit your setup.
262
263 SMPI_C_FLAGS, SMPI_CXX_FLAGS, SMPI_Fortran_FLAGS (string)
264   Default compiler options to use in smpicc, smpicxx, or smpiff.
265   This can be useful to set options like "-m32" or "-m64".
266
267 Reset the build configuration
268 """""""""""""""""""""""""""""
269
270 To empty the CMake cache (either when you add a new library or when
271 things go seriously wrong), simply delete your ``CMakeCache.txt``. You
272 may also want to directly edit this file in some circumstances.
273
274 .. _install_cmake_outsrc:
275
276 Out of Tree Compilation
277 ^^^^^^^^^^^^^^^^^^^^^^^
278
279 By default, the files produced during the compilation are placed in
280 the source directory. It is however often better to put them all in a
281 separate directory: cleaning the tree becomes as easy as removing this
282 directory, and you can have several such directories to test several
283 parameter sets or architectures.
284
285 For that, go to the directory where the files should be produced, and
286 invoke cmake (or ccmake) with the full path to the SimGrid source as
287 last argument.
288
289 .. code-block:: console
290
291   $ mkdir build
292   $ cd build
293   $ cmake [options] ..
294   $ make
295
296 Existing Compilation Targets
297 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298
299 In most cases, compiling and installing SimGrid is enough:
300
301 .. code-block:: console
302
303   $ make
304   $ make install # try "sudo make install" if you don't have the permission to write
305
306 In addition, several compilation targets are provided in SimGrid. If
307 your system is well configured, the full list of targets is available
308 for completion when using the ``Tab`` key. Note that some of the
309 existing targets are not really for public consumption so don't worry
310 if some do not work for you.
311
312 - **make**: Build the core of SimGrid that gets installed, but not any example.
313 - **make tests**: Build the tests and examples.
314 - **make simgrid**: Build only the SimGrid library. Not any example nor the helper tools.
315 - **make s4u-comm-pingpong**: Build only this example (works for any example)
316 - **make python-bindings**: Build the Python bindings
317 - **make clean**: Clean the results of a previous compilation
318 - **make install**: Install the project (doc/ bin/ lib/ include/)
319 - **make dist**: Build a distribution archive (tar.gz)
320 - **make distcheck**: Check the dist (make + make dist + tests on the distribution)
321 - **make documentation**: Create SimGrid documentation
322
323 If you want to see what is really happening, try adding ``VERBOSE=1`` to
324 your compilation requests:
325
326 .. code-block:: console
327
328   $ make VERBOSE=1
329
330 .. _install_src_test:
331
332 Testing your build
333 ^^^^^^^^^^^^^^^^^^
334
335 Once everything is built, you may want to test the result. SimGrid
336 comes with an extensive set of regression tests (as described in the
337 @ref inside_tests "insider manual"). The tests are not built by
338 default, so you first have to build them with ``make tests``. You can
339 then run them with ``ctest``, that comes with CMake.  We run them
340 every commit and the results are on `our Jenkins <https://ci.inria.fr/simgrid/>`_.
341
342 .. code-block:: console
343
344   $ make tests                # Build the tests
345   $ ctest                     # Launch all tests
346   $ ctest -R s4u              # Launch only the tests whose names match the string "s4u"
347   $ ctest -j4                 # Launch all tests in parallel, at most 4 concurrent jobs
348   $ ctest --verbose           # Display all details on what's going on
349   $ ctest --output-on-failure # Only get verbose for the tests that fail
350
351   $ ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you  \
352                                          # didn't break anything, huh?                 \
353                                          # That's fine, I do so all the time myself.
354
355 .. _install_cmake_mac:
356
357 macOS-specific instructions
358 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
359
360 SimGrid compiles like a charm with clang (version 3.0 or higher) on macOS:
361
362 .. code-block:: console
363
364   $ cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
365   $ make
366
367
368 Troubleshooting your macOS build.
369
370 CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
371   This was reported with the XCode version of clang 4.1. The work
372   around is to edit the ``CMakeCache.txt`` file directly, to change
373   the following entry:
374
375   ``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
376
377   You can safely ignore the warning about "-pthread" not being used, if it appears.
378
379 /usr/include does not seem to exist
380   This directory does not exist by default on modern macOS versions,
381   and you may need to create it with ``xcode-select -install``
382
383 .. _install_cmake_windows:
384
385 Windows-specific instructions
386 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
387
388 The best solution to get SimGrid working on windows is to install the
389 Ubuntu subsystem of Windows 10. All of SimGrid (but the model checker)
390 works in this setting. Native builds never really worked, and they are
391 disabled starting with SimGrid v3.33.
392
393 Python-specific instructions
394 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
395
396 Once you have the Python development headers installed as well as a
397 recent version of the `pybind11 <https://pybind11.readthedocs.io/en/stable/>`
398 module (version at least 2.4), recompiling the Python bindings from
399 the source should be as easy as:
400
401 .. code-block:: console
402
403   # cd simgrid-source-tree
404   $ python setup.py build install
405
406 Starting with SimGrid 3.13, it should even be possible to install
407 simgrid without downloading the source with pip:
408
409 .. code-block:: console
410
411   $ pip install simgrid