No profile generated when using -pg

No profile generated when using -pg

I'm trying to profile my code using gprof and compile using the -pg command but when I run the executable no gmon.out is produced. My code contains a few modules and links to the Math Kernel Library(blas) if that is necessary to know.

I compile my code using:

ifort -module ../mod -pg [all my files.f90] -mkl -lmkl_blas95_lp64

I've also tried doing it piecemeal by creating the object and .mod files then linking to see if that would make a difference but nothing.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Try using -p instead. -pg is deprecated and it's possible it's being ignored, but you should get a message if that's the case.

Retired 12/31/2016

I believe you would need to link the static MKL libraries if you wish their timings to appear in the profile.  You still will not get full gprof information (call counting), as the libraries weren't built for profiling.  If you have module procedures, those would need to be built with profiling options.

Thanks for the replies but neither option worked. I used -p and -static-intel but I'm still not getting any output produced after I run the executable.

You should be able to generate gmon.out even if it is not capturing MKL timings.  However, you will need to follow the MKL link advisor to get static linked MKL.

I'm still not getting a gmon.out. I'm on Mac 10.8.4. I've also tried this with g++ and ifort with a different program but no gmon.out is produced. I've searchd on the internet and think it might be a problem with Mountain Lion unless anyone else has been able to do it. I've decided to try out Instruments and see if I can get time in each routine that way unless I can find a way to work gprof.

I tried a small experiment on Linux (not MacOS). 

I used the canonical hello-world program written in both C and Fortran, used the -pg switch, and the C program created the gmon.out, but the Fortran one did not.

At first glance, I didn't see anything obviously different in the setup between the two compilers, so we'll need to look under the hood.  


Leave a Comment

Please sign in to add a comment. Not a member? Join today