Gprof Tutorial

From HPC Wiki
Revision as of 14:47, 27 November 2020 by Marc-andre-hermanns-bc32@rwth-aachen.de (talk | contribs) (Move landing page to MPI-Developer category)
Jump to navigation Jump to search

Gprof is a free and easy-to-use profiler. Profiling applications gives valuable insights into the program structure. It exposes performance bottlenecks and points to sections of the code where optimization is most effective.

This tutorial covers the necessary basics to get started with gprof.


( Slides as pdf)

Quiz

Collapse
1. What lanuages can Gprof profile?

Python, Java, Julia
C/C++, Fortran, Pascal
Haskell, Cobol, Whitespace

Collapse
2. How does gprof profiles an application?

By instrumenting the application during compilation.
Through static analysis of the source code

Collapse
3. What compiler flag is used to instrument the application?

-pg
-pig
--profile

Collapse
4. How should the parameters be when running the instrumented application?

Simple and understandable
Representative of the usual workload
Covering edge cases

Collapse
5. What is a call graph?

An android app to show incoming callers
A hierarchy diagram of function calls in a given profile
Instructions of how to call for help during emergencies

Collapse
6. How do you generate a callgraph of a gprof profile?

gprof --call-graph
gprof
gprof --graph

Collapse
7. What is gprof2dot?

Third party script for call graph visualization via the "dot" library
Gprof feature to export profiles as a pdf
A fork of the beta version of gprof2

Collapse
8. Does gprof work with MPI applications?

No, gprof only works with sequential applications
Yes, parallel profiling is the main use case of gprof
Yes, but gprof cannot differentiate between individual threads/processes

Collapse
9. How much overhead does gprof produce?

None
Little
Much