1 /*! @page outcomes_vizu Visualization and Statistical Analysis
3 SimGrid comes with an extensive support to trace and register what
4 happens during the simulation, so that it can be either visualized or
5 statistically analysed after the simulation.
7 This tracing is widely used to observe and understand the behavior of
8 parallel applications and distributed algorithms. Usually, this is
9 done in a two-step fashion: the user instruments the application and
10 the traces are analyzed after the end of the execution. The analysis
11 can highlights unexpected behaviors, bottlenecks and sometimes can be
12 used to correct distributed algorithms. The SimGrid team has
13 instrumented the library in order to let users trace their simulations
14 and analyze them. This part of the user manual explains how the
15 tracing-related features can be enabled and used during the
16 development of simulators using the SimGrid library.
18 @section instr_category_functions Tracing categories functions
20 The SimGrid library is instrumented so users can trace the platform
21 utilization using MSG, SimDAG and SMPI interfaces. It registers how
22 much power is used for each host and how much bandwidth is used for
23 each link of the platform. The idea with this type of tracing is to
24 observe the overall view of resources utilization in the first place,
25 especially the identification of bottlenecks, load-balancing among
28 Another possibility is to trace resource utilization by
29 categories. Categorized resource utilization tracing gives SimGrid
30 users to possibility to classify MSG and SimDAG tasks by category,
31 tracing resource utilization for each of the categories. The functions
32 below let the user declare a category and apply it to tasks. <em>The
33 tasks that are not classified according to a category are not
34 traced</em>. Even if the user does not specify any category, the
35 simulations can still be traced in terms of resource utilization by
36 using a special parameter that is detailed below (see section @ref
37 tracing_tracing_options).
39 @li @c TRACE_category(const char *category)
40 @li @c TRACE_category_with_color(const char *category, const char *color)
41 @li @c MSG_task_set_category(msg_task_t task, const char *category)
42 @li @c MSG_task_get_category(msg_task_t task)
43 @li @c SD_task_set_category(SD_task_t task, const char *category)
44 @li @c SD_task_get_category(SD_task_t task)
46 @section instr_mark_functions Tracing marks functions
47 @li @c TRACE_declare_mark(const char *mark_type)
48 @li @c TRACE_mark(const char *mark_type, const char *mark_value)
50 @section instr_uservariables_functions Tracing user variables functions
54 @li @c TRACE_host_variable_declare(const char *variable)
55 @li @c TRACE_host_variable_declare_with_color(const char *variable, const char *color)
56 @li @c TRACE_host_variable_set(const char *host, const char *variable, double value)
57 @li @c TRACE_host_variable_add(const char *host, const char *variable, double value)
58 @li @c TRACE_host_variable_sub(const char *host, const char *variable, double value)
59 @li @c TRACE_host_variable_set_with_time(double time, const char *host, const char *variable, double value)
60 @li @c TRACE_host_variable_add_with_time(double time, const char *host, const char *variable, double value)
61 @li @c TRACE_host_variable_sub_with_time(double time, const char *host, const char *variable, double value)
65 @li @c TRACE_link_variable_declare(const char *variable)
66 @li @c TRACE_link_variable_declare_with_color(const char *variable, const char *color)
67 @li @c TRACE_link_variable_set(const char *link, const char *variable, double value)
68 @li @c TRACE_link_variable_add(const char *link, const char *variable, double value)
69 @li @c TRACE_link_variable_sub(const char *link, const char *variable, double value)
70 @li @c TRACE_link_variable_set_with_time(double time, const char *link, const char *variable, double value)
71 @li @c TRACE_link_variable_add_with_time(double time, const char *link, const char *variable, double value)
72 @li @c TRACE_link_variable_sub_with_time(double time, const char *link, const char *variable, double value)
74 For links, but use source and destination to get route:
76 @li @c TRACE_link_srcdst_variable_set(const char *src, const char *dst, const char *variable, double value)
77 @li @c TRACE_link_srcdst_variable_add(const char *src, const char *dst, const char *variable, double value)
78 @li @c TRACE_link_srcdst_variable_sub(const char *src, const char *dst, const char *variable, double value)
79 @li @c TRACE_link_srcdst_variable_set_with_time(double time, const char *src, const char *dst, const char *variable, double value)
80 @li @c TRACE_link_srcdst_variable_add_with_time(double time, const char *src, const char *dst, const char *variable, double value)
81 @li @c TRACE_link_srcdst_variable_sub_with_time(double time, const char *src, const char *dst, const char *variable, double value)
83 @section tracing_tracing_options Tracing configuration Options
85 To check which tracing options are available for your simulator, you
86 can just run it with the option @verbatim --help-tracing @endverbatim
87 to get a very detailed and updated explanation of each tracing
88 parameter. These are some of the options accepted by the tracing
89 system of SimGrid, you can use them by running your simulator with the
95 Safe switch. It activates (or deactivates) the tracing system.
96 No other tracing options take effect if this one is not activated.
104 It activates the categorized resource utilization tracing. It should
105 be enabled if tracing categories are used by this simulator.
107 --cfg=tracing/categorized:yes
111 tracing/uncategorized
113 It activates the uncategorized resource utilization tracing. Use it if
114 this simulator do not use tracing categories and resource use have to be
117 --cfg=tracing/uncategorized:yes
123 A file with this name will be created to register the simulation. The file
124 is in the Paje format and can be analyzed using Paje visualization
125 tools. More information can be found in these webpages:
126 <a href="http://github.com/schnorr/pajeng/">http://github.com/schnorr/pajeng/</a>
128 --cfg=tracing/filename:mytracefile.trace
130 If you do not provide this parameter, the trace file will be named simgrid.trace.
135 This option only has effect if this simulator is SMPI-based. Traces the MPI
136 interface and generates a trace that can be analyzed using Gantt-like
137 visualizations. Every MPI function (implemented by SMPI) is transformed in a
138 state, and point-to-point communications can be analyzed with arrows.
140 --cfg=tracing/smpi:yes
146 This option only has effect if this simulator is SMPI-based. The processes
147 are grouped by the hosts where they were executed.
149 --cfg=tracing/smpi/group:yes
153 tracing/smpi/computing
155 This option only has effect if this simulator is SMPI-based. The parts external
156 to SMPI are also outputted to the trace. Provides better way to analyze the data automatically.
158 --cfg=tracing/smpi/computing:yes
162 tracing/smpi/internals
164 This option only has effect if this simulator is SMPI-based. Display internal communications
165 happening during a collective MPI call.
167 --cfg=tracing/smpi/internals:yes
171 tracing/smpi/display-sizes
173 This option only has effect if this simulator is SMPI-based. Display the sizes of the messages
174 exchanged in the trace, both in the links and on the states. For collective, size means the global size of data sent by the process in general.
176 --cfg=tracing/smpi/display-sizes:yes
180 tracing/smpi/sleeping
196 tracing/smpi/format/ti-one-file
214 This option traces the behavior of all categorized actors, grouping them by hosts. This option
215 can be used to track actor location if this simulator has actor migration.
217 --cfg=tracing/actor:yes
223 This option put some events in a time-ordered buffer using the
224 insertion sort algorithm. The process of acquiring and releasing
225 locks to access this buffer and the cost of the sorting algorithm
226 make this process slow. The simulator performance can be severely
227 impacted if this option is activated, but you are sure to get a trace
228 file with events sorted.
230 --cfg=tracing/buffer:yes
236 This option changes the way SimGrid register its platform on the trace
237 file. Normally, the tracing considers all routes (no matter their
238 size) on the platform file to re-create the resource topology. If this
239 option is activated, only the routes with one link are used to
240 register the topology within a netzone. Routes among netzones continue to be
243 --cfg=tracing/onelink-only:yes
255 tracing/disable-power
263 tracing/disable-destroy
265 Disable the destruction of containers at the end of simulation. This
266 can be used with simulators that have a different notion of time
267 (different from the simulated time).
269 --cfg=tracing/disable-destroy:yes
275 Some visualization tools are not able to parse correctly the Paje file format.
276 Use this option if you are using one of these tools to visualize the simulation
277 trace. Keep in mind that the trace might be incomplete, without all the
278 information that would be registered otherwise.
280 --cfg=tracing/basic:yes
286 Use this to add a comment line to the top of the trace file.
288 --cfg=tracing/comment:my_string
294 Use this to add the contents of a file to the top of the trace file as comment.
296 --cfg=tracing/comment-file:textual_file.txt
302 This option determines the precision of timings stored in the trace file. Make sure
303 you set @ref options_model_precision to at least the same value as this option! (Traces
304 cannot be more accurate than the simulation; they can be less accurate, though.)
306 The following example will give you a precision of E-10 in the trace file:
308 --cfg=tracing/precision:10
320 tracing/platform/topology
327 Please pass @verbatim --help-tracing @endverbatim to your simulator
328 for the updated list of tracing options.
330 @section tracing_tracing_example_parameters Case studies
332 Some scenarios that might help you decide which tracing options
333 you should use to analyze your simulator.
335 @li I want to trace the resource utilization of all hosts
336 and links of the platform, and my simulator <b>does not</b> use
337 the tracing API. For that, you can run a uncategorized trace
338 with the following parameters (it will work with <b>any</b> Simgrid
343 --cfg=tracing/uncategorized:yes @
344 --cfg=tracing/filename:mytracefile.trace @
347 @li I want to trace only a subset of my MSG (or SimDAG) tasks.
348 For that, you will need to create tracing categories using the
349 <b>TRACE_category (...)</b> function (as explained above),
350 and then classify your tasks to a previously declared category
351 using the <b>MSG_task_set_category (...)</b>
352 (or <b>SD_task_set_category (...)</b> for SimDAG tasks). After
353 recompiling, run your simulator with the following parameters:
357 --cfg=tracing/categorized:yes @
358 --cfg=tracing/filename:mytracefile.trace @
362 @section tracing_tracing_example Example of Instrumentation
364 A simplified example using the tracing mandatory functions.
367 int main (int argc, char **argv)
369 MSG_init (&argc, &argv);
371 //(... after deployment ...)
373 //note that category declaration must be called after MSG_create_environment
374 TRACE_category_with_color ("request", "1 0 0");
375 TRACE_category_with_color ("computation", "0.3 1 0.4");
376 TRACE_category ("finalize");
378 msg_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
379 msg_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
380 msg_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
381 msg_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
382 MSG_task_set_category (req1, "request");
383 MSG_task_set_category (req2, "request");
384 MSG_task_set_category (req3, "request");
385 MSG_task_set_category (req4, "request");
387 msg_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
388 MSG_task_set_category (comp, "computation");
390 msg_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
391 MSG_task_set_category (finalize, "finalize");
400 @section tracing_tracing_analyzing Analyzing SimGrid Simulation Traces
402 A SimGrid-based simulator, when executed with the correct parameters
403 (see above) creates a trace file in the Paje file format holding the
404 simulated behavior of the application or the platform. You have
405 several options to analyze this trace file:
407 - Dump its contents to a CSV-like format using `pj_dump` (see <a
408 href="https://github.com/schnorr/pajeng/wiki/pj_dump">PajeNG's wiki
409 on pj_dump</a> and more generally the <a
410 href="https://github.com/schnorr/pajeng/">PajeNG suite</a>) and use
411 gnuplot to plot resource usage, time spent on blocking/executing
412 functions, and so on. Filtering capabilities are at your hand by
413 doing `grep`, with the best regular expression you can provide, to
414 get only parts of the trace (for instance, only a subset of
415 resources or processes).
417 - Derive statistics from trace metrics (the ones built-in with any
418 SimGrid simulation, but also those metrics you injected in the trace
419 using the TRACE module) using the <a
420 href="http://www.r-project.org/">R project</a> and all its
421 modules. You can also combine R with <a
422 href="http://ggplot2.org/">ggplot2</a> to get a number of high
423 quality plots from your simulation metrics. You need to `pj_dump`
424 the contents of the SimGrid trace file to use R.
426 - Visualize the behavior of your simulation using classic space/time
427 views (gantt-charts) provided by the <a
428 href="https://github.com/schnorr/pajeng/">PajeNG suite</a> and any
429 other tool that supports the <a
430 href="http://paje.sourceforge.net/download/publication/lang-paje.pdf">Paje
431 file format</a>. Consider this option if you need to understand the
432 causality of your distributed simulation.
434 - You can also check our online <a
435 href="https://simgrid.org/tutorials.html"> tutorial
436 section</a> that contains a dedicated tutorial with several
437 suggestions on how to use the tracing infrastructure. Look for the
438 SimGrid User::Visualization 101 tutorial.
440 - Ask for help on the <a
441 href="mailto:simgrid-community@inria.fr">simgrid-community@inria.fr</a>
442 mailing list, giving us a detailed explanation on what your
443 simulator does and what kind of information you want to trace. You
444 can also check the <a
445 href="http://lists.gforge.inria.fr/pipermail/simgrid-user/">mailing
446 list archive</a> for old messages regarding tracing and analysis.