S E S P

VTune - A Quick Tutorial

 

The Software
Engineering Group

Computational Science & Engineering
CLRC Rutherford Appleton Laboratory


Introduction

This tutorial contains three sections:
  1. Create and run a sampling activity and see results that show where the code is spending most of its time.
    • Outputs are:
      • VTune sampling activity that runs the code
      • Data on clocktick samples for one run of the code
      • Annotated source with clocktick samples shown for each executable line of code
  1. Create and run a callgraph activity and see results that show the call sequence of the code, the call information and the most time consuming call sequence (the critical-path).
    • Outputs are:
      • VTune callgraph actitivty that runs the code
      • Data on calls to and from functions and the critical path
      • GUI to examine data
  1. General remarks
    • Specifying applications and modules of interest
    • Applications with arguments
    • GUI for sampling results

Sampling Activity

Compile your application so that it includes debug information, usually with the -g option. This will allow display of source code with execution time against each line.

Create and run a sampling actitivty

[djw@hsl vtune_vtl]$ vtl activity -c sampling -app /opt/intel/vtune/samples/vtunedemo/vtunedemo -moi vtunedemo run

View output - we see the application run and messages from VTune.

The important arguments to this command are -app <name of application to run> and -moi <name of module in that application we are interested in>.  Usually the module is the same as the application but for scripts that run many applications we can use -moi to focus on one in particular.

Take a look at the activities we have created

[djw@hsl vtune_vtl]$ vtl show

VTune(TM) Performance Analyzer 8.0 for Linux*
Copyright (C) 2000-2005 Intel Corporation. All rights reserved.

a1__Activity1
    r1___Sampling Results [hsl] - Tue May  2 15:40:08 2006



Show the clocktick results

[djw@hsl vtune_vtl]$ vtl view -ar a1 -hf -mn vtunedemo -en 'Clockticks'

The arguments here are:
  • -ar - the activity we want results for.
  • -hf - we want to see the sampling hotspots grouped by function.
  • -mn - the module we are intersted in.
  • -en - the data we want displayed. In this case clockticks is a measure of the time taken in each routine.
View output - see where the most time was spent?

So let's look in detail at the offending function

[djw@hsl vtune_vtl]$ vtl view -ar a1 -code -mn vtunedemo -fn usesse2 > annotated_src.c

View annotated_src.c - Ev2 is the column we want - the clockticks column.

Callgraph Activity

Create and run a callgraph actitivty

[djw@hsl vtune_vtl]$ vtl activity -c callgraph -app /opt/intel/vtune/samples/vtunedemo/vtunedemo -moi /opt/intel/vtune/samples/vtunedemo/ vtunedemo run

View output - we see the application run and messages from VTune

Take a look at the activities we have created so far

[djw@hsl vtune_vtl]$ vtl show

VTune(TM) Performance Analyzer 8.0 for Linux*
Copyright (C) 2000-2005 Intel Corporation. All rights reserved.

a1__Activity1
    r1___Sampling Results [hsl] - Wed May  3 09:15:36 2006
a2__Activity2
    r1___Call Graph Results [localhost] - Wed May  3 09:18:56 2006

View call info: parent functions with children, threads and timing info

[djw@hsl vtune_vtl]$ vtl view -ar a2 -calls > calls.csv

View output - see the calls in the program? :-(

Let's have a look at the most time consuming call sequence (the 'critical path')

[djw@hsl vtune_vtl]$ vtl view -ar a2 -critical-path > critical_path.csv

View output - see the critical path? :-(

You're right, the information is there but very obscure. You could use grep, awk and sort to get useful columns but we want a GUI!

[djw@hsl vtune_vtl]$ vtl view -ar a2 -gui

Call graphCall list


General Remarks

The application should be given with its full path after the -app flag and if the application runs other executables (e.g. it's a shell script) you can analyse one in particular by using -moi exe_of_interest.  For single executables give its name to the -moi flag (safer to make this the full path too).

If your application requires arguments then put them in double quotes separated from the application name with a comma. For example to run an activity on

ls -a -l

the application is specified as

-app ls,"-a -l"

You can also get a GUI for the sampling activity by running

[djw@hsl vtune_vtl]$ vtl view -ar a1 -gui

and using double clicks to drill down from process to module (program) to function and ultimately to source code.



Man pages
SESP Homepage

SEG Homepage