Difference between revisions of "Gprof Tutorial"

From HPC Wiki
Jump to navigation Jump to search
Line 80: Line 80:
  
 
{{hidden begin  
 
{{hidden begin  
|title = 1. What lanuages can gprof profile?
+
|title = 1. What is a call graph?
 
}}
 
}}
 
<quiz display=simple>
 
<quiz display=simple>
 
{
 
{
 
|type="()"}
 
|type="()"}
Python, Java, Julia
+
-   
||  
+
|| An android app to show incoming callers
C/C++, Fortran, Pascal
+
+   
|| True
+
|| A hierarchy diagram of function calls in a given profile
Haskell, Cobol, Brainfuck
+
||
+
|| Instructions of how to call for help during emergencies
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = 2. How do you generate a callgraph of a gprof profile?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
 +
|| gprof --call-graph
 +
-
 +
|| gprof
 +
+
 +
|| gprof --graph
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = 3. What is gprof2dot?
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+
 +
|| 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
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = 4. Does gprof work with MPI applications?
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
 +
|| 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
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = 5. How much overhead does gprof produce?
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
 +
|| None
 +
+
 +
|| Little
 +
-   
 +
|| Much
 
</quiz>
 
</quiz>
 
{{hidden end}}
 
{{hidden end}}

Revision as of 11:56, 2 November 2020


HPC.NRW
HPC.NRW
Associated Pages
+ This is an #HPC.NRW course
HPC Courses
1. Introduction to Linux in HPC
2. Gprof Tutorial
3. OpenMP in Small Bites


Gprof is a free and easy-to-use profiler.

Gprof Introduction + Pascal Example

Quiz

1. What lanuages can gprof profile?

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

2. How does gprof profiles an application?

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

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

-pg
-pig
--profile

How should the parameters be when running the instrumented application?

Simple and understandable
Representative of the usual workload
Covering edge cases

C++ + Fortran Examples

Show gprof in real world examples and introduce call graph.


Quiz

1. What is a call graph?

Syntax error

???
???
???

2. How do you generate a callgraph of a gprof profile?

Syntax error

???
???
???

{{hidden begin |title = 3. What is gprof2dot?

Syntax error

???
???
???

{{hidden begin |title = 4. Does gprof work with MPI applications?

Syntax error

???
???
???

{{hidden begin |title = 5. How much overhead does gprof produce?

Syntax error

???
???
???