I keep getting __gcov related errors when trying to do a p.g.o. with cygwin gcc. Ive tried putting the -fprofile-generate in different spots, with different results: The Makefile looks like this at the top:
CC = gcc
OPT = -O2
FLAGS = -Wall
If I put -fprofile-generate right after and on the same line as CC = gcc then it will compile and link, but after I run the program and then try to run -fprofile-use I get all the __gcov errors again. If I put -fprofile-generate after and on the same line as OPT = -O2, then it wont work even on the first compile. Any suggestions? I heard -lgcov might be a workaround but I can't get that to work either.
PGO
Moderator: Ras
-
- Posts: 2282
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: PGO
Hi Kenny,
is required.
Try compiling on command line instead (making a batch file is handy).
Example >
then after running some matches/testsuites>
Jim.
Code: Select all
-lgcov
Try compiling on command line instead (making a batch file is handy).
Example >
Code: Select all
del *.o
cls
gcc-4.exe -o dendron.exe *.cpp -pipe -w -O3 -static -fomit-frame-pointer -march=pentium -std=gnu99 -ftree-vectorize -funroll-all-loops -funsafe-math-optimizations -mfpmath=387 -lm -lstdc++ -lgcov -fprofile-arcs
Code: Select all
del *.o
cls
gcc-4.exe -o dendron.exe *.cpp -pipe -w -O3 -static -fomit-frame-pointer -march=pentium -std=gnu99 -ftree-vectorize -funroll-all-loops -funsafe-math-optimizations -mfpmath=387 -lm -lstdc++ -lgcov -fprofile-use
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: PGO
for a gcc compile which optimization flags would you say are a safe bet to increase speed when used along with -fprofile-generate? I was thinking of using march=pentium4 since Im on a p4, but will march=pentium do just as well? I found that by using -fprofile-generate on all lines Im getting it to compile both times without errors, and I added a LDFLAGS part to the makefile:
CC = gcc -fprofile-generate
OPT = -O2 -fprofile-generate
CFLAGS = -Wall
LDFLAGS = -fprofile-generate
this is all Ive found that works for all steps, but Im definitely open to suggestions here for better OPT ideas like maybe adding march= .
never could get -lgcov to work, although I tried many different configurations. Once I run this then I switch all the -generate to -use and
it compiles, so I really dunno. I might not need it in the OPT section, but just in the CC and LDFLAGS.
CC = gcc -fprofile-generate
OPT = -O2 -fprofile-generate
CFLAGS = -Wall
LDFLAGS = -fprofile-generate
this is all Ive found that works for all steps, but Im definitely open to suggestions here for better OPT ideas like maybe adding march= .
never could get -lgcov to work, although I tried many different configurations. Once I run this then I switch all the -generate to -use and
it compiles, so I really dunno. I might not need it in the OPT section, but just in the CC and LDFLAGS.
outAtime
-
- Posts: 2282
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: PGO
Try these >
requires Gcc-4
Jim.
Code: Select all
-ftree-vectorize -funroll-all-loops -funsafe-math-optimizations -mfpmath=387
Code: Select all
-ftree-vectorize
Jim.
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: PGO
Im sorry, I just noticed you are doing -fprofile-arcs then on recompile using -fprofile-use, which I didn't think was possible. I thought -arcs and -use were not compatable and that only -fbranch-probabilities could be used to optimize with -arcs. Hmmmm.
outAtime
-
- Posts: 2282
- Joined: Fri Jul 14, 2006 7:56 am
- Location: London, England
- Full name: Jim Ablett
Re: PGO
Sorry, just a typo, but have you tried this? Maybe -fbranch-probabilities is covered by -fprofile-use.outAtime wrote:Im sorry, I just noticed you are doing -fprofile-arcs then on recompile using -fprofile-use, which I didn't think was possible. I thought -arcs and -use were not compatable and that only -fbranch-probabilities could be used to optimize with -arcs. Hmmmm.
Jim.
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: PGO
No, I haven't yet...I guess because -fprofile-arcs and -lgcov are used or implied by -fprofile-generate that is why this has been working. Im about to try a full pgo without -vector because I must have 3.5.2 or somthing and I dont feel like updating it right now, but I was just wondering about the possible effects of both engines pondering during the .exe run...guess Im about to find out! Hoping for some good speed.
outAtime