The following is an example of the basic PGO phases:
Use -prof_gen[x] to produce an executable with instrumented information.
prompt>icc
-prof_gen -c a1.cpp a2.cpp a3.cpp
prompt>icc a1.o a2.o a3.o
prompt>ecc
-prof_gen -c a1.cpp a2.cpp a3.cpp
prompt>ecc a1.o a2.o a3.o
In place of the second command, you could use the linker directly to produce the instrumented program.
prompt>a.out
The resulting dynamic information file has a unique name and .dyn suffix every time you run a.out. The instrumented file helps predict how the program runs with a particular set of data. You can run the program more than once with different input data.
Compile and link the source files with -prof_use to use the dynamic information to optimize your program according to its profile:
Besides the optimization, the compiler produces a pgopti.dpi file. You typically specify the default optimizations (-O2) for phase 1, and specify more advanced optimizations (-ip or -ipo) for phase 3. This example used -O2 in phase 1 and -O2 -ip in phase 3.
Note
The compiler ignores the -ip or the -ipo options with -prof_gen[x].