NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
PackagePlatformCategoryVersionModule Install DateDate Made Default

IBM/SP Profiling Tool (Xprofiler)

Xprofiler is a GUI based performance profiling tool distributed as part of the IBM Parallel Environment for AIX. It can be used to graphically identify which functions are the most CPU intensive in your code. It provides a graphical function call tree as well as a text profile pertaining to your code. Xprofiler can be used to profile sequential and parallel C, C++, Fortran 90, Fortran77 and HPF programs.

To use Xprofiler, you first compile and link your program to ensure that profiling is enabled, then run the program to produce gmon.out file(s) (one for each processor involved in the execution) and finally invoke the xprofiler utility to display the profiling information.

Xprofiler provides CPU (busy) data only. It cannot be used to provide information such as I/O or communication data.

Compiling and Linking your Program

To generate profiling information, it is necessary to compile and link using the "-g -pg" options.

% xlf -o executable -g -pg source.f 
% mpxlf90 -o executable -g -pg source.f 
% mpcc -o executable -g -pg source.c 
% mpCC -o executable -g -pg source.C

Notes

  • Also include any compiler optimization options applicable to your code
  • The "-g -pg" options must be included at both compile and link time. This is important if you compile and link your code in separate steps.

Generating the Profile

After compiling and linking your program, run it in the normal way :

% poe ./executable -procs n -nodes n 

When your program has completed, your current working directory will contain gmon.out files corresponding to each processor involved in the execution. These files are are named gmon.out.<processor-id>.

Notes

  • Performance degradation (up to a factor of 2) is expected when running the the profiled version of your code. 

Invoking xprofiler

To start xprofiler use :

% xprofiler executable [-s] [gmon.out.<processor-id>]

This will display profile information graphically

Interpreting the Display

Xprofiler displays the profiled program in a single window.  Green boxes represent functions and the calls between them are illustrated as blue arrows.

The size and shape of each function box indicates its CPU usage.  The height of the function box represents the CPU time it spent executing itself (exclusive time), while the width of the function box is representative of the amount of CPU time it spent executing itself plus its descendant functions (inclusive time).

Each function box has a label stating the name of the function as well as the inclusive and exclusive CPU time values.  The number of calls to a function are displayed on the blue arrow. Note it may be necessary to Zoom In i.e. View -> Zoom In to see these labels.

Notes/Recommendations

  • By default, the display shows functions clustered by library.  This may include shared libraries which contain system functions called by your application. To obtain a clear overview of the call tree for your executable only, use the Filter -> Hide All Library Calls option, followed by Filter -> Uncluster Functions .
  • There may be some problems with the default font setup for xprofiler e.g. an error message at xprofiler start-up and/or labels for function boxes not available without the use of Zoom. In this instance, it is necessary to change the default font for xprofiler. This can be accomplished by changing the *narc*font setting to a scalable font as follows :
    • Scalable fonts are of the format -*-0-0-. The following details how to change to the scalable font -*-roman-medium-r-normal-*-0-0-100-100-*-*-*-* . Note: Use the command xlsfonts to ensure that this font is available on your local system i.e. where xprofiler's display will appear. If it is not available, then replace this with a scalable font which is available on your system.
    • Include the following line in your $HOME/.Xdefaults file on seaborg : *narc*font: -*-roman-medium-r-normal-*-0-0-100-100-*-*-*-*
    • To activate the new setting, run the command : xrdb -load $HOME/.Xdefaults on seaborg
    Also, clicking on the function box with the right mouse button will display the function name as well as the CPU (exclusive and inclusive) time statistics.

Xprofiler Menus

Function Menu

This is available by clicking on the function box for the relevant function with the rightmost mouse button. A useful statistic is the no. of ticks per line of source code. This is useful to help locate the line(s) of source code where most CPU time is consumed as shown in the display.

Text Profile

The text profile pertaining to your application is available from the Report menu. The Flat Profile, Call Graph Profile and Function Index reports are identical to the output from the gprof profiler. The Library Statistics option provides timing information on the various libraries and external objects which are employed while the Function Call Summary reports statistics on calls between functions in the application.

The flat profile pertaining to our sample code

Saving Results

As stated above, results of profiling may be lost at logout since xprofiler must run in $TMPDIR. Saving profiler reports and graphs is recommended before logging out. To save the displayed call graph, use File -> Screen Dump. It is necessary to first set various save options (e.g. save to file or send to printer) using Set Options... and then Select Target Window using the mouse to select the display region to be saved.

Comment

Xprofiler provides a qualitative view of the function call tree for a particular execution of your code. It is mainly a graphical interface to the gprof profiler but users should find xprofiler useful for its ability to display an annotated source and assembly listing. In particular, the "number of ticks" statistic isolates the source/assembly lines where most cycles are consumed.

Additional Information


LBNL Home
Page last modified: Mon, 11 Jan 2010 21:25:15 GMT
Page URL: http://www.nersc.gov/nusers/resources/software/ibm/xprofiler/
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science