# What to read
-INPUT = ../../include/simgrid/forward.h
-INPUT += ../../include/simgrid/s4u
+INPUT = ../../include/simgrid/forward.h
+INPUT += ../../include/simgrid/s4u
INPUT += ../../include/simgrid/xbt
RECURSIVE = YES
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
-SKIP_FUNCTION_MACROS = NO
+SKIP_FUNCTION_MACROS = NO
PREDEFINED += \
__cplusplus \
simulator. These activities take place on resources such as |Hosts|_,
|Links|_ and |Storages|_. SimGrid predicts the time taken by each
activity and orchestrates accordingly the actors waiting for the
-completion of these activities.
+completion of these activities.
When **communicating**, data is not directly sent to other actors but
Simulation engine (singleton).
- :ref:`class s4u::Mailbox <exhale_class_classsimgrid_1_1s4u_1_1Mailbox>`
Communication rendez-vous.
-
+
- **Platform Elements**
-
+
- :ref:`class s4u::Host <exhale_class_classsimgrid_1_1s4u_1_1Host>`:
Actor location, providing computational power.
- :ref:`class s4u::Link <exhale_class_classsimgrid_1_1s4u_1_1Link>`
- :ref:`class s4u::NetZone <exhale_class_classsimgrid_1_1s4u_1_1NetZone>`:
Sub-region of the platform, containing resources (Hosts, Link, etc).
- :ref:`class s4u::Storage <exhale_class_classsimgrid_1_1s4u_1_1Storage>`
- Resource on which actors can write and read data.
+ Resource on which actors can write and read data.
- :ref:`class s4u::VirtualMachine <exhale_class_classsimgrid_1_1s4u_1_1VirtualMachine>`:
Execution containers that can be moved between Hosts.
-
+
- **Activities** (:ref:`class s4u::Activity <exhale_class_classsimgrid_1_1s4u_1_1Activity>`):
The things that actors can do on resources
Computation activity, started on Host and consuming CPU resources.
- :ref:`class s4u::Io <exhale_class_classsimgrid_1_1s4u_1_1Io>`
I/O activities, started on and consumming Storages.
-
+
- **Synchronization Mechanisms**: Classical IPC that actors can use
-
+
- :ref:`class s4u::Barrier <exhale_class_classsimgrid_1_1s4u_1_1Barrier>`
- :ref:`class s4u::ConditionVariable <exhale_class_classsimgrid_1_1s4u_1_1ConditionVariable>`
- :ref:`class s4u::Mutex <exhale_class_classsimgrid_1_1s4u_1_1Mutex>`
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Font Awesome by Dave Gandy - https://fortawesome.github.com/Font-Awesome
+<!-- Font Awesome by Dave Gandy - https://fortawesome.github.com/Font-Awesome
[CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)],
via Wikimedia Commons -->
<svg
What is SimGrid
===============
-SimGrid is a framework to simulate distributed computer systems.
+SimGrid is a framework to simulate distributed computer systems.
It can be used to either assess abstract algorithms, or to profile and
debug real distributed applications. SimGrid enables studies in the
- The studied **Application**. This can be either a distributed
algorithm described in our simple APIs, or a full featured real
- parallel application using for example the MPI interface
+ parallel application using for example the MPI interface
:ref:`(more info) <application>`.
- The **Virtual Platform**. This is a description of a given
scenario where B arrives first.
This is a very powerful mode, where you can evaluate the correction of
-your application. It can verify either **safety properties** (asserts)
+your application. It can verify either **safety properties** (asserts)
or **liveless properties** stating for example that if a given event
occurs, then another given event will occur in a finite amount of
steps. This mode is not only usable with the abstract algorithms
--------------
This framework is by no means the perfect holly grail able to solve
-every problem on earth.
+every problem on earth.
**SimGrid scope is limited to distributed systems.** Real-time
multi-threaded systems are not in the scope. You could probably tweak
in this direction), but another framework specifically targeting this
use case would probably be more suited.
-**There is currently no support for wireless networks**.
+**There is currently no support for wireless networks**.
The framework could certainly be improved in this direction, but this
is still to be done.
The SimGrid models target fast, large studies yet requesting a
realistic results. In particular, our models abstract away parameters
and phenomenon that are often irrelevant to the realism in our
-context.
+context.
SimGrid is simply not intended to any study that would mandate the
abstracted phenomenon. Here are some **studies that you should not do
Scholar). Among them
`over 200 publications <https://simgrid.org/Usages.html>`_
(written by about 300 individuals) use SimGrid as a scientific
-instrument to conduct their experimental evaluation. These
+instrument to conduct their experimental evaluation. These
numbers do not count the articles contributing to SimGrid.
-This instrument was used in many research communities, such as
+This instrument was used in many research communities, such as
`High-Performance Computing <https://hal.inria.fr/inria-00580599/>`_,
`Cloud Computing <http://dx.doi.org/10.1109/CLOUD.2015.125>`_,
`Workflow Scheduling <http://dl.acm.org/citation.cfm?id=2310096.2310195>`_,
SimGrid can provide high-quality performance predictions. For example,
we determined the speedup achieved by the Tibidabo Arm-based
cluster before its construction
-(`paper <http://hal.inria.fr/hal-00919507>`_). In this case,
+(`paper <http://hal.inria.fr/hal-00919507>`_). In this case,
some differences between the prediction and the real timings were due to
misconfiguration or other problems with the real platforms. To some extent,
SimGrid could even be used to debug the real platform :)
-.. Copyright 2005-2018
+.. Copyright 2005-2018
.. _install:
Installing SimGrid
==================
-
+
SimGrid should work out of the box on Linux, Mac OSX, FreeBSD, and Windows (under windows, only the Java interfaces are
available at the moment).
On Debian or Ubuntu, simply type:
.. code-block:: shell
-
+
apt install simgrid
If you build pre-compiled packages for other distributions, drop us an
email.
-
+
Stable Java Package
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
For non-Windows systems (Linux, Mac or FreeBSD), head to `Jenkins <https://ci.inria.fr/simgrid/job/SimGrid>`_.
-In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under
-build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artefact
+In the build history, pick the last green (or at least yellow) build that is not blinking (i.e., not currently under
+build). In the list, pick a system that is close to yours, and click on the ball in the Debug row. The build artefact
will appear on the top of the resulting page.
For Windows, head to `AppVeyor <https://ci.appveyor.com/project/simgrid/simgrid>`_.
machine, for example with ``apt``.
.. _install_src:
-
+
Installing from the Source
--------------------------
configuration options (e.g., if your python installation is not standard).
boost (at least v1.48, v1.59 recommended)
- On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
- - On Max OS X with homebrew: ``brew install boost``
+ - On Max OS X with homebrew: ``brew install boost``
Java (optional):
- Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
- any version of libgcj)
+ any version of libgcj)
- Mac OS X or Windows: Grab a `full JDK <http://www.oracle.com/technetwork/java/javase/downloads>`_
Lua (optional -- must be v5.3)
- SimGrid won't work with any other version of Lua.
dependencies.
.. code-block:: shell
-
+
git clone git@framagit.org:simgrid/simgrid.git
cd simgrid
cmake -DCMAKE_INSTALL_PREFIX=/opt/simgrid .
by issuing these commands before launching cmake:
.. code-block:: shell
-
+
export CC=gcc-5.1
export CXX=g++-5.1
CMAKE_INSTALL_PREFIX (path)
Where to install SimGrid (/opt/simgrid, /usr/local, or elsewhere).
-
+
enable_compile_optimizations (ON/off)
Request the compiler to produce efficient code. You probably want to
- activate this option, unless you plan modify SimGrid itself:
+ activate this option, unless you plan modify SimGrid itself:
efficient code takes more time to compile, and appears mangled to debuggers.
enable_compile_warnings (on/OFF)
Generates the java bindings of SimGrid.
enable_jedule (on/OFF)
- Produces execution traces from SimDag simulations, that can then be visualized with the
+ Produces execution traces from SimDag simulations, that can then be visualized with the
Jedule external tool.
enable_lua (on/OFF)
enable_mallocators (ON/off)
Activates our internal memory caching mechanism. This produces faster
- code, but it may fool the debuggers.
+ code, but it may fool the debuggers.
enable_model-checking (on/OFF)
Activates the formal verification mode. This will **hinder
ctest -j4 # Launch all tests in parallel, at most 4 concurrent jobs
ctest --verbose # Display all details on what's going on
ctest --output-on-failure # Only get verbose for the tests that fail
-
+
ctest -R s4u -j4 --output-on-failure # You changed S4U and want to check that you didn't break anything, huh?
# That's fine, I do so all the time myself.
SimGrid compiles like a charm with clang (version 3.0 or higher) on Mac OS X:
.. code-block:: shell
-
+
cmake -DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++ .
make
Troubleshooting your Mac OS X build.
-
+
CMake Error: Parse error in cache file build_dir/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.8.sdk
This was reported with the XCode version of clang 4.1. The work
around is to edit the ``CMakeCache.txt`` file directly, to change
the following entry:
-
+
``CMAKE_OSX_SYSROOT:PATH=/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer``
You can safely ignore the warning about "-pthread" not being used, if it appears.
-
+
/usr/include does not seem to exist
This directory does not exist by default on modern Mac OSX versions,
and you may need to create it with ``xcode-select -install``
make simgrid-java_jar # Only build the jarfile
After the compilation, the file ```simgrid.jar``` is produced in the
-root directory.
+root directory.
**Troubleshooting Java Builds**
Then, set the JAVA_INCLUDE_PATH environment variable to the right
path, and relaunch cmake. If you have several version of jni installed
(as above), pick the one corresponding to the report of
-``javac -version``
+``javac -version``
.. code-block:: shell
If needed, implement ``i686-linux-gnu-gfortran`` as a script:
.. code-block:: shell
-
+
#!/usr/bin/env sh
exec gfortran -m32 "$@"
will make it difficult to upgrade to the next version of SimGrid.
Instead, you should create your own working directory somewhere on
your disk (say `/home/joe/MyFirstScheduler/`), and write your code in
-there.
+there.
Cloning a Template Project for S4U
----------------------------------
cmake_minimum_required(VERSION 2.8.8)
project(MyFirstSimulator)
-
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-
+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(SimGrid REQUIRED)
include_directories(${SimGrid_INCLUDE_DIR})
-
+
set(SIMULATOR_SOURCES main.c other.c util.c)
add_executable(my_simulator ${SIMULATOR_SOURCES})
target_link_libraries(my_simulator ${SimGrid_LIBRARY})
# This second rule lists the dependencies of the mysimulator binary
# How this dependencies are linked is described in an implicit rule below
mysimulator: mysimulator.o util.o
-
+
# These third give the dependencies of the each source file
mysimulator.o: mysimulator.c util.h # list every .h that you use
util.o: util.c util.h
# CFLAGS = -g -O0 $(WARNINGS) # Use this line to make debugging easier
CFLAGS = -g -O2 $(WARNINGS) # Use this line to get better performance
-
+
# No change should be mandated past that line
#############################################
# The following are implicit rules, used by default to actually build
# the targets for which you listed the dependencies above.
-
+
# The blanks before the $(CC) must be a Tab char, not spaces
%: %.o
$(CC) -L$(SIMGRID_INSTALL_PATH)/lib/ $(CFLAGS) $^ -lsimgrid -o $@
%.o: %.c
$(CC) -I$(SIMGRID_INSTALL_PATH)/include $(CFLAGS) -c -o $@ $<
-
+
clean:
rm -f *.o *~
.PHONY: clean
^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: shell
-
+
masterworker.c:209: undefined reference to `sg_version_check'
masterworker.c:209: undefined reference to `MSG_init_nocheck'
(and many other undefined references)
Sometimes, the compilation only spits very few "undefined reference"
errors. A possible cause is that the system selected an old version of
-the SimGrid library somewhere on your disk.
+the SimGrid library somewhere on your disk.
Dicover which version is used with ``ldd name-of-yoursimulator``.
Once you've found the obsolete copy of SimGrid, just erase it, and
What is SimGrid
===============
-SimGrid is a framework to simulate distributed computer systems.
+SimGrid is a framework to simulate distributed computer systems.
It can be used to either assess abstract algorithms, or to profile and
debug real distributed applications. SimGrid enables studies in the
- The studied **Application**. This can be either a distributed
algorithm described in our simple APIs, or a full featured real
- parallel application using for example the MPI interface
+ parallel application using for example the MPI interface
@ref application "(more info)".
- The **Virtual Platform**. This is a description of a given
scenario where B arrives first.
This is a very powerful mode, where you can evaluate the correction of
-your application. It can verify either **safety properties** (asserts)
+your application. It can verify either **safety properties** (asserts)
or **liveless properties** stating for example that if a given event
occures, then another given event will occur in a finite amount of
steps. This mode is not only usable with the abstract algorithms
--------------
This framework is by no means the perfect holly grail able to solve
-every problem on earth.
+every problem on earth.
** **SimGrid scope is limited to distributed systems.** Real-time
multithreaded systems are not in the scope. You could probably tweak
in this direction), but another framework specifically targeting this
usecase would probably be more suited.
-** **There is currently no support for IoT studies and wireless networks**.
+** **There is currently no support for IoT studies and wireless networks**.
The framework could certainly be improved in this direction, but this
is still to be done.
The SimGrid models target fast, large studies yet requesting a
realistic results. In particular, our models abstract away parameters
and phenomenon that are often irrelevant to the realism in our
-context.
+context.
SimGrid is simply not intended to any study that would mandate the
abstracted phenomenon. Here are some **studies that you should not do
Scholar). Among them
`over 200 publications <http://simgrid.gforge.inria.fr/Usages.php>`_
(written by about 300 individuals) use SimGrid as a scientific
-instrument to conduct their experimental evaluation. These
+instrument to conduct their experimental evaluation. These
numbers do not count the articles contributing to SimGrid.
-This instrument was used in many research communities, such as
+This instrument was used in many research communities, such as
`High-Performance Computing <https://hal.inria.fr/inria-00580599/>`_,
`Cloud Computing <http://dx.doi.org/10.1109/CLOUD.2015.125>`_,
`Workflow Scheduling <http://dl.acm.org/citation.cfm?id=2310096.2310195>`_,
SimGrid can provide high-quality performance predictions. For example,
we determined the speedup achieved by the Tibidabo Arm-based
cluster before its construction
-(`paper <http://hal.inria.fr/hal-00919507>`_). In this case,
+(`paper <http://hal.inria.fr/hal-00919507>`_). In this case,
some differences between the prediction and the real timings were due to
misconfiguration or other problems with the real platforms. To some extent,
SimGrid could even be used to debug the real platform :)
This section introduces a first example of SimGrid simulation. This
simple application is composed of two kind of actors: the **master**
is in charge of distributing some computational tasks to a set of
-**workers** that execute them.
+**workers** that execute them.
.. image:: /tuto_s4u/img/intro.svg
:align: center
:cpp:func:`simgrid::s4u::Mailbox::put`. Also, :c:macro:`XBT_INFO` is used
as a replacement to printf() or to cout to ensure that the messages
are nicely logged along with the simulated time and actor name.
-
-
+
+
.. literalinclude:: ../../examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp
:language: c++
:start-after: master-begin
Starting the Simulation
.......................
-
+
And this is it. In only a few lines, we defined the algorithm of our
master/workers examples.
route between the hosts Tremblay and Fafard is given. This path
traverses 6 links (named 4, 3, 2, 0, 1 and 8). There are several
examples of platforms in the archive under ``examples/platforms``.
-
+
.. |api_s4u_NetZone| image:: /img/extlink.png
:align: middle
:width: 12
This time, we have all parts: once the program is compiled, we can
execute it as follows. Note how the XBT_INFO() requests turned into
informative messages.
-
+
.. literalinclude:: ../../examples/s4u/app-masterworkers/s4u-app-masterworkers.tesh
:language: shell
:start-after: s4u-app-masterworkers-fun
:prepend: $$$ ./masterworkers platform.xml deploy.xml
:append: $$$
:dedent: 2
-
+
Improve it Yourself
-------------------
round-robin algorithm performs very well. Would it still hold true
when transfer time is not negligible? What if some tasks are
performed faster on some specific nodes?
-
+
- The network topology interconnecting the master and the workers
may be quite complicated. How does such a topology impact the
previous result?
make master-workers
./master-workers small_platform.xml master-workers_d.xml
-For a more "fancy" output, you can use simgrid-colorizer.
+For a more "fancy" output, you can use simgrid-colorizer.
.. code-block:: shell
.. image:: /tuto_s4u/img/vite-screenshot.png
:align: center
-
+
If you want the full power to visualize SimGrid traces, you need
to use R. As a start, you can download this `starter script
<https://framagit.org/simgrid/simgrid/raw/master/docs/source/tuto_s4u/draw_gantt.R>`_
...
}
-
+
Wrap up
.......
mailbox they should use. We can still do so: the master should build
such a parameter before using it in the ``Actor::create()`` call. The
master could even pass directly the mailbox as a parameter to the
-workers.
+workers.
Since we want later to study concurrent applications, it is advised to
use a mailbox name that is unique over the simulation even if there is
-more than one master.
+more than one master.
One possibility for that is to use the actor ID (aid) of each worker
as a mailbox name. The master can retrieve the aid of the newly
.. todo::
Include here the minimal setting to view something in R.
-
+
Lab 5: Better Scheduling
------------------------
- Add a performance measurement mechanism, enabling the master to make smart scheduling choices.
- Test your code on other platforms, from the ``examples/platforms``
directory in your archive.
-
+
What is the largest number of tasks requiring 50e6 flops and 1e5
bytes that you manage to distribute and process in one hour on
``g5k.xml`` ?
- Optimize not only for the amount of tasks handled, but also for the
- total energy dissipated.
+ total energy dissipated.
- And so on. If you come up with a really nice extension, please share
- it with us so that we can extend this tutorial.
+ it with us so that we can extend this tutorial.
After this Tutorial
-------------------
args = commandArgs(trailingOnly=TRUE)
library(ggplot2)
df = read.csv(args[1], header=F, strip.white=T)
-names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State");
-ggplot(df) +
+names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State");
+ggplot(df)
geom_segment(aes(x=Start, xend=End,
- y=Actor, yend=Actor,color=State), size=5) +
- scale_fill_brewer(palette="Set1") +
- theme_bw() +
+ y=Actor, yend=Actor,color=State), size=5)
+ scale_fill_brewer(palette="Set1")
+ theme_bw()
theme (
plot.margin = unit(c(0,0,0,0), "cm"),
legend.spacing = unit(1, "mm"),