SimGrid  3.13
Versatile Simulation of Distributed Systems
MSG examples

Finding the right example in examples/msg is sometimes difficult. This list aims at helping you to find the example from which you can learn what you want to.

Basic examples

Asynchronous communications

In addition to the fully documented example of Asynchronous communications, there are several other examples shipped in the archive:

Acting on Processes

Tracing and visualization features

Tracing can be activated by various configuration options which are illustrated in these example. See Tracing configuration Options for details.

Tracing user variables

The tracing mechanism of SimGrid also allows to associate user variables to resources described in the platform file. The following examples illustrate this feature. They have to be run with the –cfg=tracing:yes and –cfg=tracing/platform:yes options.

Models-related examples

Packet level simulators

This example demonstrates how to use the bindings to a classical Packet-Level Simulators (PLS), as explained in Packet level simulation. The most interesting is probably not the C files since they are unchanged from the other simulations, but the associated files, such as the platform file to see how to declare a platform to be used with the PLS bindings of SimGrid and the tesh file to see how to actually start a simulation in these settings.

Simulation disks and files

This section lists some examples of storage simulation. This part of SimGrid is still preliminary.

Trace driven simulations

This section details how to run trace-driven simulations. It is very handy when you want to test an algorithm or protocol that does nothing unless it receives some events from outside. For example, a P2P protocol reacts to requests from the user, but does nothing if there is no such event.

In such situations, SimGrid allows you to write your protocol in a C file, and the events to react to in a separate text file. Declare a function handling each of the events that you want to accept in your trace files, register them using xbt_replay_action_register in your main, and then use MSG_action_trace_run to launch the simulation. You can either have one trace file containing all your events, or a file per simulated process. Check the tesh files in the example directories for details on how to do it.

Examples of full applications

Miscellaneous