SimGrid  3.18
Versatile Simulation of Distributed Systems

Find the S4U example fitting your needs in the archive.

SimGrid comes with an extensive set of examples, documented on this page. Most of them only demonstrate one single feature, with some larger examplars listed below.

Each of these examples can be found in a subdirectory under examples/s4u in the archive. It contains the source code (also listed from this page), and the so-called tesh file containing how to call the binary obtained by compiling this example and also the expected output. Tesh files are used to turn each of our examples into an integration test. Some examples also contain other files, on need.

A good way to bootstrap your own project is to copy and combine some of the provided examples to constitute the skeleton of what you plan to simulate.

TODO: document here the examples about plugins

Actors: the active entities

Starting and stoping actors

Inter-actors interactions

Traces Replay as a Workload

This section details how to run trace-driven simulations. It is very handy when you want to test an algorithm or protocol that only react to external events. For example, many P2P protocols react to user requests, but do nothing if there is no such event.

In such situations, you should write your protocol in C++, and separate the workload that you want to play onto your protocol in a separate text file. Declare a function handling each type of the events in your trace, register them using xbt_replay_action_register in your main, and then run the simulation.

Then, you can either have one trace file containing all your events, or a file per simulated process: the former may be easier to work with, but the second is more efficient on very large traces. Check also the tesh files in the example directories for details.

Activities: the things that Actors do

Communications on the network

Executions on the CPU

I/O on disks and files

SimGrid provides two levels of abstraction to interact with the simulated storages. At the simplest level, you simply create read and write actions on the storage resources.

The FileSystem plugin provides a more detailed view, with the classical operations over files: open, move, unlink, and of course read and write. The file and disk sizes are also dealt with and can result in short reads and short write, as in reality.

Classical synchronization objects

Interacting with the platform

Simulating the energy consumption

Tracing and visualization features

Tracing can be activated by various configuration options which are illustrated in these example. See also the full list of options related to tracing.

It is interesting to run the process-create example with the following options to see the task executions:

Larger SimGrid examplars

This section contains application examples that are somewhat larger than the previous examples.

Data diffusion

Distributed Hash Tables (DHT)