Intel® Fortran Compiler 16.0 User and Reference Guide

Using IPO

This topic discusses how to use IPO from the command line.

Compiling and Linking Using IPO

To enable IPO, you first compile each source file, then link the resulting source files.

First, compile your source files with [Q]ipo compiler as shown below:

Operating System

Example Command

Linux* and OS X*

ifort -ipo -c a.f90 b.f90 c.f90

Windows*

ifort /Qipo /c a.f90 b.f90 c.f90

The output of the above example command differs according to operating system:

Use the c compiler option to stop compilation after generating .o or .obj files. The output files contain compiler intermediate representation (IR) corresponding to the compiled source files.

Second, link the resulting files. The following example command will produce an executable named app:

Operating System

Example Command

Linux and OS X

ifort -o app a.o b.o c.o

Windows

ifort /exe:app a.obj b.obj c.obj

The command invokes the compiler on the objects containing IR and creates a new list of objects to be linked. Alternately, you can use the xild (Linux and OS X) or xilink (Windows) tool, with the appropriate linking options.

Combining the Steps

The separate compile and link commands demonstrated above can be combined into a single command, as shown in the following examples:

Operating System

Example Command

Linux and OS X

ifort -ipo -o app a.f90 b.f90 c.f90

Windows

ifort /Qipo /exe:app a.f90 b.f90 c.f90

The ifort command, shown in the examples above, calls GCC ld (Linux and OS X) or link.exe (Windows only) to link the specified object files and produce the executable application, which is specified by the -o (Linux and OS X) or /exe (Windows) option.

Capturing Intermediate IPO Output

The [Q]ipo-c and [Q]ipo-S compiler options are useful for analyzing the effects of multi-file IPO, or when experimenting with multi-file IPO between modules that do not make up a complete program.

For both options, you can use the -o (Linux and OS X) or /exe (Windows) option to specify a different name.

These options generate multiple outputs if multi-object IPO is being used. The name of the first file is taken from the value of the -o (Linux and OS X) or /exe (Windows) option.

The names of subsequent files are derived from the first file with an appended numeric value to the file name. For example, if the first object file is named foo.o (Linux and OS X) or foo.obj (Windows), the second object file will be named foo1.o or foo1.obj.

You can use the object file generated with the [Q]ipo-c option, but you will not get the full benefit of whole program optimizations if you use this option.

The object file created using the [Q]ipo-c option is a real object file, in contrast to the mock file normally generated using IPO; however, the generated object file is significantly different than the mock object file. It does not contain the IR information needed to fully optimize the application using IPO.

The compiler generates a message indicating the name of each object or assembly file it generates. These files can be added to the real link step to build the final application.

See Also