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