Enable profiling with gprof

Post here if you have having problem using the Makefile build process.

Enable profiling with gprof

Postby tor_kje » Sun Sep 08, 2013 4:53 pm


I want to be able to use gprof to profile my program
written in fortran90. gprof does however not automatically
profile the lapack routines and after some search I found this:

Q: How can I profile a code, using gprof or xprofiler, and include the calls to LAPACK?
A: You'll need to include the profile-enabled version of LAPACK, namely -llapack_profile which resides in /usr/local/lib

I have not much experience with makefiles so I have failed miserably
in trying to create this library. Is there anyone that can help me with

Also, at the moment I have downloaded the libraries using synaptic package
manager for Ubuntu (which takes lapack 3.4.2 if you choose the right repo).
Do I need to uninstall this before installing through makefiles?

Posts: 2
Joined: Sun Sep 08, 2013 11:56 am

Re: Enable profiling with gprof

Postby admin » Fri Dec 06, 2013 8:14 pm

If you cannot find liblapack_profile.a in /usr/local/lib, that means you have ti build it yourself.
Download lapack from http://netlib.org/lapack/
Edit the make.inc to add: -pg to the compiler flags
Build the library

Compile you program with -pg
and run gprof as scribed here: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html

Hope it helps
Site Admin
Posts: 616
Joined: Wed Dec 08, 2004 7:07 pm

Return to Makefile

Who is online

Users browsing this forum: No registered users and 2 guests