Profiling

 

To become acquainted with the Linux profiling tools, test gprof on the Lapack-assignment, using the slow, unoptimized BLAS. Test also gcov, a tool for counting the number of times a line is executed (among other things). You can make the test with a fixed size of the matrix. Take n = 1200.

For this test to work, use gfortran and gcov.

Which routine takes up most of the execution time? Which loop in this routine is executed the most number of times? How many?

For more information about these commands you can (sometimes) use the info-command (and not just the man-command). Try, e.g. info gprof or info gfortran or just info by itself.

If you are using a Mac (a note from Hugo Strand & Markus Billeter, 2009):
We have encountered problems with gprof on Mac OS X (10.5.7), where gprof reported zero running times for all functions in the application. Some research on Google confirmed the problem but did not present any solution, instead suggesting the use of a profiler provided by Apple.

There are several other profiling tools. One low-level tool is PAPI, which can provide information on a hardware level. PAPI can count the number of cycles, branches, L1 data cache misses etc. The package requires system privileges which I don't have (the Linux kernel must be modified).


Back