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

Running code compiled with ifort -p not generating profiling output gmon.out

Grgur
Beginner
302 Views

Compiling a file with `ifort -p test.f90` and running `./a.out` does not create profiling output gmon.out on macOS 10.15. I've provided an example code below, but it is the case for any file I've tried. Am I missing something?

 

I've tested it with ifort 2021.4.0 and 2021.1.1on macOS 10.15.

 

 

program test_profiling
    implicit none
    real        :: x,y
    x = 0.34
    y = func(x)
    print *,'hello world'
    print *,'x,y = ',x,y
 contains
   real function func(x)
       implicit none
       real,intent(in) :: x
       func = x*2
   end function func
end program test_profiling

 

 

 

 

0 Kudos
1 Solution
Ron_Green
Moderator
256 Views

Ah, looks like we forgot to take that -p option out.  A long time ago macOS came with gcc and binutils.  So years ago gprof was available on macOS.  It no longer is.  even if you install gcc and binutils with Homebrew or something, our compiler would not know where to find the libs needed for the profiling.  

 

SO ... I'll ask my Intel colleauges to:

1) remove -p as an option to the driver.

2) remove -help information on -p

3) remove -p from the Developer Guide and Reference for macOS

View solution in original post

5 Replies
Ron_Green
Moderator
257 Views

Ah, looks like we forgot to take that -p option out.  A long time ago macOS came with gcc and binutils.  So years ago gprof was available on macOS.  It no longer is.  even if you install gcc and binutils with Homebrew or something, our compiler would not know where to find the libs needed for the profiling.  

 

SO ... I'll ask my Intel colleauges to:

1) remove -p as an option to the driver.

2) remove -help information on -p

3) remove -p from the Developer Guide and Reference for macOS

Grgur
Beginner
246 Views

Thanks for the feedback, Ron!

 

So there is no profiling option on macOS currently or for the foreseeable future?

Ron_Green
Moderator
241 Views

compile with -g and use the 'Instruments' tool that comes with Xcode tools.  It is GUI based so if you only have command line there's hopefully some way to run it in CLI mode.

Ron_Green
Moderator
249 Views

as an alternative, you can compile with -g and use Instruments to profile

 

https://coderedirect.com/questions/315993/profiling-c-on-mac-os-x

 

this is for C++ but it should work for Fortran too ( I think.  haven't tried it)

Grgur
Beginner
231 Views

Thanks for the hint. I haven't used Instruments before, I'll give it a try.

Reply