Generating Function Order Lists

A function order list is text that specifies the order in which the linker should link the non-static functions of your program. The list improves the performance of your program by reducing paging and improving code locality. Profile-guided optimizations support the generation of a function order list to be used by the linker. The compiler determines the order using profile information.

To generate a function order list, use the profmerge and proforder utilities.

Function Order List Usage Guidelines (Windows*)

Use the following guidelines to create a function order list:

Comparison of Function Order Lists and IPO Code Layout

The Intel® compiler provides two methods of optimizing the layout of functions in the executable:

Each method has its advantages. A function order list, created with proforder, lets you optimize the layout of non-static functions: that is, external and library functions whose names are exposed to the linker.

The compiler cannot affect the layout order for functions it does not compile, such as library functions. The function layout optimization is performed automatically when IPO is active.

Function Order List Effects

Function Type

Code Layout
with -ipo (/Qipo)

Function
Ordering
with proforder

Static

X

No effect

Extern

X

X

Library

No effect

X

Example of Generating a Function Order List

This section provide a general example of the process for generating a function order list. Assume you have a Fortran program that consists of the following files:

Additionally, assume you have created a directory for the profile data files called profdata. You would enter commands similar to the following to generate and use a function order list for your application.

  1. Compile your program using the -prof-genx (Linux) or /Qprof-genx (Windows) option:

Platform

Example commands

Linux

ifort -o myprog -prof-genx -prof-dir ./profdata file1.f file2.f

Windows

ifort /exe:myprog /Qprof-genx /Qprof-dir c:\profdata file1.f file2.f

This step creates an instrumented executable.

  1. Run the instrumented program with one or more sets of input data. If you specified a location other than the current directory, change to the directory where the executables are located.

Platform

Example commands

Linux

./myprog

Windows

myprog.exe

The program produces a .dyn file each time it is executed. This process make take some time time depending on the options specified.

  1. Merge the data from instrumented program from one or more runs of the instrumented program using the profmerge tool to produce the pgopti.dpi file. Use the -prof-dir (Linux) or /Qprof-dir (Windows) option to specify the location of the .dyn files.

Platform

Example commands

Linux

profmerge -prof-dir ./profdat

Windows

profmerge /prof-dir c:\profdata

  1. Generate the function order list using the proforder utility. (By default, the function order list is produced in the file proford.txt.)

Platform

Example commands

Linux

proforder -prof-dir ./profdata -o myprog.txt

Windows

proforder /prof-dir c:\profdata /o myprog.txt

  1. Compile the application with the generated profile feedback by specifying the ORDER option to the linker. Again, use the -prof-dir (Linux) or /Qprof-dir (Windows) option to specify the location of the profile files.

Platform

Example commands

Linux

ifort -o myprog -prof-dir ./profdata file1.f file2.f -Xlinker -ORDER:@myprog.txt

Windows

ifort /exe:myprog Qprof-dir c:\profdata file1.f file2.f /link /ORDER:@MYPROG.txt