Intel® Fortran Compiler 16.0 User and Reference Guide

Dumping Profile Information

The _PGOPTI_Prof_Dump_All() function dumps the profile information collected by the instrumented application. The prototype of the function call is listed below.

Syntax

void _PGOPTI_Prof_Dump_All(void);

An older version of this function, _PGOPTI_Prof_Dump(), is deprecated and no longer used.

The new function, _PGOPTI_Prof_Dump_All(), operates much like the deprecated function, except on Linux* operating systems, when it is used in connection with shared libraries (.so). When _PGOPTI_Prof_Dump_All() is called, it insures that a .dyn file is created for all shared libraries needing to create a .dyn file. Use _PGOPTI_Prof_Dump_All() on Linux OS to insure portability and correct functionality.

The profile information is generated in a .dyn file (generated in phase 2 of PGO).

The environment variables that affect the _PGOPTI_Prof_Dump_All() function are PROF_DIR, COV_DIR, PROF_DPI, and COV_DPI. Set the PROF_DIR or COV_DIR environment variable to specify the directory to which the .dyn file must be stored. Alternately, you can use the –[Q]prof_dir compiler option, when building with -[Q]prof-gen, to specify this directory without setting the PROF_DIR or COV_DIR variable. Set the PROF_DPI or COV_DPI environment variables to specify an alternative .dpi filename. The default filename is pgopti.dpi. You can also use the –prof_dpi profmerge tool option, when merging the .dyn files, to specify the filename for the summary .dpi file.

Recommended Usage

If your application does not use a standard exit() call, insert a single call to this function in the body of the function that terminates the user application. Normally, _PGOPTI_Prof_Dump_All() should be called just once. It is also possible to use this function in conjunction with _PGOPTI_Prof_Reset_All() function to generate multiple .dyn files (presumably from multiple sets of input data).

Note

If the data is not reset between the dumps with a call to the _PGOPTI_Prof_Reset_All() function, the counters will continue accumulating data, resulting in the subsequent .dyn file containing data that was previously dumped.

Example

! Selectively collect profile information
! for the portion of the application
! involved in processing input data.
input_data = get_input_data()
do while (input_data)
  call _PGOPTI_Prof_Reset()
  call process_data(input_data)
  call _PGOPTI_Prof_Dump_All()
  input_data = get_input_data()
end do
end program

Dumping Profile Data

This discussion provides an example of how to call the C PGO API routines from Fortran.

As part of the instrumented execution phase of PGO, the instrumented program writes profile data to the dynamic information file (.dyn file).

The profile information file is written after the instrumented program returns normally from PROGRAM() or calls the standard exit function.

Programs that do not terminate normally, can use the _PGOPTI_Prof_Dump_All() function. During the instrumentation compilation, using the -prof-gen (Linux* and OS X*) or /Qprof-gen (Windows*) option, you can add a call to this function to your program using a strategy similar to the one shown below:

Example

interface
  subroutine PGOPTI_Prof_Dump_All()
!DIR$attributes c,alias:'PGOPTI_Prof_Dump_All'::PGOPTI_Prof_Dump_All
  end subroutine
  subroutine PGOPTI_Prof_Reset()
!DIR$attributes c,alias:'PGOPTI_Prof_Reset'::PGOPTI_Prof_Reset
  end subroutine
end interface
call PGOPTI_Prof_Dump_All()

Caution

You must remove the call or comment it out prior to the feedback compilation with -prof-use (Linux and OS X) or /Qprof-use (Windows).