Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

No profile generated when using -pg

nousername
Beginner
740 Views

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.

0 Kudos
6 Replies
Steven_L_Intel1
Employee
740 Views

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.

0 Kudos
TimP
Honored Contributor III
740 Views

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.

0 Kudos
nousername
Beginner
740 Views

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.

0 Kudos
TimP
Honored Contributor III
740 Views

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. http://software.intel.com/sites/products/mkl/MKL_Link_Line_Advisor%2B%2B.html

0 Kudos
nousername
Beginner
740 Views

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.

0 Kudos
Lorri_M_Intel
Employee
740 Views

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.  

                          --Lorri

0 Kudos
Reply