compiling with -Mpfi -Mpfo option

hy,
i want to compile my program with the -Mpfi option and re-compile it after using the -Mpfo option, but the compiler crash and i don’t know why…
if someone can help me…
thanks
Greg

Hi Greg,

What error are you getting? Is this a community application, or your own code? What type of system are you using?

Thanks,
Mat

Step for using Profile Guided Feedback:

  1. Compile with your best optimizations plus “-Mpfi”
  2. Run your program with a representative data set to create a “pgfi.out” file.
  3. Clean your build making sure that the “pgfi.out” file is not removed.
  4. Re-compile as you did in step 1 but replace “-Mpfi” with “-Mpfo”.

Hi Mat,
I try with your method and it works…
In fact i try to compile my own code on linux (we actually work on opteron dual core)… i’ve got an executable to compile and i make a library…i think the first time i try it didn’t work because i also compile my library using -Mpfi/Mpfo…i just try to compile just my executable with -Mpfi/Mpfo and it works…
Do you know if it is possible to also compile my library with this option???
Thanks,
Greg

Hi Greg,

Do you know if it is possible to also compile my library with this option???

Profile Guided Feedback (PFO) can be used with libraries, however, you’ll need to link the library with a representative executable in order to generate the pgfi.out file.

The steps would be as follows:

  1. Add -Mpfi to the build options of the library as one would for an executable.
  2. Build the library.
  3. Add -Mpfi to the link options of the executable. You can add -Mpfi to the compilation if you want to profile the execuatable as well.
  4. Build the executable.
  5. Run the executable. ‘pgfi.out’ appears in the execution area.
  6. Copy ‘pgfi.out’ to the build directory for the library.
  7. Rebuild the library with -Mpfo.
  8. If needed, you can also rebuild the executable.

Hope this helps,
Mat