ATLAS Offline Software
Valkyrie

This package contains several classes that facilitate the use of valgrind tools within the Atlas software. The following sections describe different use cases. General information about using valgrind in Atlas can be found on the UsingValgrind TWiki.

Algorithm profiling using callgrind

Since code profilers like callgrind collect a huge amount of data and since you are most likely only interested in your particular algorithm it is not a good idea to simply run the profiler on an athena job. Using ValgrindSvc it is possible to profile specific algorithms only. For a typical CA-job this can be configured via setting the following flags:

  python -m AthExHelloWorld.HelloWorldConfig PerfMon.Valgrind.ProfiledAlgs=["HelloWorld"]

and then running the job within valgrind:

  valgrind --tool=callgrind --trace-children=yes --instr-atstart=no [CMD]

Add your other favorite valgrind options but make sure that the instrumentation at start is turned off, since ValgrindSvc will take care of enabling it at the right time. The algorithm names in ProfiledAlgs can contain regular expressions (Perl synatx) to match several instances of one algorithm. For example,

   ProfiledAlgs = ["MyAlg_.*"]

will profile all algorithms matching this regular expression. If ProfiledAlgs is empty (the default) the entire event loop, i.e. everything between BeginEvent/EndEvent, will be profiled.

Profiling of arbitrary intervals

It is possible to profile arbitrary intervals in the lifetime of a Gaudi component. For example, you may want to profile only the initialize method of your algorithms, or anything that is executed between initialize and finalize, or anything in between the initialize of two algorithms. You can use the ProfiledIntervals property for this. Examples:

  • ProfiledIntervals = ["MyAlg.initialize:MyAlg.finalize"]
    Profile between initialize and finalize of MyAlg
  • ProfiledIntervals = ["MyAlg.initialize:YourAlg.initialize"]
    Profile between initialize of MyAlg and initialize of YourAlg
  • ProfiledIntervals = ["MyAlg.initialize:xxx.yyy"]
    Start profiling at initialize of MyAlg and never stop (becaues xxx.yyy does not exist)
  • ProfiledIntervals = ["MyAlg.initialize"]
    Short for ["MyAlg.initialize:MyAlg.initialize"], i.e. profile initialize of MyAlg
  • ProfiledIntervals = ["MyAlg.initialize:YourAlg.initialize", "MyAlg.finalize"]
    Any number of (non-overlapping) intervals can be specified

As above, the algorithm name can contain a regular expression:

  • ProfiledIntervals = ["MyAlg_.*.initialize"]
    Profile initialize of all algorithms that match the expression. Be careful with nested initialize calls since the profiling will stop once the first instance is done with initialize.

Finally, a special notation can be used to steer the profiling based on incidents (no regular expressions allowed):

  • ProfiledIntervals = ["BeginRun.incident:EndRun.incident"]
    Profile between the BeginRun and EndRun incident.

In all cases the intervals are closed intervals in the mathematical sense, i.e. the profile always includes the start and end point.

Properties to control profile dumps

The following properties can be set to control whether a new profile is being dumped after each event and interval, respectively. The default values are:

  DumpAfterEachEvent = False
  DumpAfterEachInterval = True

Additonal profiles can be dumped on any "Incident" by setting:

  DumpAfterIncident = ["BeginRun","EndRun","MyIncident"]
Author
Sebastien Binet
Frank Winklmeier