IPO Samples

These samples are designed to illustrate using multi-file Interprocedural Optimization (IPO). In addition, these file can illustrate how to generate an IPO report.

See Included Samples for other samples included with the compiler.

Sample files and locations

Source

Locations

ipo_sample_init.f90

ipo_sample_main.f90

ipo_sample_sum.f90

Linux* and Mac OS* X

<install-dir>/samples/ipo_samples/

Windows*

<install-dir>\samples\ipo_samples\

Description

These sample files illustrate both the process and concepts in multi-file IPO. For example, the samples include functions that will be inlined only when the sources are compiled using Interprocedural optimization on the whole program.

Compile using IPO

Compile all sources with IPO enabled. (You can combine these options with the appropriate compiler report option to generate the IPO report.)

Platform

Commands

Linux and Mac OS X

ifort -ipo ipo_sample_main.f90 ipo_sample_init.f90 ipo_sample_sum.f90

Windows

ifort /Qipo ipo_sample_main.f90 ipo_sample_init.f90 ipo_sample_sum.f90

The compiler generates messages for many of the IPO stages. The following examples illustrate typical messages. (Mac OS messages are similar to those listed for Linux; however, the linker phase messages are different.)

Platform

Status Messages

Linux

ipo: remark #11000: performing multi-file optimizations

ipo: remark #11005: generating object file /tmp/ipo_ifortyiejLX.o

Windows

ipo: remark #11000: performing multi-file optimizations

ipo: remark #11005: generating object file ipo_3076.obj

Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:ipo_sample_init.exe

Windows only: In the compilation directory you'll notice that in addition to the executable there are new object files (.obj).

Linux and Mac OS X: To get the equivalent object files (.o), use the -c option.

These object files contain the intermediate representation for each of the associated source files. These mock object files are used to generate the object file that is, in turn, used in the linking phase to generate the final executable.

Note

See Using IPO for more information about these mock object files and how you can use them.

Run the executable.

Platform

Commands

Linux and Mac OS X

./a.out

Windows

ipo_sample_main