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

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

Grgur
Beginner
1,311 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
1,265 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

0 Kudos
6 Replies
Ron_Green
Moderator
1,266 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

0 Kudos
Grgur
Beginner
1,255 Views

Thanks for the feedback, Ron!

 

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

0 Kudos
Ron_Green
Moderator
1,250 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.

0 Kudos
Ron_Green
Moderator
1,258 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)

0 Kudos
Grgur
Beginner
1,240 Views

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

0 Kudos
Barbara_P_Intel
Moderator
993 Views

The ifort compiler on macOS no longer accepts the "-p" compiler option and the documentation is fixed, too. These fixes are part of oneAPI HPC Toolkit 2023.0.

Thanks for reporting the issue!



0 Kudos
Reply