Intel® Trace Analyzer and Collector User and Reference Guide

ID 767272
Date 3/31/2023
Public
Document Table of Contents

Recording Source Location Information

Intel® Trace Collector can automatically record locations of function calls in the source code. To record this information, do the following:

  1. Compile the relevant application modules with support for debug information by using the -g (Linux* OS) and /Zi or /Z7 (Windows* OS) compiler flags. For example:

    $ mpiicc -g -c ctest.c
  2. Enable Program Counter (PC) tracing by setting the environment variable VT_PCTRACE to 5 for example:

    $ export VT_PCTRACE=5

    Alternatively, set the VT_CONFIG variable to the configuration file specifying the following, for example:

    # trace 4 call levels whenever MPI is used
    ACTIVITY MPI 4
    # trace one call level in all functions not specified
    # explicitly; can also be, for example, PCTRACE 5
    PCTRACE ON

     

    $ export VT_CONFIG=<config_file>
  3. Trace your application as described in Tracing MPI Applications.

PCTRACE sets the number of call levels for all functions. To avoid performance issues, PCTRACE is disabled by default and should be handled carefully. It is useful to get the initial understanding of the application before recording the source location information.

Manual instrumentation of the source code with the Intel Trace Collector API can provide similar information but without performance overhead. See Defining and Recording Source Locations for details.

Pay attention that the compiler has to use normal stack frames. This is the default in GCC, but may be disabled with -fomit-frame-pointer. If the flag is used, then only the direct caller of MPI or API functions can be found, and asking Intel Trace Collector to unwind more than one stack level may lead to crashes.

The Intel compilers do not use normal stack frames by default if optimization is enabled, but they can be enabled with -fno-omit-frame-pointer.