Skip to content

Instantly share code, notes, and snippets.

@jeb2239
Forked from daniel-j-h/pgo.sh
Created July 23, 2017 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeb2239/c98eb8e12e4c812edca40ecb563bf374 to your computer and use it in GitHub Desktop.
Save jeb2239/c98eb8e12e4c812edca40ecb563bf374 to your computer and use it in GitHub Desktop.
pgo: profile guided optimization with gcc
# Instrument binaries, pgo data to /data/pgo, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-generate=/data/pgo' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
# Run instrumented program, generate and write pgo data
./runIt
# Use profile data and feed into gcc, correct for threading counter noise, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-use=/data/pgo -fprofile-correction' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment