SimGrid 3.6.2
Scalable simulation of distributed systems
Tracing Simulations for Visualization

Tracing Simulations for Visualization

The trace visualization is widely used to observe and understand the behavior of parallel applications and distributed algorithms. Usually, this is done in a two-step fashion: the user instruments the application and the traces are analyzed after the end of the execution. The visualization itself can highlights unexpected behaviors, bottlenecks and sometimes can be used to correct distributed algorithms. The SimGrid team has instrumented the library in order to let users trace their simulations and analyze them. This part of the user manual explains how the tracing-related features can be enabled and used during the development of simulators using the SimGrid library.

How it works

For now, the SimGrid library is instrumented so users can trace the platform utilization using the MSG, SimDAG and SMPI interface. This means that the tracing will register how much power is used for each host and how much bandwidth is used for each link of the platform. The idea with this type of tracing is to observe the overall view of resources utilization in the first place, especially the identification of bottlenecks, load-balancing among hosts, and so on.

The idea of the tracing facilities is to give SimGrid users to possibility to classify MSG and SimDAG tasks by category, tracing the platform utilization (hosts and links) for each of the categories. For that, the tracing interface enables the declaration of categories and a function to mark a task with a previously declared category. The tasks that are not classified according to a category are not traced. Even if the user does not specify any category, the simulations can still be traced in terms of resource utilization by using a special parameter that is detailed below.

Enabling using CMake

With the sources of SimGrid, it is possible to enable the tracing using the parameter -Denable_tracing=ON when the cmake is executed. The section Tracing Functions describes all the functions available when this Cmake options is activated. These functions will have no effect if SimGrid is configured without this option (they are wiped-out by the C-preprocessor).

$ cmake -Denable_tracing=ON .
$ make

Tracing Functions

Tracing configuration Options

To check which tracing options are available for your simulator, you can just run it with the option --help-tracing. These are the options accepted by the tracing system of SimGrid as of today, you can use them by running your simulator with the --cfg= switch:

Case studies

Some scenarios that might help you decide which tracing options you should use to analyze your simulator.

Example of Instrumentation

A simplified example using the tracing mandatory functions.

int main (int argc, char **argv)
{
  MSG_global_init (&argc, &argv);

  //(... after deployment ...)

  //note that category declaration must be called after MSG_create_environment
  TRACE_category_with_color ("request", "1 0 0");
  TRACE_category_with_color ("computation", "0.3 1 0.4");
  TRACE_category ("finalize");

  m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
  m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
  m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
  m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
  TRACE_msg_set_task_category (req1, "request");
  TRACE_msg_set_task_category (req2, "request");
  TRACE_msg_set_task_category (req3, "request");
  TRACE_msg_set_task_category (req4, "request");

  m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
  TRACE_msg_set_task_category (comp, "computation");

  m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
  TRACE_msg_set_task_category (finalize, "finalize");

  //(...)

  MSG_clean();
  return 0;
}

Analyzing the SimGrid Traces

The SimGrid library, during an instrumented simulation, creates a trace file in the Paje file format that contains the platform utilization for the simulation that was executed. The visualization analysis of this file is performed with the visualization tool Triva, with special configurations tunned to SimGrid needs. This part of the documentation explains how to configure and use Triva to analyse a SimGrid trace file.

Tracing Functions

Tracing configuration Options

These are the options accepted by the tracing system of SimGrid:

Example of Instrumentation

A simplified example using the tracing mandatory functions.

int main (int argc, char **argv)
{
  MSG_global_init (&argc, &argv);

  //(... after deployment ...)

  //note that category declaration must be called after MSG_create_environment
  TRACE_category_with_color ("request", "1 0 0");
  TRACE_category_with_color ("computation", "0.3 1 0.4");
  TRACE_category ("finalize");

  m_task_t req1 = MSG_task_create("1st_request_task", 10, 10, NULL);
  m_task_t req2 = MSG_task_create("2nd_request_task", 10, 10, NULL);
  m_task_t req3 = MSG_task_create("3rd_request_task", 10, 10, NULL);
  m_task_t req4 = MSG_task_create("4th_request_task", 10, 10, NULL);
  TRACE_msg_set_task_category (req1, "request");
  TRACE_msg_set_task_category (req2, "request");
  TRACE_msg_set_task_category (req3, "request");
  TRACE_msg_set_task_category (req4, "request");

  m_task_t comp = MSG_task_create ("comp_task", 100, 100, NULL);
  TRACE_msg_set_task_category (comp, "computation");

  m_task_t finalize = MSG_task_create ("finalize", 0, 0, NULL);
  TRACE_msg_set_task_category (finalize, "finalize");

  //(...)

  MSG_clean();
  return 0;
}

Analyzing the SimGrid Traces

The SimGrid library, during an instrumented simulation, creates a trace file in the Paje file format that contains the platform utilization for the simulation that was executed. The visualization analysis of this file is performed with the visualization tool Triva, with special configurations tunned to SimGrid needs. This part of the documentation explains how to configure and use Triva to analyse a SimGrid trace file.


Back to the main Simgrid Documentation page The version of Simgrid documented here is v3.6.2.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated for SimGridAPI by doxygen