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.
Use the following guidelines to create a function order list:
The order list only affects the order of non-static functions.
You must compile with /Gy to enable function-level linking. (This option is active if you specify either option /O1 or /O2.)
The Intel® compiler provides two methods of optimizing the layout of functions in the executable:
Using a function order list
Using the -ipo (Linux*) or /Qipo (Windows*) compiler option
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 Type |
Code Layout |
Function |
---|---|---|
Static |
X |
No effect |
Extern |
X |
X |
Library |
No effect |
X |
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:
file1.f
file2.f
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.
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.
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.
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 |
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 |
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 |